> ## 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`, the default import of the v7 Node SDK. 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.
> 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.

# Automation Webhook Trigger

> Start an automation from an inbound webhook you configure in Courier.

## Register an Inbound Webhook

1. Go to [Settings > Webhooks](https://app.courier.com/settings/webhooks), under **Developers**, and find the **Inbound Webhooks** section.
2. Click **Add**, then give the webhook a name and description.
3. Save. Courier generates a unique URL to send events to.

The name is permanent, and it's how you select the webhook when you set up the trigger below. See [Inbound Webhooks](/docs/monitor/webhooks/inbound) for the full reference on registration and payload handling.

### Configure the Webhook

Use the webhook URL that was generated in the previous step to configure the webhook in your system. Exercise a normal workflow to trigger various events to Courier, which will enable them as configuration options in the Automation trigger.

### Inbound Webhook Payload

Courier accepts any payload up to 6Mb in size.

If the payload is a JSON object, Courier will parse the payload and make the data available to you in the Automation. If the payload is not a JSON object, Courier will make the entire payload available to you in the Automation as a raw string.

If the JSON object is an array, Courier will parse each object in the array and trigger an automation for each incoming event.

For JSON objects, Courier will extract the following fields if they are present.

* `event` - The name of the event that triggered the webhook. You can filter by the name when you set up the webhook trigger in Automations. If no string field named event is present, Courier will use "Custom" as the default name.
* `userId` - A user identifier attached to the event. Courier will use this value to identify the user in the Automation, and automatically load associated profile data into the automation context.
* `properties.courier.automation` - A JSON object containing one of the following fields:
  * `template` - The id of an existing automation template to invoke, instead of using a configured webhook trigger.
  * `steps` - A JSON object containing the steps for an ad-hoc automation to execute.

## Using the Webhook trigger in an Automation

1. Go to Automations and create a new automation
2. Drag and drop "Webhook" from the list of triggers.
3. In the Source field, select your registered inbound webhook name.
4. After you select the webhook, you can select the event name from a list of any received events, or Custom if your payload did not contain named events.

The data payload in the webhook will be available to you in the Automation in the normal data object, accessed with `refs.data`.

If you don't see any options in the Event field, make sure you have sent at least one event to the webhook from the source system.
