Menu

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Messaging Services and Copilot

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.

Messaging Service and Copilot messaging features can be managed and configured both via our REST API as well as directly through the Console.

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. Twilio Copilot features are available to add more messaging capabilities to your application.

Send a message with Copilot

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.

Loading Code Sample...
      
      
      
      

      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.

      Copilot Features

      So what can Copilot do for you? Let's dive into the features.

      Sticky Sender

      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 To and 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 From number.

      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. To remove a single mapping from the service instance contact support with the messaging service SID and the required recipient.

      Alphanumeric Sender ID

      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.

      Note that if you have SMS-capable numbers from that country in your Messaging Service pool, Twilio will use those instead.

      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 'Copilot Features' section and add your new ID. Twilio will verify it for you and add it to your service:

      Set up an Alphanumeric Sender ID for your messaging service

      To learn more about Alphanumeric Sender IDs, see the support article on getting started with Alphanumeric Sender ID.

      Scaler

      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, Copilot 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

      Geomatch selects the Twilio phone number in your Messaging Service to match the country and area code of your recipient's phone number.

      Country Code Geomatch

      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.

      Area Code Geomatch

      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. Copilot 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

      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 with your Messaging Service, Copilot 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, Copilot will re-attempt the message using a long code phone number in the same Messaging Service.

      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.

      Shortcode Reroute

      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 Failed or Undelivered delivery status.

      Smart Encoding

      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.

      Copilot's Smart Encoding 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

      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

      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.

      You can check the capabilities of numbers in the console or query the Available Phone Numbers resource to search for Twilio numbers that are MMS enabled.

      Intelligent Number Selection with Copilot

      When Sticky Sender is enabled, Twilio's Copilot Features will follow the logic below to determine the optimal phone number to send your message from.

      Dynamically select a phone number with Twilio's Copilot

      Need some help?

      We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.

      Loading Code Sample...