|
| 1 | +--- |
| 2 | +rewrite: true |
| 3 | +title: Courier Destination |
| 4 | +--- |
| 5 | + |
| 6 | +[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. |
| 7 | + |
| 8 | +This destination is maintained by Courier. For any issues with the destination, [contact the Courier support team ](mailto:[email protected]). |
| 9 | + |
| 10 | +{% include content/beta-note.md %} |
| 11 | + |
| 12 | +## Getting Started |
| 13 | + |
| 14 | +{% include content/connection-modes.md %} |
| 15 | + |
| 16 | +1. From the Destinations catalog page in the Segment App, click **Add Destination**. |
| 17 | +2. Search for “Courier” in the Destinations Catalog, and select the “Courier” destination. |
| 18 | +3. Choose which Source should send data to the “Courier” destination. |
| 19 | +4. Go to the [Courier Settings Page](https://courier.com/settings), find and copy the “Auth Token”. |
| 20 | +5. Enter the “Auth Token” in the “Courier” destination settings field “API Key” in Segment. |
| 21 | + |
| 22 | +## Identify |
| 23 | + |
| 24 | +If you aren’t familiar with the Segment Spec, read through the [Identify method documentation](https://segment.com/docs/connections/spec/identify/) to learn about what it does. An example call would look like: |
| 25 | + |
| 26 | +```js |
| 27 | +analytics.identify('userId123', { |
| 28 | + email: carrier.pigeon@example.com' |
| 29 | +}); |
| 30 | +``` |
| 31 | +
|
| 32 | +Segment sends Identify calls to Courier as an `identify` event. |
| 33 | +
|
| 34 | +### User Profiles |
| 35 | +
|
| 36 | +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. |
| 37 | + |
| 38 | +The example below shows a few basic properties you might want to track if you send notifications to users in one or more channels: |
| 39 | + |
| 40 | +```js |
| 41 | +analytics.identify('userId123', { |
| 42 | + |
| 43 | + sms: '+1-123-555-7890', |
| 44 | + tokens: { |
| 45 | + slackToken: '****************', |
| 46 | + microsoftTeamsToken: '****************', |
| 47 | + whatsAppToken: '****************' |
| 48 | + }, |
| 49 | + ... |
| 50 | +}); |
| 51 | +``` |
| 52 | + |
| 53 | +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. |
| 54 | + |
| 55 | +## Track |
| 56 | + |
| 57 | +If you aren't familiar with the Segment Spec, read through the [Track method documentation](https://segment.com/docs/connections/spec/track/) to learn about what it does. An example call would look like: |
| 58 | +
|
| 59 | +```js |
| 60 | +analytics.track('Login Button Clicked') |
| 61 | +``` |
| 62 | +
|
| 63 | +Segment sends Track calls to Courier as a `track` event. |
| 64 | +
|
| 65 | +### Inbound Events and Properties |
| 66 | +
|
| 67 | +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://www.trycourier.app/data/messages?utm_source=segmentio&utm_medium=docs&utm_campaign=partners) after you configure the Courier destination. |
| 68 | + |
| 69 | +All Inbound Events coming from Segment Track calls appear with a `Segment-TrackEvent` prefix in Courier to help distinguish them from other inbound events. |
| 70 | + |
| 71 | +Courier extracts data from the Segment Track `properties` object, and conditionally triggers a request to the [Courier Send API](https://docs.courier.com/reference/send-api?utm_source=segmentio&utm_medium=docs&utm_campaign=partners) - only if that event is already [mapped](https://help.courier.com/en/articles/4202416-how-to-create-and-map-event-triggers-for-your-notifications). |
| 72 | + |
| 73 | +* 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. |
| 74 | +* 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.) |
| 75 | + |
| 76 | +```js |
| 77 | +analytics.track('Login Button Clicked', { |
| 78 | + orderNumber: 12345678980, |
| 79 | + estimatedDelivery: '2020-06-10T18:41:29.093Z', |
| 80 | + ... |
| 81 | +}) |
| 82 | +> note "Note:" |
| 83 | +> 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`. |
| 84 | +
|
| 85 | +### Mapping Inbound Events to Notification Templates |
| 86 | +
|
| 87 | +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://www.trycourier.app/data/messages?status=unmapped) or in the `Events` settings page. |
0 commit comments