Platform
Docs
Solutions
ContactLog In

Start Routing Notifications Today!

Courier is a notification service that centralizes all of your templates and messaging channels in one place which increases visibility and reduces engineering time.

Sign-up

automations-announcement-header
COURIERPRODUCT NEWS

Announcing Courier Automations: Application Logic for Notifications

Nick Gottlieb

May 25, 2022

We’re excited to announce a powerful new feature for the Courier platform: Courier Automations. Courier Automations is a toolset that includes both an API and a visual builder that allows anyone to easily configure logic for notification workflows. Need to send a reminder to class attendees 10 minutes before the class starts? Need to page an on-call engineer on multiple channels until they respond? These use cases and more can be achieved quickly and easily with Automations.

Why we built Automations

As developers, notifications are the primary way that the applications we build communicate with our end-users and the use cases vary widely. Some use cases are very straightforward and simply require that a single message goes to a single user once. Many notifications however require more sophisticated orchestration in order to deliver the desired user experience. Most developers today end up building a separate service to manage this logic. This results in additional infrastructure and development overhead and often in a less than ideal end-user experience.

We built Automations so that developers can deliver the ideal notification experience without needing to build and maintain yet another service.

What are product and engineering teams doing with Courier Automations today?

While today marks the official release of Automations, many of our customers are already using Automation to power key parts of their product experience.

The engineering team at LaunchDarkly, a feature management platform, uses Automations to define the logic for notifications associated with approvals for their customers' feature releases. Any time approval is requested or granted, an Automation is triggered to ensure all the relevant stakeholders are alerted. You can read more about their use case here.

Officevibe, which is an employee experience platform, regularly sends out Slack notifications on behalf of their customers asking employees to complete a brief survey. Their engineering team utilizes the Automations API to create lists of users for whom the Slack survey could not be delivered and send them an email survey instead.

For Yoga International, an online Yoga platform, it's essential that they deliver a seamless experience to their customers from the time they register for a live class through to the start of class. Their engineering team utilizes the Automations API to send timely reminders to class attendees for each live class that happens on their platform.

“Meetings Reminder”

Let's build a meetings reminder that sends an email reminder 10 minutes before the meeting and a link to the meeting notes two hours after the meeting.

Design the Messages:

  1. Log into Courier and navigate to the Notifications Designer
  2. Design an email reminder that will be sent 10 minutes before the meeting with the Gmail provider (or any email provider of your choice) announcing-courier-automations-1
  3. Access the template ID in the settings of that notification and save it for future reference
  4. Design an SMS reminder that will be sent two hours after the meeting with the Twilio provider (or any email provider of your choice) announcing-courier-automations-2
  5. Access the template ID in the settings of that notification and save it for future reference

How To Create an Automation Using the API (Node.js Example)

  1. Within your Node.js app, install node-fetch npm install node-fetch
  2. Navigate to the Automations API Reference and copy the starter code
  3. Add an automations object with an array of objects called steps
1
"automation": {
2
"steps": [
3
{
4
"action": "send",
5
"template": "template_id",
6
}
7
]
8
},

Automations API Reference

Automations Docs

  1. For this example, we will need three steps: send, delay, and another send. The first send step will send the 10 minute reminder. The delay step will wait for two hours after the meeting. The third step will send an SMS with a link to the meeting notes.
1
"automation": {
2
"steps": [
3
{
4
"action": "send",
5
"template": "template_id_1"
6
},
7
{
8
"action": "delay",
9
"duration": "130 minutes"
10
},
11
{
12
"action": "send",
13
"template": "template_id_2"
14
}
15
]
16
},
  1. Update template_id_1 with the notification template from Step 3 of “Design the Message” and update template_id_2 with the notification template from Step 5 of “Design the Message”
  2. Update the brand and recipient attributes with your preferred brand and recipient IDs
  3. If your steps reference any Notification Templates, update the ID template attribute
  4. Run your code to trigger the Automation
1
// Dependencies to install:
2
// $ npm install node-fetch --save
3
4
const fetch = require('node-fetch');
5
6
const options = {
7
method: 'POST',
8
headers: {
9
Accept: 'application/json',
10
'Content-Type': 'application/json',
11
Authorization: 'Bearer replace-token'
12
},
13
body: JSON.stringify({
14
"automation": {
15
"steps": [
16
{
17
"action": "send",
18
"template": "template_id_1"
19
},
20
{
21
"action": "delay",
22
"duration": "130 minutes"
23
},
24
{
25
"action": "send",
26
"template": "template_id_2"
27
}
28
]
29
},
30
"brand": "W50NC77P524K14M5300PGPEK4JMJ",
31
"template": "EXAMPLE_NOTIFICATION",
32
"recipient": "8ec8c99a-c5f7-455b-9f60-8222b8a27056",
33
"data": {
34
"name": "Jane Doe",
35
"age": 27
36
},
37
"profile": {
38
"phone_number": "2025550125",
39
"email": "hello@example.com"
40
}
41
})
42
};
43
44
fetch('https://api.courier.com/automations/invoke', options)
45
.then(response => response.json())
46
.then(response => console.log(response))
47
.catch(err => console.error(err));
  1. Check the Datalog for delivery status and error messages

How To Create An Automation Using the Studio

This example demonstrates integrating an API V2 notification send call (Step 5 of "Design the Message").

  1. Navigate to the Automations page
  2. Create an Automation Template from scratch announcing-courier-automations-3
  3. Add a send step and select the “10 minute reminder” for the Notification announcing-courier-automations-4
  4. Add a delay step and update the length to 130 minutes
  5. Switch over to code mode (top right, under the the “Publish Changes” button) and add an API V2 notification send call for the SMS with a link to the meeting notes
1
{
2
"action": "send",
3
"message": {
4
"to": {
5
"email": "example@email.com"
6
},
7
"content": {
8
"title": "Meeting Notes",
9
"body": "Link to meeting notes: ..."
10
}
11
}
12
}

announcing-courier-automations-5 This step can be done within the designer by following Step 3

  1. Select a trigger for the Automation (if no trigger is selected, the Automation can be triggered manually with a curl command)
  2. Publish changes to save your Automation
  3. Create a Test Event to test your Automation
1
{
2
"data": {},
3
"profile": {
4
"email": "example@email.com",
5
"name": "Your Name"
6
}
7
}

announcing-courier-automations-6

  1. Invoke your Automation in the Designer or copy the starter code and run it in a terminal

Getting Started

Sign up for a free Courier account to get started with Automations. Courier’s Free Tier includes Automations and up to 10,000 notifications per month.

Start Routing Notifications Today!

Courier is a notification service that centralizes all of your templates and messaging channels in one place which increases visibility and reduces engineering time.

Sign-up

More from Courier

data-thumbnail
COURIER

Tools and Techniques to Establish Your Data Team Early

How tools like Segment, Metabase, Snowflake, Census, and others, can help establish a data team from the very early stages in a startup.

Raymond See

Raymond See

February 16, 2023

QOTD Thumbnail
ENGINEERINGCOURIER

Develop a Motivational QOTD with Courier and GPT2

Courier and OpenGPT2 in action: build a service that sends friends and family an AI generated motivational quote of the day.

Prakhar Srivastav

Prakhar Srivastav

February 09, 2023

Build your first notification in minutes

Send up to 10,000 notifications every month, for free.

Get started for free

Email & push notification

Build your first notification in minutes

Send up to 10,000 notifications every month, for free.

Get started for free

Email & push notification

Platform

Users

Content

Channels

Sending

Workflows

Preferences

Inbox

Workspaces

Observability

API Status

Changelog

© 2024 Courier. All rights reserved.