Skip to content
Menu

Integrations

Amplitude and Mixpanel

BetaMarkdown version

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

  1. In Settings → Integrations, connect Amplitude and copy the URL and secret.
  2. In Amplitude, add a Webhook cohort destination with the URL and the custom header Authorization: Bearer <secret>.
  3. 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.

AmplitudeIn Herald
event_typeThe event name
event_propertiesThe event's properties
user_propertiesAttributes on the user (strings, numbers, booleans and string arrays; nested objects are dropped)
$identifyUpdates the user only, no event
user_idThe External ID. An event without one (device only) is skipped and counted
Event idamplitude:<uuid> (else insert_id); an event with neither is skipped. A replay is a duplicate
Event timeevent_time, else the time it arrived

Common errors

MessageCauseFix
Unauthorized401: the secret or signature doesn't match, the integration is paused, or the URL names another providerCopy the URL and secret from the console again, and resume the integration
Expected a cohort update with an id, a name and users400: the body isn't a cohort updateUse the vendor's cohort webhook, unchanged

Mixpanel

  1. In Settings → Integrations, connect Mixpanel and copy the URL and secret.
  2. 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

MessageCauseFix
Unauthorized401: the Basic authentication password isn't the secret, or the integration is pausedSet the password to the secret
Expected a cohort update with an id, a name and users400: the body isn't a cohort updateUse the vendor's cohort webhook, unchanged
Unknown action400: an action other than members, add_members or remove_membersNone 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.

VendorCredentials
AmplitudeAPI key and data center (US or EU)
MixpanelProject 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.

EventWhenProperties
herald_message_sentEvery decisionagent, agent_id, variant, variant_id, channel, decision_id, holdout (always false)
herald_message_convertedThe decision convertedThe 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

MessageCauseFix
Set the Amplitude API key or Set the Mixpanel service account and project idShown as the last error: export credentials are missingAdd them on the integration
amplitude export HTTP <status> or mixpanel export HTTP <status>Shown as the last error: the vendor refused the batchCheck the credentials and data center; the next run retries
amplitude network error or mixpanel network errorShown as the last error: the vendor couldn't be reachedNone: the next run retries

Troubleshooting

  • A cohort does not appear. Check that the destination sends the Authorization header 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.

See Herald decide live →