Using Twilio’s Messaging Service Features

June 19, 2019
Written by

Programmable SMS - Using Twilio’s Messaging Service & Co-pilot Features

In 2010, Twilio customers started sending their first SMS message. Today, these same customers are sending many thousands of messages per day. But jumping from sending one message to 100,000 is not easy. It requires understanding how many phone numbers you need to use to deliver these messages, what types of numbers to use for best results and programming logic that will handle number allocation and other use-case specific features to ensure performance.

That’s a lot of code…. Or is it?

What is a Messaging Service? 

Twilio’s Messaging Service handles everything mentioned above, without you needing to write any programming logic. Messaging Service Features are the features you take advantage of in your messaging service. So to break it down -

A Messaging Service is a messaging application, usually specific to a use-case or campaign that is powered by a group of phone numbers that you select based on the needs of that use-case. You enable your messaging service and select phone numbers all within the Twilio Console.

Messaging Service Features are the set of features that you can enable in your messaging service that allows you to take advantage of complex logic that you would otherwise need to build, such as load balancing or geo-matching. Messaging Service Features are powerful and has been designed to automatically use the best phone number in your messaging service to send a message.

Number Pooling

You start your messaging service by assigning phone numbers to it. To calculate how many phone numbers you might need in your service, you should ask yourself these 3 questions -

  1. What type of phone number should I use?
  2. How many messages will I be sending per day?
  3. How quickly do I want my messages sent?

There are country-specific nuances to sending messages and deciding what numbers to use. Check out Part 3 of this series where I go into detail about this. Similarly, some countries block application to person (A2P) traffic if you send messages in high-volume from the wrong type of number. This is covered in Part 4: SMS Compliance, Security and Best Practices. For US only use-cases, here is the current recommended guidelines:

What number type should I use?

In the US, you have the option of using long codes or short codes to send messages. Long codes are used for person-to-person (P2P) messaging and are cheap. Short codes are used for A2P and come with a price tag.

How many messages will I be sending per day?

If you decide to use long codes for your A2P messaging, you need to be aware of carrier filtering. We don't have specific guidance on the number of messages that you should send a day with long codes, but have composed a couple guides on carrier filtering:

Keep in mind, if you are taking advantage of Messaging Service features such as geo-match (see below), the number of messages you plan to send a day will likely need to change.

How quickly do I want my messages sent?

As you learned from Part 1 - API Basics, long code phone numbers have a message per second (MPS) limit of 1. So simply adding phone numbers to your messaging service allows you to send messages at a faster rate. If you are running a campaign and need to send all of your messages in a short time-period, you could add more numbers to your messaging service (and turn off Messaging Service specific features that may stop these numbers from load balanced evenly). Short codes have a greater MPS, at 100. Depending on your use-case and deliverability requirements, you may need to use a short code.

Configuring your Messaging Service

Configuring your messaging service is easy. Navigate to your Messaging Services page, create a new service and then you should be in Configure. Here are the key “gotchas” you’ll need to know when configuring your message service -

  • If your use-case is 2-way messaging, you should tick the box that says "Process Inbound Messages" and then configure a Request URL, which will contain the code you use to handle that message reply.
  • To check the delivery status of messages sent using your Messaging Service, configure a Status Callback URL, which we will send a delivery notice to. In the case your message cannot get delivered, we will send an error notice with information pertaining to why the message cannot be delivered. 
configure copilot twilio
  • If you previously set a Callback URL for an individual phone number and now that number is in your Messaging Service, there should not be a conflict. The area you go to assign the callback URL at the phone number level, within your Phone Numbers page, should now be changed and assigned to your Messaging Service, not the old Webhook you were using. If it’s not, configure it with your Messaging Service, as per below. 
configure message service twilio
  • The “Use Case” you use for your messaging service really doesn’t matter too much, but you should select the use-case closest to your needs.
  • When you’re making your API Request, you will need to replace the from parameter, which contains a phone number, with a messagingServiceSid parameter, which is, as the name suggests, your messaging service SID.
copilot query twilio

What Messaging Service features to use?

Here is the full list of Messaging Service features. This gives you an overview of all the different features that you can use. But what is best for your business? That depends on your use-case:

  • Sticky Sender maintains a mapping of the to and from phone numbers so you send messages to the same customer from the same phone number every time.
  • Alpha Sender ID will select your alpha ID as the from number every time if enabled (this is country specific and should only be used for one-way use cases). Add your alpha here.
  • Scaler load balances your number pool and distributes messages evenly across your phone numbers.
  • Geomatch allows you match country or area code with your customer’s phone number.
  • Fallback to toll free / Short code reroute will make sure your messages are re-sent when messages from your short code fails to deliver (not all carriers have the infrastructure setup to deliver messages from short codes).
  • Smart encoding detects Unicode characters and replaces them with GSM encoded characters, saving you money! Check out more about encoding in Part 1.
  • MMS converter will make sure your messages get sent, even when carriers do not support MMS, by automatically delivering your MMS as an SMS with a short URL link of the image.

A common question that is asked of Messaging Service Features is “What feature overrides the others”? This image maps the answer to this question -

copilot-number-selection.png

In short, Sticky Sender will always override Scaler. It will override all other features too, except in cases where a short code or new phone number that matches the recipients number is added to the service, in which case Geomatch will override the existing Sticky Sender mapping.

If you add a short code to your number pool and Sticky Sender is taking precedence, continuing to send messages from a long code, we suggest you programatically remove the long codes from your service and then re-add them, creating a new binding for your short code.

That’s it for Part 2! Be sure to read the next post on Local Numbers and International SMS!

SMS Best Practice Guide