# Courier Destination

## Destination Info

* Accepts [Identify](/docs/segment/connections/spec/identify), [Track](/docs/segment/connections/spec/track) calls.
* Refer to it as **Courier** in the [Integrations object.](/docs/segment/guides/filtering-data/#filtering-with-the-integrations-object)
* This integration is **partner owned.** Please reach out to the partner's support for any issues.

[Courier](https://courier.com?utm_source=segmentio\&utm_medium=docs\&utm_campaign=partners) provides a way to design and deliver notifications. Design once with a rich visual editor and deliver to any channel through one API request.

This destination is maintained by Courier. For any issues with the destination, [contact the Courier support team](mailto:support@courier.com).

## Getting Started

1. From the Destinations catalog page in the Segment App, click **Add Destination**.
2. Search for "Courier" in the Destinations Catalog, and select the "Courier" destination.
3. Choose which Source should send data to the "Courier" destination.
4. Go to the [Courier Settings Page](https://app.courier.com/settings), find and copy the "Auth Token".
5. Enter the "Auth Token" in the "Courier" destination settings field "API Key" in Segment.

## Group

If you aren't familiar with the Segment Spec, read the [Group method documentation](/docs/segment/connections/spec/group/) to learn about what it does. An example call would look like:

```js
analytics.group("0e8c78ea9d97a7b8185e8632", {
  name: "Initech",
  industry: "Technology",
  employees: 329,
  plan: "enterprise",
  "total billed": 830,
});
```

Segment sends Group calls to Courier as an `group` event.

## Identify

If you aren't familiar with the Segment Spec, read through the [Identify method documentation](/docs/segment/connections/spec/identify/) to learn about what it does. An example call would look like:

```js
analytics.identify('userId123', {
  email: carrier.pigeon@example.com'
});
```

Segment sends Identify calls to Courier as an `identify` event.

### User Profiles

Identify calls made from Segment automatically create profiles for users in Courier. `Traits` included in the Segment Identify call automatically merge into a user's Courier Profile over time.

The example below shows a few basic properties you might want to track if you send notifications to users in one or more channels:

```js
analytics.identify('userId123', {
  email: 'carrier.pigeon@example.com',
  sms: '+1-123-555-7890',
  tokens: {
    slackToken: '****************',
    microsoftTeamsToken: '****************',
    whatsAppToken: '****************'
  },
  ...
});
```

For more information on how Courier handles profiles, see the [Courier Profile documentation](https://docs.courier.com/reference/profiles-api?utm_source=segmentio\&utm_medium=docs\&utm_campaign=partners).

## Track

If you aren't familiar with the Segment Spec, read through the [Track method documentation](/docs/segment/connections/spec/track/) to learn about what it does. An example call would look like:

```js
analytics.track("Login Button Clicked");
```

Segment sends Track calls to Courier as a `track` event.

### Inbound Events and Properties

Segment Track events are inbound events that might trigger a notification when Courier receives them. To begin, events appear in [Courier's Data Logs](https://app.courier.com/data/messages?utm_source=segmentio\&utm_medium=docs\&utm_campaign=partners) after you configure the Courier destination.

All Inbound Events coming from Segment Track calls appear with a `Segment-TrackEvent` prefix in Courier to help distinguish them from other inbound events.

Courier extracts data from the Segment Track `properties` object, and conditionally triggers a request to the [Courier Send API](https://www.courier.com/docs/reference/send/message/) - only if that event is already [mapped](https://www.courier.com/docs/platform/sending/create-map-events/).

* Segment passes all `properties` from the Track call to the `Send API` as elements in the `data` json objects. You can use these data points as variables in the Notification Template or as input on conditional routing logic.
* Courier uses the `userId` or `anonymousId` to look up and include the associated `User Profile` with the inbound event. (See the note in the [Identify section](#identify) above.)

```js
analytics.track('Login Button Clicked', {
  orderNumber: 12345678980,
  estimatedDelivery: '2020-06-10T18:41:29.093Z',
  ...
})
```

Courier does not send notifications until you publish a Notification Template and map incoming Segment Track events to that published Notification Template. If you send data to Courier before you complete those steps, incoming events are marked with a status of `Unmapped`.

### Mapping Inbound Events to Notification Templates

Once you are comfortable with the Notification Template(s) and are ready to send Notifications, you can map these inbound events to start sending. You can do this directly from the [Event Log in Courier](https://app.courier.com/data/messages?utm_source=segmentio\&utm_medium=docs\&utm_campaign=partners) or in the `Events` settings page.

## Engage

You can send computed traits and audiences generated using [Engage](/docs/segment/engage) to this destination as a **user property**. To learn more about Engage, schedule a [demo](https://segment.com/contact/demo).

For user-property destinations, an [identify](/docs/segment/connections/spec/identify/) call is sent to the destination for each user being added and removed. The property name is the snake\_cased version of the audience name, with a true/false value to indicate membership. For example, when a user first completes an order in the last 30 days, Engage sends an Identify call with the property `order_completed_last_30days: true`. When the user no longer satisfies this condition (for example, it's been more than 30 days since their last order), Engage sets that value to `false`.

When you first create an audience, Engage sends an Identify call for every user in that audience. Later audience syncs only send updates for users whose membership has changed since the last sync.

> \[!NOTE]
>
> Real-time audience syncs to Courier  may take six or more hours for the initial sync to complete. Upon completion, a sync frequency of two to three hours is expected.

## Settings

Segment lets you change these destination settings from the Segment app without having to touch any code.

| Field   | Description                                                                                                                               | Required | Type   |
| ------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------ |
| API Key | Locate your Courier Auth Token by visiting your General Settings page for a quick copy and paste option: https://app.courier.com/settings | Yes      | string |
