Sending a high volume of messages in the United States and globally quickly becomes complex. As the complexity of your messaging application grows, it's helpful to organize your account and message logs into separate Messaging Services using Twilio Programmable Messaging.
You can think of a Messaging Service a higher-level “bundling” of messaging functionality around a common set of senders, features, and configuration. The same settings and feature configuration applies to all of the senders (long code numbers, short codes, toll-free numbers, etc.) in the Messaging Service's pool.
With each Messaging Service that you add through the console, you'll start by configuring both the
Inbound Request and
Status Callback URLs. You'll also need to associate one or more phone numbers or short codes to the Service to send messages. You can add additional messaging features (described below) to your application through your newly configured messaging service.
If you use a messaging service to send message, your request to Twilio will look very similar to sending an SMS with the REST API. However, instead of including a
From phone number, you'll include a
MessagingServiceSid. Twilio will then choose one of the phone numbers in your Messaging Service's sender pool based on your service's configuration.
When sending a message with a messaging service, Twilio will immediately set the message's status to '
accepted'. Then Twilio will determine the optimal
From phone number from your service. Any delivery errors will be sent asynchronously to your StatusCallbackURL.
Messaging Services are designed to help you scale your application's messaging from your first SMS to messages sent globally, in multiple languages, from more than just long code phone numbers.
As soon as you create your Messaging Service, the following features apply automatically.
Alphanumeric Sender IDs are used for branded one-way messaging. The Alpha Sender feature of Messaging Services enabled by default and kicks in as soon as you add an Alphanumeric Sender ID to your Sender Pool.
With Alpha Sender, you can send your messages to customers from a customized sender. Instead of using an E.164 formatted Twilio phone number for the "From" value, you can use a custom string like your own business' branding. Alphanumeric Sender IDs may be used at no additional cost when sending an SMS to countries that support this feature.
Support for sending messages from an Alpha Sender depends on your destination (‘To’) phone number and is not available everywhere. Please see this article for the full list of countries that support this feature.
If you enable an Alpha Sender for your Twilio Messaging Service, Twilio will select the Alphanumeric Sender ID automatically when you send a message to a supported country.
To add an alphanumeric sender ID to a Messaging Service, go to your Messaging Services in the Twilio console. Select the service you wish to add an Alpha Sender to and under the Senders section, click the Add Senders IDs button. From the following drop-down, select Alpha Sender and enter the alphanumeric sender ID that you want to add to the sender pool.
To learn more about Alphanumeric Sender IDs, see the support article on getting started with Alphanumeric Sender ID.
When your Messaging Service sender pool includes a short code, Twilio always prioritizes message delivery using that short code. If a carrier is not supported by a Twilio short code, Twilio automatically delivers the message with a long code in your Messaging Service instead.
Twilio automatically applies short code rerouting for messages sent through your Messaging Service. This is not a feature that you enable or disable.
Please note that short code reroute does not attempt to redeliver your message over a long code due to a
Undelivered delivery status. For this functionality, read about the Fallback to Long Code feature.
When sending messages internationally, the Country Geomatch feature 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 for the same country of the recipient, Twilio first attempts to select an SMS-enabled US phone number before selecting another phone number to deliver your message. Your message will fail if there are no phone numbers available in your Service to deliver your message.
You can use Country Code Geomatch by adding phone numbers to your Messaging Service that match the countries of your recipients.
When a phone number of a new geographic country is added to your Messaging Service, Twilio automatically selects and remaps any existing Sticky Sender mappings so that the
From number matches the same country as your recipient's phone number.
The Scaler feature distributes your outbound messaging traffic evenly across the phone numbers in your Messaging Service so that you can handle a higher messaging volume. When your Messaging Service sends a message, it selects the
From number from your pool of numbers that are not currently being used to send other messages.
When Sticky Sender is enabled, the Messaging Service prioritizes any existing Sticky Sender mappings first. It then selects the next available phone number from your Service's sender pool which has the fewest number of mappings.
More then one toll free number should not be included within the same Messaging Service's sender pool. This can result in blocking that number.
In addition to the basic Messaging Service functionality, you have several features that you can use to manage your Service's senders, integration with your application, your messaging content, compliance, opt-out keywords, and more.
Enabling and changing these feature settings are all available in the Twilio Console.
The Sticky Sender feature ensures the same
From phone number is selected every time your application sends a message to a particular end user. This allows your application to consistently send messages to your user from a single, recognizable phone number.
With Sticky Sender enabled, Twilio maintains a mapping of all
From phone numbers that your Messaging Service has used and interacted with. Twilio creates a new mapping after it sends the first message from your Messaging Service to a particular end user. All future messages sent to that recipient from the Service will also use the same
If Sticky Sender is turned off, your Messaging Service ignores all previously established mappings. However, if you toggle Sticky Sender back on in the future, your Messaging Service will retain and reference the previously existing mappings.
Please note: when a Twilio phone number is removed from your Messaging Service, Twilio delets all Sticky Sender mappings associated wth the removed Twilio number.
Under the Senders section of your Messaging Service, expand the Sender Selection Settings box. From there, you can enable and disable Sticky the Sticky Sender feature.
When Sticky Sender is enabled, the Messaging Service follows the logic below to determine the optimal phone number as the
When sending messages to the United States and Canada, the Area Code Geomatch feature selects a local phone number with an area code that either matches or is an overlay of your end user's number.
If an overlay or matching area code is not available. The Messaging Service will select another US or Canadian phone number from your Messaging Service. Geographic proximity is not taken into consideration when selecting a phone number.
Pleaste note: This feature is not available outside the the US and Canada.
Under the Senders section of your Messaging Service, expand the Sender Selection Settings box. From there, you can enable and disable Area Code Geomatch feature.
The Fallback to Long Code feature re-attempts message delivery using a long code phone number when certain messages that were sent with a short code are not successfully delivered.
When sending a message, your Messaging Service prioritizes message delivery with a short code if one is available. However, the short code Message may have an
undelivered status if the end user is unable to receive short code messages. In this case, your Messaging Service re-attempts sending the message using a long code phone number from your Service's sender pool.
Please note that not all
undelivered messages are re-sent using a long code phone number. Successful message delivery via the long code is also not guaranteed.
You will be charged for both the short code message and the second message attempted over a long code phone number.
You should only enable Fallback to Long Code if your end users have opted into receiving SMS messages from you. All carrier compliance requirements and industry standards must be followed.
Under the Senders section of your Messaging Service, expand the Sender Selection Settings box. From there, you can enable and disable Fallback to Long Code feature.
Validity Period refers to the number of seconds that messages sent from your Messaging Service will remain in Twilio's platform. If sending the message exceeds the Validity Period, Twilio fails the message and sends a webhook (request) to your status callback URL to notify your application of the failure.
Please note that Twilio's Validity Period applies only to messages while they travel through the Twilio platform.
After Twilio sends the messages to the carrier network, the carriers may still queue the messages, resulting in a send time that exceeds the Validity Period.
Under the Integration section of your Messaging Service, you can enter the maximum queue time--in seconds--in the Validity period box.
You can set the Validity Period between 1 and 14,440 seconds (a maximum of four hours).
Your Messaging Service's Smart Encoding feature detects easy-to-miss Unicode characters and replaces them with a similar GSM encoded character. This helps ensure that your message gets segmented at 160 characters and saves you from sending two message segments (which increases your spend).
Sometimes a Unicode character such as a smart quote ( 〞), a long dash (—), or a Unicode whitespace accidentally slips into your carefully crafted 125-character message. Now, your message is segmented and priced at two messages instead of one.
When Unicode characters are used in an SMS message, they must be encoded as UCS-2. However, UCS-2 characters take 16 bits to encode, so when a message includes a Unicode character, it will be split or segmented between the 70th and 71st characters. This is shorer than the 160-character per message segment that you get with GSM-7 character encoding.
Please note that Smart Encoding does not transliterate messages that contain emoji (😱) or language-based characters such as Korean hangul (안녕하세요). Please reference this list for the Unicode characters Smart Encoding will replace.
Under the Content Settings section of your Messaging Service, you can enable or disable the Smart Encoding feature for SMS messages.
The MMS Converter feature automatically delivers your MMS message as an SMS text message. This SMS (text) message contains a shortened URL linking to your image when the carrier is not supported to receive Twilio MMS Messages. MMS Converter appends the shortened URL link (
http://m.twil.io/ followed by seven unique characters) to the end of the message body; this link remains active for 365 days (one year).
Please note: Twilio bills the converted messages as SMS Messages. The appended URL may cause the body of the text message to be greater than the number of characters-per-segment for the character encoding system (Read about GSM-7 and UCS-2). In thise case, Twilio segments message and bills accordingly.
Under the Content Settings section of your Messaging Service, you can enable or disable the MMS Converter feature for MMS messages that you send with your Messaging Service.
MMS Converter sends links to media files via SMS where the receiving carrier does not support MMS. It does not enable you to send media if your '
From' phone number lacks MMS capabilities.
The Sender ID pre-registration alert feature automatically alerts you when you send messages to countries that require pre-registered Sender IDs. Some countries that support Alphanumeric Sender IDs require pre-registration of the sender ID prior to use.
To help you remain compliant on your global messaging journey, enable Sender ID pre-registration alerting as you scale your messaging traffic. Once it is enabled, the compliance alerting feature publishes warnings when you send un-registered messaging traffic in countries where registration is recommended or required. You can find the alerts in the Debugger section of the Twilio Console.
Please note: While this feature does alert you of a potential compliance issue, it does not block or prevent your messages from being sent.
Under the Compliance section of your Messaging Service, you can enable or disable the Sender ID pre-registration alert feature for your messaging traffic.
The Advanced Opt-Out feature gives you the ability to deliver a customized, end-to-end compliance experience for your users. You have the ability to set the opt-in, opt-out and help keywords and confirmation messages on a global basis as well as add per-language and per-country overrides. For example, you can customize the message that your end users receive if they reply with "STOP" in English or with "AYUDA" in Spanish.
In addition, Advanced Opt-Out gives you deeper insight into your campaign performance and user engagement with your Messaging Service. When a user triggers one of your opt-in, opt-out, or help keywords, Twilio includesthe
OptOutType in its request to your configured webhook URL so that you can keep track of the health of your campaigns.
Under the Opt-Out Management section of your Messaging Service, you can enable Advanced Opt-Out as well as customize all of the keyword and confirmation messages for opt-out, opt-in, and help interactions with your end users.
We recommend reading the guide to customizing users' opt-in and opt-out experience with Advanced Opt-Out to ensure that you configure this feature properly for your messaging needs.