Using Events to trigger your Courier Notifications
To trigger a Notification, you must include an event
in the Send command. An event
is a unique identifier that can be mapped to an individual Notification. This could be the "Notification ID” found in the Notification Setting or a custom string mapped to the event in Events Settings.
Option 1: Using the Notification ID as the event
trigger.
The Notification ID (or id
in the Courier API) is a unique identifier for each notification you create in the Courier Notification Designer. You can find this id in the notification settings modal by clicking on the gear on next to the notification name.
Option 2: Creating and using a custom Event ID string as the event
trigger.
While you can send the Notification ID (id
) as the triggering event you can also create an Event ID. This event
is a string describing an action or occurrence within your application. This can be defined by you, i.e. new-user
, or by an incoming integration like Segment.
What benefits does using an event
ID offer over the Notification ID as a trigger?
Creating an event
means that you can associate that event string with any notification. In other, words you can avoid code changes on your end when you want to send a different (or additional) notification with the same event
.
Because the Event ID is a string you create, you can give your events descriptive names that make it clear what action from your application the event represents like user-created
.
Creating and Mapping Events
There are three ways to create an event
and map it to a Notification ID (id
): Events settings, Event Log and the Events API
Events Settings
To create an Event ID and map it to a Notification using the Events Settings, open Settings > Events in the Courier web app and click ' Create New Event.
Next, give the new Event ID a name that indicates the user action trigger that it represents (ex: user-created).
To map the Event ID to a Notification, select the Notification you want to trigger with this event from the Notification drop down menu.
Mapping a Segment track event to a notification:
When creating an event map for a Segment track event, you will need the match the name of the Segment track event exactly when you create the event mapping using this format Segment-TrackEvent:your_event
Mapping Inbound Events to Notification Templates
You can map inbound events to a Notification in the Data Logs. That can be
accomplished directly on the Event Log in the Courier. To identify any unmapped events coming from Segment, or other sources, select the Unmapped Status filter in your Data logs.
Map an event from the Notification Settings
You can also map a notification template to an existing event in the notification settings.
Map an unmapped data log event to a template
Click the event to open it
Click on the "Not Delivered" event in the Timeline.
Click "Map to Notification"
Select the notification you want to map the event to.
Events API
The Events API allows you to manage your Events (get and create). When you create an event string to Courier via the API, the call will replace an existing event with the supplied values or create a new event.
If you want, you can use the Events API to map events with a Notification. Or create them without mapping so that your team can use the Application UI to map it.