Integrations
HubSpot, Salesforce and Mailchimp
Bring CRM and Mailchimp audience data into Herald as attributes and segments, optionally write results back to your CRM, and stop email to people who unsubscribed in Mailchimp.
Note
Built from each vendor's documented API and tested against local mocks; tell us if anything differs in your account.
These integrations pull from your CRM or audience every hour (or on Sync now) and only update people your app already sent Herald. Set them up in Settings → Integrations. An admin does it. Secrets are write-only and stored encrypted.
What you'll need
- An admin of the account. Integrations are set up in Settings → Integrations.
- HubSpot: a private app with
crm.objects.contacts.readandcrm.lists.read(plus the write scopes for write-back). - Salesforce: a connected app with the client credentials flow and a run-as user that can read Contacts or Leads (and edit them for write-back).
- Mailchimp: an API key and the audience id.
How matching works
A CRM or Mailchimp record never creates a person. It updates someone the app already sent Herald, in the same app.
- HubSpot and Salesforce match by an id property first (config
idProperty: a person whose user id equals its value), then by email (case-insensitive, against the person's email). HubSpot'sidPropertydefaults toherald_user_id. Salesforce has no default, so without one it matches by email only. - Mailchimp matches by email, case-insensitive, against the person's email contact.
Records that match no one are counted as unmatched and never imported.
What syncs
- Attributes. You choose up to 20 properties or fields (letters, digits and
_, starting with a letter). Each lands on the matched person ashubspot_<name>,salesforce_<name>ormailchimp_<name>, lower case. An empty value removes the attribute. Nothing is copied by default. - Segments. HubSpot lists, Salesforce campaigns and Mailchimp tags (up to 10 each) become segments named "HubSpot: <list name>", "Salesforce: <campaign name>" and "Mailchimp: <tag>". Membership is replaced every run with the matched members.
- First run. HubSpot and Salesforce read the last 7 days, then continue from where the last run stopped. A run that runs out of time continues next hour.
Write-back (HubSpot and Salesforce)
Off by default. When on, Herald writes four fields to the matched record for people with new decisions (first run: the last 24 hours): the latest agent, message (variant name), sent time and conversion time. Only values present are written. People without a matching record are skipped.
HubSpot property (group herald) | Salesforce field | |
|---|---|---|
| Last agent | herald_last_agent (text) | Herald_Last_Agent__c (Text 255) |
| Last message | herald_last_message (text) | Herald_Last_Message__c (Text 255) |
| Last sent at | herald_last_sent_at (datetime) | Herald_Last_Sent_At__c (Date/Time) |
| Converted at | herald_converted_at (datetime) | Herald_Converted_At__c (Date/Time) |
HubSpot
- In HubSpot, open Settings → Integrations → Private apps and create an app with the scopes
crm.objects.contacts.readandcrm.lists.read. For write-back also addcrm.objects.contacts.writeandcrm.schemas.contacts.write. - Paste its access token in the console.
- If your contacts have a property holding your app's user id, enter its internal name. Otherwise people are matched by email.
- Pick the properties and the list ids.
With write-back on, Test checks the token and creates the herald property group and the four properties when they are missing (safe to run again).
Common errors
| Message | Cause | Fix |
|---|---|---|
HubSpot: <message> or HubSpot answered HTTP <status> | Shown as the last error: HubSpot refused a call, often a missing scope or an expired token | Check the token and its scopes |
HubSpot rate limit reached; continuing next hour | HubSpot's rate limit | None: the next hourly run continues |
Out of time reading the list; it syncs next hour | A large list didn't finish in one run | None: the next run continues |
HubSpot request failed | HubSpot couldn't be reached | None: the next run retries |
Salesforce
- In Salesforce Setup, create a connected app (or external client app) with OAuth, enable the client credentials flow and pick a run-as user with read access to Contacts or Leads (and edit access for write-back).
- Paste your My Domain URL, consumer key and consumer secret as
{ "instanceUrl": "https://<domain>.my.salesforce.com", "clientId": "…", "clientSecret": "…" }. The URL must be https on*.salesforce.com. - Choose the object:
Contact(default) orLead. Pick the fields and the campaign ids. - For write-back, create the four custom fields above on the object. With write-back on, Test describes the object and lists any that are missing.
Common errors
| Message | Cause | Fix |
|---|---|---|
Salesforce: <message> or Salesforce answered HTTP <status> | Shown as the last error: Salesforce refused a call, often the integration user's permissions | Check the user's object and field access |
Salesforce: campaign <id> not found or Invalid campaign id <id> | A campaign in lists doesn't exist or isn't an id | Fix the campaign id |
object must be Contact or Lead | Saving the integration: wrong object | Choose Contact or Lead |
Salesforce request failed | Salesforce couldn't be reached | None: the next run retries |
Mailchimp
- In Mailchimp, open Profile, Extras, API keys and create a key (it ends in a data center such as
-us21). - Paste it in the console with the audience id (Audience, Settings, Audience name and defaults).
- Pick the tags (up to 10) and the merge tags (up to 20, such as
FNAME).
Unsubscribes. With the option Sync unsubscribes (on by default), a member who is unsubscribed or cleaned in Mailchimp gets an email suppression in Herald, so Herald stops emailing that address too. Herald never lifts a suppression, so a re-subscribe in Mailchimp does not unsuppress. Mailchimp never adds a person. Test reads the audience.
Common errors
| Message | Cause | Fix |
|---|---|---|
Mailchimp: <detail> or Mailchimp answered HTTP <status> | Shown as the last error: Mailchimp refused a call | Check the API key and audience id |
listId must be the audience id | Saving the integration: not an audience id | Copy the id from the audience's settings |
mergeFields must be merge tags such as FNAME | Saving the integration: a merge field isn't a tag | Use the merge tags, not the labels |
The API key is not set or unreadable | The secret is missing | Paste the API key again |
Troubleshooting
- Records are unmatched. Check the id property, or that the person's email in Herald equals the CRM or Mailchimp email.
- Write-back skips a person. No matching record in the CRM.
- Salesforce Test lists missing fields. Create the four custom fields on the chosen object.