Getting started with Messaging Services

Messaging Services is a free Twilio feature designed to make it easier to send messages at-scale, as well as across multiple countries. In short, a Messaging Service is a container for multiple Twilio message senders (e.g. phone numbers, WhatsApp senders). It offers you additional message sending intelligence and content features, such as automatic number selection, when you pass your Messaging Service information in your API requests instead of a specific From number.

By setting up one or more Messaging Service for your use cases, you ensure that you can grow your messaging use case with Twilio more easily.

Messaging Services also provide access to A2P 10DLC in the United States, although you are not required to make any code changes to the way you send messages. If you are currently setting up one or more Messaging Services in preparation for A2P 10DLC, you just need to complete Steps 1 through 3 below.

To learn more about what Messaging Services offers, see our Messaging Services documentation.

Step 1: Create a Messaging Service

In Console, visit the Messaging Services page and click the button to create a Messaging Service, then follow the prompts.

You can also create a Messaging Service via the Messaging Services API.

Step 2: Set up inbound message handling (if desired)

Messaging Services have their own incoming message handling settings separate from the individual phone numbers' configurations.

As of March 2021, you have two options: drop incoming messages, or direct them to a webhook of your choice. This webhook can belong to your application, or it can be the webhook for another Twilio product such as a Studio Flow, Flex instance, or Twilio Function.

You can also set inbound message handling settings via the Messaging Services API.

Please note: Messaging Service inbound message configuration always takes precedence over individual phone number settings for handling incoming messages, so it's crucial that you make sure this setting is correct before adding Twilio numbers that you are actively using to receive inbound messages.

Twilio plans to create a new default option to use the individual phone numbers' inbound message configurations, this will be introduced prior to the full launch of A2P 10DLC to ease the transition for customers planning to use long codes for messaging to the United States.

Step 3: Add senders to your Messaging Service

Your Messaging Service can contain Twilio phone numbers, short codes, WhatsApp senders, and even an Alphanumeric Sender ID.

In Console, navigate to the "Sender Pool" page for your Messaging Service and click the button to add one or more Twilio senders, such as phone numbers, to the pool.

You can also add senders programmatically via the Phone Numbers, Short Codes, and Alpha Sender IDs subresources on the Messaging Services API.

Step 4: Start passing your Messaging Service SID in your API requests to send messages

There is only one small code change needed to begin sending messages using your Messaging Service: instead of specifying a From number in your API request, you specify a Messaging Service SID. The Messaging Service SID starts with "MG" and can be found in the Properties page for the Messaging Service in Console.

You can either pass the Messaging Service SID in your From parameter, or you can use its SID as the MessagingServiceSid parameter in your API request. Either one will work the same.

When you pass the Messaging Service SID instead of a specific From number, Twilio will automatically select the best sender in your Messaging Service sender pool for reaching the To number you're sending to. In general, short codes will be prioritized first (if one is present and able to reach the destination), followed by Alpha Sender ID (if present), then local numbers, and finally non-local numbers.

If you wish, you can also pass a specific From number anytime you want to bypass the automatic number selection that would otherwise be applied by your Messaging Service.

Learn more in our Sending Messages with Copilot documentation.

Learn more about scaling your messaging with Messaging Services

Sending messages globally at-scale can be complex, but Twilio wants to help make it as easy as possible. If you are growing your business and your messaging volume, especially across numerous countries, check out Best Practices for Scaling with Messaging Services on our API docs site.

Have more questions? Submit a request
Powered by Zendesk