Skip to main content

How To Configure Multi-Channel Routing

This how to guide walks you through configuring multi-channel routing for your product notifications with Courier.

Courier makes it easy to set custom routing rules and ensure your user's get exactly the product notification experience you intend.

Routing in the Send API

The routing object allows you to select various channels and decide which ones you want to send messages to.

When the method property is defined as single, Courier will attempt to the send messages to only one channel. In the example below, it will first attempt SMS and fail since phone_number is not included in the user profile. Next, it will attempt to send via email instead. If the email is sent successfully, it will not attempt to send a push or chat notification.

message: {
to: {
email: "example@email.com",
},
routing: {
method: "all",
channels: ["sms", "email", "push", "chat"],
},
},

When the method property is defined as all, Courier will attempt to send messages to all listed channels. In the example below, Courier will send the message via email and SMS. Since the push and chat profile requirements are not completed, it will not be able to send via those channels.

to: {
phone_number: "123456789",
email: "example@email.com",
},
routing: {
method: "all",
channels: ["sms", "email", "push", "chat"],
}

Ensure that for all channels listed, the profile requirements are met. You can find information about profile requirements for the provider under Channels >.

Learn more about setting up routing in the API reference documentation.

references routing

Routing in the Designer

The priority of the channels you select for your notification are arranged in a top-to-bottom hierarchy. To change priority, simply drag and drop your notification channels.

Courier will attempt to send the notification to the best channel possible, starting from the top and going to the bottom, based on the provided user contact information. You must provide Courier with user's contact information within their Courier recipient profile or via the Send API call itself.

Take, for example, a notification that is designed to send via SMS, Slack or email, in that order of priority:

Courier will first attempt to send the notification via SMS. If the recipient has a phone number in their profile, the notification will send via SMS only. If they don't have a phone number, Courier will look for a Slack account. Finally, if they don't have a phone number or slack account, Courier will look for an email address.

You can also choose to 'always send' to a specific channel. In order to do this, select the channel settings and turn on 'Always send to'.

Now Courier will always send this notification via email as well as to the best of the other channels.

The routing settings created in the designer can always be overridden using the preferences API. This will override the hierarchy of the channel rules and send the message only via the Integration specified in the recipient’s profile.

Was this helpful?