User Guide

Defining Message Routes

Last Updated: Sep 09, 2015 12:51PM PDT

If you have more than one phone connected to your Telerivet account, you can easily create custom routing rules to determine which phone to use to send each message. Whether you use Android phones, virtual numbers, SMS shortcodes, or a combination, it’s easy to choose which phones send which messages.

There are three main reasons to use Message Routes:

  1. Make your SMS sending more reliable

    If some of your Android phones are disconnected, Message Routes can send messages using any active phones. And if one of your phones has an error sending a message, Telerivet can automatically transfer the message to another phone.
  2. Decrease your SMS costs

    If it’s cheaper to send an SMS message to another phone on the same mobile network, you can easily use phones on different mobile networks to send messages to different contacts.
  3. Send more messages than a single phone can handle

    Message Routes can automatically distribute messages among multiple phones, reducing the amount of time a message is queued before being sent.

Message Routes work everywhere in Telerivet, including Telerivet’s web app, automated services, and the developer API.

Creating Routes

In your Telerivet project, go to the Phones page, and click on the "Routes" tab. Then click the "Add new route" button to set up your routing rules.

If you’ve used Telerivet’s Rules Engine, you already know how to create a Message Route. Each message route is just a collection of one or more “rules” --  either an “if … then …” condition, or an action choosing which phone(s) to send the message from.

Depending on what you want your Message Route to accomplish, you can add rules in different ways. Below we’ll describe how to create two different types of Message Routes: Load-balancing routes, and Least-cost routes.

1. Load-balancing routes - Distributing messages among multiple phones

To create routes that distribute messages among multiple phones, click “Add action…” and click "Choose phone(s) to send message":

Then add all the phones you want to use. Click the "Add another phone" link on the right hand side to add more phones:

When you're done, click “Save route”.

Now, when you use this route to send messages, Telerivet will automatically distribute messages among all the of phones you list:

When you send a message via this route, each phone simply pulls messages off the "queue" as it is ready to send messages. Depending on how quickly each phone is able to send messages, each phone might end up sending a different number of messages.

If a phone tries to send a message and it fails (e.g. if airtime runs out on one of your phones), Telerivet will also retry sending the message via another phone in the list.

By creating a route with multiple phones, it’s easy to send SMS reliably, even if some of your phones are temporarily out-of-order.

2. Least-Cost Routing -- Using different phones to send SMS to different contacts

You can also use Message Routes to send messages to different contacts using different phones.

To create a Message Route with this behavior, start by creating a condition for each of your phones, then add a "Choose phone(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 phones:

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 phone 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 route that doesn't assign every recipient phone number to a sender phone. If you try to send a message that is not routed to any phone, you'll just get an error message.

Using your routes

Once you’ve created your routing rules, using them is easy. After you create a route, it will show up anywhere in Telerivet where you select a phone to send a message:

If you click the "Set as 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 the rules engine, 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 phone_id parameter.

Contact Us
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found