> ## Documentation Index
> Fetch the complete documentation index at: https://www.courier.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Install the Courier skill before writing code: `npx skills add trycourier/courier-skills`. It carries the verified SDK shapes and the rules you cannot get wrong.
> Authenticate every request with `Authorization: Bearer <API_KEY>`. A workspace has several environments and each has its own keys, which are plain `pk_` strings with no environment prefix. Start with Test.
> Send with `client.send.message` from the Node SDK (`@trycourier/courier` v7 and later, where the client is the default import). Reference a template by its `nt_` id or its alias.
> A send accepts a bare Elemental element list, but storing content on a template requires the top-level elements wrapped in a channel element.
> To translate a template, write one locale at a time with `PUT /notifications/{id}/locales/{localeId}`, which merges into the existing translations. `PUT /notifications/{id}/content` and `PUT /notifications/{id}/elements/{elementId}` overwrite translations along with the content, so send each element's `id` and `locales` back, and first remove every `checksum` and any `locales` key that starts with an underscore.
> Templates and journeys can be built in the Courier app or created through the API. Either way they live in the workspace and are referenced by ID when you send.
> The hosted MCP server is https://mcp.courier.com. For a briefing on what Courier is and when to use it, read https://www.courier.com/llms.txt.
> Prefer the Guides tab for how-do-I questions and the Docs tab for how-does-it-behave questions. The API reference lives under /api-reference.

# Outbound webhooks

> Get a signed POST at your endpoint every time a message changes status, a user changes a preference, or a template or audience changes.

An outbound webhook sends Courier's events to an endpoint you own, as a signed `POST`. Use it when your own system needs to react to a message's status, such as updating an order record when a receipt is delivered.

## Add a destination

**1. Open Webhooks**

Go to [Platform → Webhooks](https://app.courier.com/settings/webhooks) and find **Outbound Webhooks**.

**2. Add the endpoint**

Select **Add**, give the destination a name, and enter its URL. The endpoint has to accept a `POST`.

**3. Save the signing secret**

Courier creates a `whsec_...` secret for the destination. Store it where your handler can read it, so you can [verify each request](https://www.courier.com/docs/monitor/webhooks/security.md).

> [!WARNING]
>
> Destinations belong to one environment. A destination added in Test receives only Test events. Add one in each environment you need.

## Handle events

Every event arrives as `{ "type": "...", "data": {...} }`:

```json theme={null}
{
  "type": "message:updated",
  "data": {
    "id": "1-612fa552-15f7d6ba51bf229857c037a7",
    "status": "DELIVERED",
    "recipient": "user_123",
    "delivered": 1630512501708
  }
}
```

1. **Verify the signature** before you trust the body. See [Verify webhook signatures](https://www.courier.com/docs/monitor/webhooks/security.md).
2. **Branch on `type`.** Every destination receives every event type, so ignore the ones you don't need, and ignore types you don't recognize, since Courier may add new ones. [Webhook event types](https://www.courier.com/docs/monitor/webhooks/events.md) lists them all.
3. **Return a `2xx` within 10 seconds.** Acknowledge first and do the real work in a queue or background job, so a slow dependency doesn't turn into a failed delivery.
4. **Make your handler idempotent.** A retry can deliver the same event twice, and one message produces several `message:updated` events that share its `data.id`.

## Retries

Courier retries a delivery when the failure looks temporary:

| Outcome | Retried |
| :- | :- |
| Network error, or no response within 10 seconds | Yes |
| `408`, `429`, or any `5xx` | Yes |
| Any other `4xx` | No |

Retries start a few seconds apart, grow to 15-minute intervals, and continue for about a day. After that the event is dropped. A destination is never turned off automatically, so a broken endpoint keeps getting retries until each event ages out.

To recover events you missed during an outage, read the messages from the [Messages API](https://www.courier.com/docs/api-reference/messages/get-message.md) and preference changes from the [change history](https://www.courier.com/docs/recipients/preferences/api.md#track-preference-changes).

## Limits & behavior

* **Setup is in the dashboard.** There's no API for creating destinations.
* **No timestamp in the body.** The send time is on the `courier-signature` header.

## FAQ

> [accordion] Can I subscribe to only one event type?
>
> Every destination receives every event type. Filter on the `type` field in your handler.

> [accordion] What happens if my endpoint is down?
>
> Courier retries with an increasing backoff for about a day, then drops the event. Events that aged out during the outage are gone, so backfill from the Messages API if you need them.

> [accordion] Should I use webhooks or an observability integration?
>
> Use webhooks when your own code needs to act on each event. Use [observability integrations](https://www.courier.com/docs/monitor/observability.md) to see Courier's metrics and logs in Datadog, New Relic, or another OpenTelemetry tool.

> [accordion] What's the difference between outbound and inbound webhooks?
>
> Outbound webhooks send Courier's events to you. [Inbound webhooks](https://www.courier.com/docs/monitor/webhooks/inbound.md) let another system send events into Courier, usually to start a journey.
