If you have more than one route connected to your Telerivet account, you can easily create custom routing rules to determine which route to use to send each message. Whether you use Android phones, virtual numbers, SMS shortcodes, or a combination, it’s easy to choose which routes send which messages.
There are three main reasons to use Custom Routes:
-
Make your SMS sending more reliable
If one of your routes has an error sending a message, Telerivet can automatically transfer the message to another route. If you are using multiple Android phones with the Telerivet Gateway app and some of the Android phones are disconnected, Custom Routes can send messages using any active phones.
-
Decrease your SMS costs
If different routes have lower costs for particular mobile networks, you can easily use the least expensive route to send messages to each contact.
-
Send more messages than a single route can handle
Custom Routes can automatically distribute messages among multiple routes, reducing the amount of time a message is queued before being sent.
Custom Routes work everywhere in Telerivet, including Telerivet’s web app, automated services, and the developer API.
Creating Custom Routes
In your Telerivet project, go to the Routes page, and click on the "Custom Routes" tab. Then click "Add Custom Route" to set up your routing rules.
If you’ve created a service with Custom Actions, you already know how to create a Custom Route. Each message route is just a collection of one or more “rules” -- either an “if … then …” condition, or an action choosing which route(s) to send the message from.
Depending on what you want your Custom Route to accomplish, you can add rules in different ways. Below we’ll describe how to create two different types of Custom Routes: Load-balancing routes, and Least-cost routes.
1. Load-balancing routes - Distributing messages among multiple routes
To create a custom route that distribute messages among multiple routes, click “Add action…” and click "Choose route(s) to send message":
Then add all the routes you want to use. Click the "Add another route" link on the right hand side to add more route:
When you're done, click “Save Route”.
Now, when you use this custom route to send messages, Telerivet will automatically distribute messages among all the of basic routes you list.
When you send a message via this custom route, each basic route simply pulls messages off the "queue" as it is ready to send messages. Depending on how quickly each basic route is able to send messages, each basic route might end up sending a different number of messages.
If a basic route tries to send a message and it fails (e.g. if airtime runs out on one of your Android phones), Telerivet will also retry sending the message via another route in the list.
By creating a custom route with multiple basic routes, it’s easy to send SMS reliably, even if some of your routes are temporarily out-of-order.
2. Least-Cost Routing -- Using different routes to send SMS to different contacts
You can also use Custom Routes to send messages to different contacts using different routes.
To create a Custom Route with this behavior, start by creating a condition for each of your routes, then add a "Choose route(s) to send message" action underneath each one.
There are a few different ways to define the conditions to specify which messages get sent via which routes:
Option 1. Look at first digits of the phone number:
Option 2. Create a custom variable for each of your contacts:
Option 3. Add contacts to a group:
If you can determine which route to use from the first digits of the phone number, that’s usually the easiest option, since you don’t need manually import or organize your contacts.
It's possible to create a custom route that doesn't assign every recipient phone number to a basic route. If you try to send a message that is not routed to any basic route, you'll just get an error message.
Using Your Custom Route
Once you’ve created your custom route, it will show up anywhere in Telerivet where you select a route to send a message:
If you click the "Default route when sending messages" checkbox when creating or editing your route, then it will be selected by default.
You can use custom routes on the Messages page, in polls, in Custom Actions, and in the Developer API.
To use your routes in the Developer API, visit the API Keys page to get the Route ID. Any time you send a message from the API, simply use your Route ID for the route_id parameter.