Sending high volumes of messages in the US and globally can get very complex. You may find that it's helpful to organize your account and message logs into separate Messaging Services.
With each Messaging Service 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 capabilities (described below) to your application through your newly configured messaging service.
If you use a messaging service to send messages, your request to Twilio will look very similar to sending an SMS with the 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 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.
So what can using a Messaging Service do for you? Let's dive into the features.
Advanced Opt-Out 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 messages on a global basis as well as add per-country and per-language overrides.
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 will include the
OptOutType in its request to your configured webhook URL so that you can keep track of the health of your campaigns.
To get started, check out the tutorial on customizing users' opt-in and opt-out experience with Advanced Opt-Out.
Sticky Sender makes sure the same
From phone number is selected every time your application messages 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
From phone numbers. This mapping is created after the first message is sent from your Service to a particular recipient. Any future messages sent to that recipient from the Service will also use the same
If Sticky Sender is turned off, all previously 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.
Alphanumeric Sender IDs are used for branded one-way messaging. 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 alphanumeric sender ID 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 Alphanumeric Sender ID on a Twilio Messaging Service, Twilio will select the Alphanumeric Sender ID automatically when you send a message to a supported country.
To set up an Alphanumeric Sender ID on a Messaging Service, go to your Messaging Services in the Twilio console. Select the service you wish to add an Alpha Sender ID to, then go to Messaging Features section and add your new ID. Twilio will verify it for you and add it to your service:
To learn more about Alphanumeric Sender IDs, see the support article on getting started with Alphanumeric Sender ID.
Scaler distributes your outbound messaging traffic evenly across the phone numbers in your Messaging Service to help you handle 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, the 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 selects the Twilio phone number in your Messaging Service to match the country and area code of your recipient's phone number.
When sending messages globally, country 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 matches the same country as the recipient, Twilio will first attempt to select a 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.
To use Geomatch, simply add 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 will automatically select and remap any existing Sticky Sender mappings so that the From number can match the same country as your recipient's phone number.
When sending messages to the United States and Canada, Area Code Geomatch will select a local phone number with an area code that either matches or is an overlay of your recipient'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.
This feature is not available outside the the US and Canada.
Fallback to Long Code re-attempts message delivery using a long code phone number when select messages sent with a short code have not successfully been delivered.
When sending a message, your Messaging Service will prioritize message delivery with a short code. If the short code message is 'undelivered' because the recipient is unable to receive short code messages, the Messaging Service will re-attempt to send the message using another long code phone number within the same inventory pool.
Please note that not all 'undelivered' messages are resent 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.
This feature should only be enabled if your users have opted into receiving SMS messages from you. All carrier compliance requirements and industry standards must be followed.
When your Messaging Service includes a short code, Twilio will always prioritize message delivery with the short code. 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, short code reroute does not attempt to redeliver your message over a long code due to a
Undelivered delivery status.
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 and 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 UCS2. UCS2 characters take 16 bits to encode though, so when a message includes a Unicode character, it will be segmented at 70 characters instead of 160 character per message segment.
The Messaging Service Smart Encoding feature helps detect those 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 messages.
Messages that include emoji or language based characters such as kanji are not transliterated with Smart Encoding. Please reference this list for the Unicode characters Smart Encoding will replace.
Validity Period is the number of seconds messages sent from your Messaging Service will remain in Twilio's platform. If the number of seconds configured is exceeded, Twilio will fail the message and send a webhook to your status callback URL to notify your application.
The validity period can be set to between 1 and 14,440 seconds (a maximum of 4 hours).
Please note that Twilio's validity period only applies to messages while in the Twilio platform, messages may still be queued by carriers after the message has been sent to the carrier network.
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 seven 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.
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.
When Sticky Sender is enabled, the Messaging Service will follow the logic below to determine the optimal phone number to send your message from.
Learn how to build AI-powered messaging bots. With Twilio Autopilot, you can design, build and train bot-driven conversations to answer questions, automate data collection, or route conversations using machine learning and natural language understanding.