> ## 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.

# Sync events between RudderStack and Courier

> Route RudderStack events into Courier journeys, and stream message events back.

export const Doc = ({href, children, name, bare}) => {
  const label = children || name || href;
  if (bare) {
    return <a href={href}>{label}</a>;
  }
  return <a className="cx-endpoint" data-kind="doc" href={href}>
      <span className="cx-endpoint-label">{label}</span>
      <span className="cx-endpoint-method">DOC</span>
    </a>;
};

RudderStack events flow into Courier, and Courier events flow back out. Outbound sends need your RudderStack write key and data plane URL.

## RudderStack to Courier

RudderStack supports Courier as a destination. Configure it inside RudderStack, connect one or more sources, and events start flowing into Courier.

Inbound events appear on the RudderStack integration page in Courier Studio. Map them there to trigger notification workflows. An `identify` event can trigger an automation that welcomes a new user.

**Supported RudderStack events:**

* Group
* Identify
* Track

### Configuration

Go to RudderStack destination and search for Courier.

<Frame>
  <img src="https://mintcdn.com/courier-4f1f25dc/rYENcCCTyPPrDtw0/assets/search-courier-destination.webp?fit=max&auto=format&n=rYENcCCTyPPrDtw0&q=85&s=90d4218be9e5e8680833c6f68647356b" alt="Search Courier Destination" width="2870" height="1092" data-path="assets/search-courier-destination.webp" />
</Frame>

Connect one or more sources

<Frame>
  <img src="https://mintcdn.com/courier-4f1f25dc/LdpdyPjJHKHJqFY9/assets/connect-sources-to-courier-destination.webp?fit=max&auto=format&n=LdpdyPjJHKHJqFY9&q=85&s=67583f119b75a1d9540bfa17b5e1a81a" alt="Connect Sources to Courier Destination" width="2848" height="1558" data-path="assets/connect-sources-to-courier-destination.webp" />
</Frame>

Add Courier API Key

<Frame>
  <img src="https://mintcdn.com/courier-4f1f25dc/LdpdyPjJHKHJqFY9/assets/courier-api-key.webp?fit=max&auto=format&n=LdpdyPjJHKHJqFY9&q=85&s=886618759b0e6e79db69bf2d52ac6d85" alt="Add Courier API Key" width="2862" height="1572" data-path="assets/courier-api-key.webp" />
</Frame>

### Event trigger

Trigger events through the sources you connected, or by calling RudderStack endpoints directly.

The Courier destination supports `group`, `identify` and `track` events. They appear on the RudderStack integration page in Courier Studio.

See the [RudderStack Node SDK documentation](https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-node-sdk/#sending-events) for sending events to your RudderStack instance.

<Frame>
  <img src="https://mintcdn.com/courier-4f1f25dc/LdpdyPjJHKHJqFY9/assets/courier-inbound-rudderstack.webp?fit=max&auto=format&n=LdpdyPjJHKHJqFY9&q=85&s=e35ee5c0a1c9ecb69d42044beb1d5780" alt="Courier Inbound from RudderStack" width="2870" height="1316" data-path="assets/courier-inbound-rudderstack.webp" />
</Frame>

### Supported events

#### Identify

Identify events create or update a Courier user profile. The `userId` becomes the user identifier. The `traits` map to user profile attributes.

#### Track

Track events can trigger an automation or supply an inline automations payload. The `properties` in the payload map to Courier.

#### Group

Group events can create an account or trigger an automation. The `groupId` becomes the Account ID. The `userId`, or `anonymousId` if `userId` is absent, becomes the User Identifier.

### Event mapping

Map a received event to an existing automation, or create a new automation with the event as its trigger.

Click the plus (+) icon under link automations, then pick an existing automation template or create one.

Scope properties by the `courier.automation` object. To map userId to refs, send this to RudderStack:

```json Rudderstack Courier Automation Property Example theme={null}
{
  "event": "user-checkout",
  "type": "track",
  "properties": {
    "courier": {
      "automation": {
        "data": {
          "userId": "user_123"
        }
      }
    }
  }
}
```

Mapped automation would look like this:

<Frame>
  <img src="https://mintcdn.com/courier-4f1f25dc/rYENcCCTyPPrDtw0/assets/rudderstack-mapped-automation-v2.webp?fit=max&auto=format&n=rYENcCCTyPPrDtw0&q=85&s=4c6829df778df223b59b4cae6f023526" alt="RudderStack Mapped Automation V2" width="1928" height="1326" data-path="assets/rudderstack-mapped-automation-v2.webp" />
</Frame>

<Doc href="/docs/journeys/build">Learn more about Journeys ></Doc>

***

## Courier to RudderStack

Courier generates events during workflow execution (for instance, a "message sent" event when a message is delivered). These events can be sent outbound to RudderStack, which can further unlock other use cases and wire up other destinations inside RudderStack.

### Configuration

Add a source in RudderStack that will receive events from Courier (for example, a Node.js source). Once the source is created, copy the write key and data plane URL to the Courier RudderStack integration page.

<Frame caption="RudderStack Source Config">
  <img src="https://mintcdn.com/courier-4f1f25dc/rYENcCCTyPPrDtw0/assets/rudderstack-source-config.webp?fit=max&auto=format&n=rYENcCCTyPPrDtw0&q=85&s=46b9ae9eecfa17003715b3ab2aa4f7b9" alt="RudderStack Source Config" width="2864" height="1550" data-path="assets/rudderstack-source-config.webp" />
</Frame>

<Frame caption="Courier RudderStack Source Config">
  <img src="https://mintcdn.com/courier-4f1f25dc/LdpdyPjJHKHJqFY9/assets/courier-rudderstack-source-config.webp?fit=max&auto=format&n=LdpdyPjJHKHJqFY9&q=85&s=3de29db6af69d5977bba516917030be0" alt="Courier RudderStack Source Config" width="1103" height="419" data-path="assets/courier-rudderstack-source-config.webp" />
</Frame>

### Event sourcing

Courier will start sending generated events (like Message Sent) to your RudderStack instance. These should show up on your RudderStack source page.

<Frame caption="Courier to RudderStack Events">
  <img src="https://mintcdn.com/courier-4f1f25dc/LdpdyPjJHKHJqFY9/assets/courier-to-rudderstack-events.webp?fit=max&auto=format&n=LdpdyPjJHKHJqFY9&q=85&s=43c18c8c0964dda02840940df9c15c5c" alt="Courier to RudderStack Events" width="1920" height="955" data-path="assets/courier-to-rudderstack-events.webp" />
</Frame>

***

## Example use cases

* User sync from RudderStack to Courier
* Welcoming new users based on sign-up tracking
* Nudging users to upgrade to a paid tier based on usage tracking
