Using a Twilio Messaging Service improves your customers' SMS message experience with routing intelligence and content features that you can control from the Twilio console. This guide will help you understand what using a Messaging Service can do for you as well as show you how to send SMS messages with a Service in your Ruby application. The code snippets in this guide are written using the Ruby language version 2.0.0 or higher, and make use of the Twilio Ruby SDK.
Let's get started!
So what can a Messaging Servive do for you? Let's dive into some of the features:
- Sticky Sender
- Alpha Sender ID
- Shortcode Reroute
- MMS Converter
- Intelligent Number Selection
Sticky Sender makes sure the same From phone number is selected when messaging a particular recipient. This allows your application to consistently send messages to your user from a single recognizable phone number.
When Sticky Sender is enabled, Twilio will maintain a mapping of the To and
From phone numbers. This mapping is created after the first message is sent
from your Messaging Service to a particular recipient. Any future messages
sent to that recipient from that Messaging Service will also use the same
If Sticky Sender is turned off, any established mapping will not be referenced. However, if you toggle Sticky Sender back on in the future, any mappings previously created will be referenced again.
When a Twilio phone number is removed from your Messaging Service, all Sticky Sender mappings associated to the removed Twilio number are deleted.
For branded one-way messaging, many countries allow an alphanumeric string as the sender ID.
Alpha Sender ID allows you to add your company name or brand to your Messaging Service. When
sending messages to a country where an alphanumeric sender ID is accepted Twilio will use your Alpha Sender ID as the
From parameter to
deliver your message. A phone number from your Messaging Service will be selected if your recipient is in a
country where alphanumeric sender IDs are not supported.
Alpha Sender IDs may be up to 11 characters. Accepted characters include both upper- and lower-case ASCII letters, the digits 0 through 9, and space: [A-Za-z0-9 ].
Please email email@example.com to enable alphanumeric sender IDs for your account before using Alpha Sender ID.
Scaler distributes your outbound messaging traffic evenly across the phone numbers in your Messaging Service to help you handle a higher messaging volume. When a message is sent from your Messaging Service, the From number is selected from among the phone numbers not currently being used to send a message.
When Sticky Sender is enabled, your Messaging Service will prioritize any existing Sticky Sender mappings first then select the next available phone number from your Messaging Service that has the least amount of mappings.
Geomatch automatically selects the Twilio phone number in your Messaging Service to match the country of your recipient’s phone number. If your Service does not include a Twilio phone number that is local to your user, Twilio will first attempt to select an SMS-enabled US phone number before falling back to another SMS-enabled phone number to deliver your message. Your message will fail if there are no phone numbers in your Service that can deliver your message.
To use Geomatch, simply add phone numbers to your Messaging Service that match the countries of your end users. Geomatch is disabled when a phone number local to your recipient cannot be found in your Messaging Service.
Geographic proximity and area codes are not taken into consideration when selecting a phone number.
When a phone number of a new geographic country is added to your Messaging
Service Twilio will automatically select and remap Sticky Sender so that the
From number can match the same country as your recipient's phone number.
When your Messaging Service includes a shortcode, Twilio will always prioritize message delivery with the shortcode. If a carrier is not supported by a Twilio short code, Twilio will automatically deliver the message with a long code in your Messaging Service.
Please note, shortcode reroute, does not attempt to redeliver your message
over a long code due to a
Undelivered delivery status.
MMS Converter will automatically deliver your MMS message as an SMS text message
with a shortened URL linking to your image when the
carrier is not supported to receive Twilio MMS Messages.
The shortened URL link (
http://m.twil.io/ followed by 7 unique characters) is
appended to the end of the message body and will remain active for 365 days.
Messages sent this way will be billed as SMS messages. If the appended URL causes the body of the text message to be greater than 160 characters, the message will be segmented and charged accordingly.
This functionality is toggled on by default for all messages sent without a Messaging Service.
MMS Converter sends links to media via SMS where the receiving carrier does not support MMS. This will not enable you to send media if your 'From' phone number lacks MMS capabilities.
Not yet using Twilio to send SMS messages? [Sign up now](/try-twilio)!
A Messaging Service contains configuration options for your application, like the URLs that will be requested when you receive an incoming message on one of your numbers. It also contains the configuration for your Messaging Service features.
You will also need to buy one or more phone numbers and add them to the messaging service. Once you have at least one phone number added to the service, you can use it to send messages.
Sending a message with a Messaging Service is a lot like sending a message from a Twilio number, with one key difference. Instead of specifying a
From telephone number in your API request, you specify a Messaging Service SID.
Once you create a Messaging Service in the console, you can use its SID as the
MessagingServiceSid parameter in your API request.
You must associate at least one phone number with your messaging service before it will be able to send messages.