Create and Map Events to Trigger Notifications
Introduction to the basics of building and using events to trigger your Courier notifications.
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 several 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 App. 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.