Multiple Providers and Routing
In the previous chapter, you have learned about configuring providers. Engagespot allows you to configure multiple providers in a channel.
But, Why enable multiple providers in a channel?
Think of a scenario when your users are distributed globally and you want to send SMS alerts to them.
To send SMS to your users in the US
, you might need a global SMS provider like Twilio. And to send SMS to your Indian users, you might save a lot of cost by using a local provider such as Gupshup
or Textlocal
.

Routing
When you enable multiple providers in a channel, by default, only the first one will be used for sending messages and the second one will be inactive.

Enabling two providers in a channel without specifying conditions for which provider to use for each recipient can lead to duplicate deliveries for every user. Hence, we need the concept of Routes
.
So, What is Route and how a route is picked?
A route is essentially a rule that dictates which provider should be used to send a message to a recipient. Every route can have a Entry Condition
that does some checks on the recipient user's profile information to figure out if the route has to be choosen.
When a message has to be sent through a specific channel, Engagespot will scan all routes to find an exact match for the entry condition.
If none found, the default route for that channel is used.

Creating Routes
Once you have enabled and configured the required providers in a channel, navigate to the Routes section. By default, every channel will have a default route with the first provider that you have enabled in that channel. This will serve as the "catch all" route if no other specific route is matched.

Entry Condition
As previously mentioned, entry condition is used to match routes based on attributes of the recipient user's profile. You can write Javascript conditions in the following format
user.profileAttribute === 'value_to_be_checked`
For example, if you want to check if the User's profile has an attribute countryCode
and it's value to be 91
, you can write:
user.countryCode === 91;
Provider for the route
Once you have entered the entry condition, choose a provider for this route in the Priority#1 selection. All enabled providers in this channel will be shown in the list for you to choose.
You can have fallback providers (Priority#2 and below) for a route that will be used if the primary provider (Priority#1) fails. This feature is available only for enterprise customers. Please contact us.