Loading...
Skip to main content

How To Send Notifications With Segment

Courier’s Destination for Segment provides an easy way to send data from Web or Mobile applications into Courier to improve notification delivery and management. Data and events flow from your application through Segment’s integration to Courier. In order to use Courier's Segment destination, you must already have Segment installed in your application.

Overview

How do Segment API calls send notifications?

  1. Segment identifies some user action and creates a track API call
  2. The track API call sends the event to Courier
    • Segment properties JSON data is passed into the Courier Send API as elements of the data JSON object
    • Segment's userId is used to locate the recipient in Courier with the same ID or create a new one when none are found
  3. Courier receives the event from Segment
  4. The event within Courier triggers all automations linked to it
  5. The linked automations run send any notifications that are linked to them

Before Starting

Prior to sending notifications with Segment you will need the following:

  • A Segment account
  • A published notification template routed to a configured provider within Courier
  • Segment integrated to Courier. You can follow installation here.

Linking Automations

Linking an automation to a Segment event allows you to create a flow of actions that will be triggered by that specific event. This means that whenever an event is sent through Segment, any and all all linked automations will be triggered.

Locate the event you want to link, click the + sign on the second column, and select the automation(s) of your choice.

The easiest way to successfully link an automation to a segment event is to click “create new automation”. This new automation will use the linked Segment event as a trigger, and have an auto-populated recipient ID in the send step. All you’ll need to do is select the notification template that should be sent.

Additionally, refs.data points to the data object from Segment. refs.data.userid references this data from Segment directly and auto populates the recipient ID in the automation send step (see Automation Send Step figure below). Below the recipient ID, add the "Profile" optional field with the following JSON to get the user's email from the Segment data object:

{
"$ref": "data.email"
}

Learn more about Courier Automations >

Courier - Map Segment Event to Automation
Courier - Automation Send Step