# Sending through your tools

> Let Herald pick the message while Braze, SendGrid, OneSignal, Iterable, Customer.io, Klaviyo, Mailchimp Transactional or your own Twilio account delivers it, with the setup and template variables for each.

:::note Built and tested against each vendor's documented API; tell us if anything differs in your account. Braze and SendGrid are live.:::

A sender is a connection: Herald picks the variant, channel and time for each person, and your platform delivers it. Set one up in **Settings → Sending & SDK**. Braze and SendGrid are live. OneSignal, Iterable, Customer.io, Klaviyo, Mailchimp Transactional and your own Twilio account are Beta.

For Braze and SendGrid, see [Braze concept map](/docs/migration/braze-concept-map) and [Sync from your warehouse](/docs/migration/warehouse-sync).

## What you'll need

- An admin of the account. Senders are connections in **Settings → Sending & SDK**.
- The vendor's API key or token, as listed in each section.

Your app must use your own user id as the vendor's user id, so Herald can address the right person.

| Vendor | Your user id goes in |
|---|---|
| OneSignal | The **External ID**: call `OneSignal.login(userId)` |
| Iterable | `userId` |
| Customer.io | `id` |
| Klaviyo | `external_id` |

## OneSignal

1. Create a connection of type OneSignal with the app's **App ID** and its **REST API key** (OneSignal dashboard: Settings, Keys & IDs).
2. Push is always on. Tick "Email is set up in OneSignal" or "SMS is set up in OneSignal" only for channels the OneSignal app has configured. Agents can send only on the channels listed.

Herald sends one request per batch of up to 2,000 users, with the chosen variant's copy inline and an idempotency key, so a retried batch is not sent twice. Local-time agents use OneSignal's timezone delivery. Users OneSignal reports as not subscribed on that channel are marked suppressed. A 4xx or 5xx fails the batch.

### Common errors

| Message | Cause | Fix |
|---|---|---|
| `onesignal HTTP <status>` | OneSignal refused the request | Check the App ID and REST API key |
| `channel <channel> not supported by onesignal` | The agent sent on a channel the connection doesn't list | Tick the channel on the connection, or remove it from the agent |
| `unrenderable email` | An email variant has no subject or an unreplaced `{{token}}` | Fix the variant |

## Iterable, Customer.io and Klaviyo

These three keep the message template on the vendor's side. Herald picks the variant and sends its copy as template data, and the vendor's template renders it.

Template data on every send:

| Variable | Value |
|---|---|
| `channel`, `title`, `body` | The variant's channel and copy |
| `variant_id`, `decision_id` | Ids for the variant and the decision |
| `deeplink`, `image_url`, `cta` | Only when the variant has them |
| `subject`, `html` | Email only: `subject` is the title and `html` is the body |

An email variant without a subject, or with an unreplaced `{{token}}`, is not sent.

**Iterable.** Secret: a server-side API key. Config: `region` (`us` or `eu`) and the campaign id for each channel you send on (email, push, SMS, in-app). Create one API-triggered campaign per channel whose template uses `{{title}}`, `{{body}}` and so on, and paste its numeric id. Iterable merges the data into the template at the top level, and `{{profile.<field>}}` reads the user profile. Sends go one per user, up to 100 users per batch. Future and local-time sends use `sendAt`. Iterable has no idempotency key.

**Customer.io.** Secret: an App API key. Config: `region` (`us` or `eu`) and the transactional message id (the numeric id or the trigger name) for each channel. Create a transactional message per channel whose template uses `{{trigger.title}}`, `{{trigger.body}}` and so on, and paste its id. For email the recipient is `{{customer.email}}` and for SMS `{{customer.phone}}`, so the person's profile needs them. Sends go one per user, up to 100 users per batch, and Customer.io allows scheduling up to 90 days ahead. There is no idempotency key.

**Klaviyo.** Secret: a private API key with the `events:write` scope (plus `accounts:read` for the health check). Config: the channels your flows send (email, SMS, push). Create a flow triggered by the metric `Herald Message` that sends `{{ event.title }}` and `{{ event.body }}`, and filter on `{{ event.channel }}` when one flow handles several channels. Herald sends one event per user in bulk jobs of up to 1,000 users, with the decision id as the unique id, so a retried batch is deduplicated. A flow triggers when the event arrives, so a future or local-time send goes out when Herald sends the event. The planned time is in `event.send_at` for a flow that waits for it. Klaviyo accepts the whole job with no per-event result, so every decision in an accepted job counts as sent. Bulk jobs are limited to 10 per second.

