Integrations
Amplitude and Mixpanel
Sync Amplitude and Mixpanel cohorts to Herald as segments your agents can target, stream Amplitude events in, and optionally send decisions back as events.
Note
Built and tested against each vendor's documented API; tell us if anything differs in your account.
A synced cohort becomes an externally managed segment named <Provider>: <cohort name>. Agents target it like any other segment. Only the integration writes its members.
- A renamed cohort renames the segment, and the agents that target it.
- Members are matched by user id against the app's people. An id Herald does not know yet is created and joins the app, as the server API does for an unknown user.
- Users removed from the cohort leave the segment. Segments built from other conditions are untouched.
- You cannot edit a cohort segment in the console. Delete it and the next sync recreates it.
What you'll need
- An admin of the account. Integrations are set up in Settings → Integrations.
- Amplitude: access to add a Webhook cohort destination.
- Mixpanel: access to add a Custom Webhook integration.
- To send decisions out: the export credentials listed under Send decisions out.
Amplitude
- In Settings → Integrations, connect Amplitude and copy the URL and secret.
- In Amplitude, add a Webhook cohort destination with the URL and the custom header
Authorization: Bearer <secret>. - Sync the cohort to it.
The payload has cohort_id, cohort_name, in_cohort (true when these users entered, false when they left) and users[].user_id. A user without user_id is skipped and counted. Amplitude expects a 200 within 1 to 2 seconds and retries otherwise. A retried batch applies the same change again.
Stream Amplitude events (optional)
To send raw events as well, add a Webhook event streaming destination in Amplitude with the same URL and header, and keep the default payload (Amplitude's event format). Cohort updates and events share the URL.
| Amplitude | In Herald |
|---|---|
event_type | The event name |
event_properties | The event's properties |
user_properties | Attributes on the user (strings, numbers, booleans and string arrays; nested objects are dropped) |
$identify | Updates the user only, no event |
user_id | The External ID. An event without one (device only) is skipped and counted |
| Event id | amplitude:<uuid> (else insert_id); an event with neither is skipped. A replay is a duplicate |
| Event time | event_time, else the time it arrived |
Common errors
| Message | Cause | Fix |
|---|---|---|
Unauthorized | 401: the secret or signature doesn't match, the integration is paused, or the URL names another provider | Copy the URL and secret from the console again, and resume the integration |
Expected a cohort update with an id, a name and users | 400: the body isn't a cohort update | Use the vendor's cohort webhook, unchanged |
Mixpanel
- In Settings → Integrations, connect Mixpanel and copy the URL and secret.
- In Mixpanel, add a Custom Webhook integration with the URL. Turn on Basic authentication and set the password to the secret. The username is ignored.
Mixpanel sends the actions members (the whole cohort: page 1 replaces the segment's members, later pages add), add_members and remove_members. The cohort comes from parameters.mixpanel_cohort_id and mixpanel_cohort_name, and users from parameters.members[].mixpanel_distinct_id. Mixpanel sends at most 1,000 members per call, every 30 minutes.
Answers use Mixpanel's shape: 200 { action, status: "success" }, or 400 { action, status: "failure", error } for a body that cannot be read. A bad password is the usual 401.
Common errors
| Message | Cause | Fix |
|---|---|---|
Unauthorized | 401: the Basic authentication password isn't the secret, or the integration is paused | Set the password to the secret |
Expected a cohort update with an id, a name and users | 400: the body isn't a cohort update | Use the vendor's cohort webhook, unchanged |
Unknown action | 400: an action other than members, add_members or remove_members | None needed; other actions are refused |
Send decisions out (optional)
Turn on Send decisions to Amplitude / Mixpanel when you connect (Segment has the same option: see Send decisions to Segment), and give the export credentials. They are sealed with the integration's secret and never shown again.
| Vendor | Credentials |
|---|---|
| Amplitude | API key and data center (US or EU) |
| Mixpanel | Project id, service account username and secret, and data residency (US or EU) |
The hourly sync sends each decision changed since the last send, 500 per request. The first run covers the last 24 hours.
| Event | When | Properties |
|---|---|---|
herald_message_sent | Every decision | agent, agent_id, variant, variant_id, channel, decision_id, holdout (always false) |
herald_message_converted | The decision converted | The same, plus conversion_event and conversion_value |
The cursor moves only after the vendor accepts the batch. A failure is shown as the integration's last error and the next run retries from the same place. A decision that changes again is sent again with the same insert id, which both vendors deduplicate.
Common errors
| Message | Cause | Fix |
|---|---|---|
Set the Amplitude API key or Set the Mixpanel service account and project id | Shown as the last error: export credentials are missing | Add them on the integration |
amplitude export HTTP <status> or mixpanel export HTTP <status> | Shown as the last error: the vendor refused the batch | Check the credentials and data center; the next run retries |
amplitude network error or mixpanel network error | Shown as the last error: the vendor couldn't be reached | None: the next run retries |
Troubleshooting
- A cohort does not appear. Check that the destination sends the
Authorizationheader or password, and look at the integration's last error. - A user is missing. A cohort member without a user id is skipped and counted.