
Check out the video below to watch us:
Be sure to Like the video and Subscribe to our YouTube channel.
During the stream we used the newly updated Courier Node.js SDK to work with our lists. During this we ran into a few issues and shortly after the stream ended, we released a patch to address them. The following code uses v1.6.1 of the SDK which can be installed using yarn or npm.
> npm install @trycourier/courier
A list can be created ahead of time or when a recipient subscribes to a list that doesn't exist. We created a couple lists using both methods. List IDs are composed of up to 4 parts separated by a dot. For our example, we are creating a list for Courier Live Alerts so we'll use courier.devrel.live. You can learn more about List ID Pattern guidelines in our help center.
const { Courier } = require("@trycourier/courier");const courier = new Courier({ apiKey: "<AUTH_TOKEN>" });const listId = "courier.devrel.live";const main = async () => {await courier.lists.put(listId, {name: "Weekly Product Updates"});const list = await courier.lists.get(listId);console.log(list);};main();
Because the list.put method doesn't return anything, I also added a call to the list.get method to show the list had been added.
To add a recipient to a list, you first need to make sure they have a Profile stored in Courier. Here is how you would add a new recipient to a list that will be created on the fly.
const { Courier } = require("@trycourier/courier");const courier = new Courier({ apiKey: "<AUTH_TOKEN>" });const listId = "courier.product.live";const main = async () => {const { status } = await courier.mergeProfile({recipientId: "CUSTOMER94107",profile: {email: "customer@company.com",given_name: "Customer",custom: {twitter: "https://twitter.com/company"}}});console.log(status);await courier.lists.subscribe(listId, "CUSTOMER94107");const { results } = await courier.lists.findByRecipientId("CUSTOMER94107");console.table(results);};main();
Here we created a new recipient profile using the Profiles API and then subscribed them to a new list. Because the lists.subscribe method doesn't return anything, I also added a call to the list.findByRecipientId method to show that the recipient was added to the newly created list.
Now that we have a couple lists, we can send a notification to them. We can target a specific list by sending using its List ID
const { Courier } = require("@trycourier/courier");const courier = new Courier({ apiKey: "<AUTH_TOKEN>" });const listId = "courier.devrel.live";const data = {title:"Courier Live: First Look at Notifying Multiple Recipients using Lists",hosts: [{name: "Aydrian",twitter: "https://twitter.com/itsaydrian"},{name: "Danny",twitter: "https://twitter.com/DannyDouglass"}]};const main = async () => {try {const { messageId } = await courier.lists.send({event: "COURIER_LIVE_ALERT",list: listId,data});console.log(messageId);} catch (e) {console.log(e.message);}};main();
We can target multiple lists by using a pattern. We could send to all subscribers under courier by using the pattern courier. or we could target all the live lists with the pattern courier.*.live. You can learn more about patterns in our help center. Let's send to every list under courier.
const { Courier } = require("@trycourier/courier");const courier = new Courier({ apiKey: "<AUTH_TOKEN>" });const pattern = "courier.**";const data = {title:"Courier Live: First Look at Notifying Multiple Recipients using Lists",hosts: [{name: "Aydrian",twitter: "https://twitter.com/itsaydrian"},{name: "Danny",twitter: "https://twitter.com/DannyDouglass"}]};const main = async () => {try {const { messageId } = await courier.lists.send({event: "COURIER_LIVE_ALERT",pattern,data});console.log(messageId);} catch (e) {console.log(e.message);}};main();
Courier will handle gathering and de-duping all the recipients that satisfy the pattern. Check out the Lists API Reference documentation to learn about all that can be done with lists.
Is there something you’d like to see us do using Courier? Let us know and it might be the subject of our next Courier Live. We stream a new Courier Live every Wednesday at noon Pacific. Follow us on Twitch to be notified when we go live.
-Aydrian

Clinical alert and notification systems: how escalation works
A clinical alert is easy to send and hard to close. This is how alerting works inside a hospital: where alerts come from, how routing by role and shift works, and how the acknowledge, timeout, escalate loop is actually built, including what happens when nobody answers.

How to send Slack notifications from your app
Slack is where your customers already work, which makes it a product surface rather than only an internal alerting channel. Posting an approval request or a status change into a customer's own Slack means working in workspaces you don't own, addressing people by email rather than Slack ID, and holding a separate credential for every customer.

How Product Teams Build, Test and Ship Multichannel Notifications in Design Studio
Product teams need to build, test, and ship notifications across multiple channels without filing an engineering ticket every time. Courier's Design Studio is the workspace for that: a template builder, visual channel routing, omnichannel testing, and publishing in one place. This post walks through the traditional template designer paradigm, how it splits effort across too many tools, and outlines a path for product and growth teams to ship transactional, product, and marketing notifications from a single workspace.