Previously we showed you how to build a simple application that supported 2 way SMS across multiple countries by routing multiple phone numbers in different countries to a single destination.
Sometimes though you may want to route your SMS to different destinations. For example you may two different campaigns running on different phone numbers, with a different URL defined in your platform for each campaign.
This article will guide you through the process. We assume that you are already familiar with the Syniverse Developer Community and have already completed the SMS Quick Start and 2 way SMS examples.
For this example we will have set up two different phone numbers and will route SMS sent to these phone numbers to two different destinations. In this case we will be using http://putsreq.com for those destinations.
Steps to set this up
- Create your destinations
- Set up your delivery configurations
- Set up your event subscriptions
- Test the set up
Create your destinations
Go to http://putsreq.com and create two buckets, one for each destination. Make a note of the URL for each.
Each bucket will look like this
Screenshot showing Putsreq page
Set up your delivery configurations
Following these instructions, create two delivery configurations, one for destination URL you created.
Each delivery configuration should look like this.
Screenshot showing Example Delivery Configuration
Set up your Event Subscriptions
Following these instructions, create two event subscriptions, one for each delivery configuration, but with one extra step.
The extra step needed to route SMS based on phone number is to create a matching criteria rule in each subscription.
- Set Topic to SCG-Message
- Set event type to mo_message_received
- Set delivery configuration to one you created in the previous step, using the drop down
- Set the matching criteria to to_address contains ‘XXXXX’ where XXXXX is the number you wish to forward the destination.
The matching criteria field will prompt you with the available options for
- the field to match on
- operators available
- matching criteria format
The correct option can then be selected from the drop downs as shown below.
Screenshot showing how to select to_address
Screenshot showing how to select contains
Screenshot showing how to enter number using ‘text’ field
Then repeat the above for the second delivery configuration and use your other phone number in the matching criteria.
Bonus section: Using multiple matching criteria
It is also possible to use multiple matching criteria by using and & or. In the example below we have add an extra criteria to check whether the message contains a certain keyword.
Screenshot showing filtering on number and message content