**Results.** A 2xx is a send. Iterable and Customer.io answer per user: when every call in a batch fails, the batch is a failed send, and when only some fail, those users are marked suppressed. Any Klaviyo non-2xx fails the batch. Opens and clicks do not flow back yet. Conversions still come from your app's events.

### Common errors

| Message | Cause | Fix |
|---|---|---|
| `no iterable campaign id for <channel>` or `no customerio transactional message id for <channel>` | The connection has no campaign or message for that channel | Add it to the connection's config |
| `iterable recipient <code>` | Iterable refused that user | Check the user exists in Iterable with your user id |
| `iterable HTTP <status>`, `customerio HTTP <status>` or `klaviyo HTTP <status>` | The vendor refused the request | Check the API key, its scopes and the region |
| `channel <channel> not supported by <vendor>` | The agent sent on a channel the connection doesn't list | Add the channel to the connection, or remove it from the agent |

## Mailchimp Transactional

Email only, through your own Mailchimp Transactional (Mandrill) account. Create a connection of type Mailchimp Transactional with a Transactional API key as the secret and the config `fromEmail`, `fromName` and, optionally, `templateName`. Herald finds each person's email like SendGrid does (the latest email contact, else a valid `email` attribute) and skips suppressed addresses.

Herald sends one request per batch of up to 1,000 users, one recipient each, with open and click tracking on and the agent id as the tag. Each recipient carries `herald_decision_id` in its metadata.

- **Plain.** Without `templateName`, the variant's title is the subject and its body is the HTML.
- **Template.** With `templateName`, the template gets the copy as global merge variables: `*|title|*`, `*|body|*`, `*|subject|*`, `*|html|*`, `*|deeplink|*`, `*|image_url|*`, `*|cta|*` and `*|variant_id|*`.

An email variant without a subject, or with an unreplaced `{{token}}`, is not sent.

Mandrill answers per recipient. `sent`, `queued` and `scheduled` count as sent; `rejected` and `invalid` fail with the reject reason. When every recipient in a batch fails, the batch is a failed send; otherwise the failed users are marked suppressed. Herald sends immediately: a future or local-time schedule is not passed on. Opens and clicks do not flow back yet. Conversions still come from your app's events.

### Common errors

| Message | Cause | Fix |
|---|---|---|
| `mandrill rejected: <reason>` or `mandrill invalid: <reason>` | Mandrill refused that recipient | Check the reason in Mandrill, such as a hard bounce |
| `mandrill gave no result` | Mandrill answered without a result for the recipient | None: retry later |
| `unrenderable email` | An email variant has no subject or an unreplaced `{{token}}` | Fix the variant |

## Your own Twilio account

Turn on the SMS card and texts send from Herald's shared numbers, with nothing to set up. The first text to each person ends with "Reply STOP to unsubscribe", and STOP replies are handled automatically.

To send from your own Twilio account instead, set `twilioAccountSid` (`AC` followed by 32 hex characters) and `twilioAuthToken` in the SMS card's "Use your own Twilio account" section. Set both or neither. Both are write-only secrets.

1. Create a Twilio Messaging Service in your account and enter its SID (`MG…`) in the same section.
2. On the Messaging Service, set the status callback and the inbound webhook to the URL the SMS card shows.
3. Sender registration (10DLC) with Twilio is manual and outside Herald.

An inbound STOP creates a suppression.

### Common errors

| Message | Cause | Fix |
|---|---|---|
| `twilio HTTP <status>` | Twilio refused the message | Check the Account SID, auth token and Messaging Service |
| `twilio payload is malformed` | Your own Twilio account is set but the SMS card has no Messaging Service SID | Enter the SID in "Use your own Twilio account" |

## Troubleshooting

- **A user is marked suppressed.** The vendor reported them as not subscribed on that channel, or the call failed for that user.
- **An email is not sent.** It has no subject, or an unreplaced `{{token}}` in its copy.
- **Nothing reaches a person.** Check that your app passes your own user id to the vendor, as in the table above.
