Twilio Messaging Services automatically solve the most common SMS problems for you. For example, you set the configuration in the Console or by API, and the Service will pick the right phone number to send from and adapt your message content so it can successfully pass through ever-changing carrier specs.
While your Messaging Service takes care of most of the complexity for you, here are a few best practices to keep in mind.
The first Messaging Service best practice is... use a Messaging Service! When sending SMS you can set the
From parameter to a specific number or you can simply omit it and set the Messaging Service SID. You need to use a Messaging Service to take advantage of features like Advanced Opt-Out, Sticky Sender, Scaler, Geomatch, Shortcode Reroute, and Smart Encoding. We recommend always using a Messaging Service because it gives you access to these capabilities, along with any new ones we ship, without having to write any additional code.
Phone numbers are what you will typically use as the source of your message. Your Messaging Service automatically uses the best possible phone number from a Messaging Service's number inventory when it sends a message. This means you need enough phone numbers to handle all your planned messaging.
There may be limitations for how you use phone numbers depending on the country's limitations. (See our out guide to prepare for sending international SMS.)
For example, in the US and Canada, sending too many messages in a day from the same number puts you at risk of carriers filtering your messages. For application-to-person messaging, marketing traffic, and very high volume messaging, short codes are the way to go and help you avoid US/CA carrier restrictions.
If you plan to use phone numbers (i.e, long codes) there are a few things to consider:
Consider what senders and numbers you'll need for your use case. Are you sending one-way only, or do you expect replies? How many messages are you sending? Are you in a country that supports AlphaSender?
For example, you may want to use an AlphaSender in supported countries for one-way SMS.
Determining this information before you add senders to your Messaging Service makes set-up much smoother.
The rate at which messages are allowed to be sent over a single phone number varies by country. In the US, it’s approximately 1 message/second. Outside of the US, it’s typically 10 messages per second. We’ve built a highly available distributed queue so you don’t have to worry about these limits. Your application can send Twilio API requests as quickly as you’d like. We’ll queue your messages for you, and send them out at the appropriate rate. This keeps your application in compliance but can delay the delivery of your messages.
Adding phone numbers to your Messaging Service can increase your delivery rate. For example, five US phone numbers each sending at approximately one message per second can send about five messages per second together. Bear in mind that these are approximate sending numbers because long code phone numbers don’t have a dedicated throughput. If you need dedicated throughput, you may want to look into using short codes, which can send at rates starting at 100 messages per second.
Use message queue insights to help determine when to add more numbers.
Guidelines vary by country. Check Twilio’s international SMS usage guidelines for the specific countries where you will be sending SMS.
In some countries, using a local familiar phone number can improve the read and response rate. You may want to add in-country numbers to your messaging service for each country you want to send SMS to. Your Messaging Service will automatically prioritize Short Codes and Alphanumeric Sender IDs where they are supported. Where they are not supported, the Service will prioritize in-country phone numbers. If no appropriate short code, Slphanumeric Sender ID, or in-country phone number is available, the Service will send from a US long code.
The maximum number of phone numbers per messaging service is 400.
If you need to add more than 400 numbers, consider getting a short code. A single short code can send messages at rates starting at 100 messages per second and can go higher. Short codes have the added advantage of carrier pre-approval. This means that they can send much higher volume per day without being subject to filtering in the same way that long code phone numbers are.
Short codes are broadly supported in the US, Canada, and the UK, but some smaller carriers may not support short code messages. To achieve the highest levels of deliverability you should add a few long codes to your messaging service. In the US and Canada, the Short Code Reroute feature will send from a long code phone number when a short code is not supported.
Short codes can only be used to send domestic traffic (e.g., Canadian short codes can only send SMS in Canada.). In addition to using short codes, you should add long code numbers if you plan to send international SMS.
Alphanumeric Sender ID lets you send branded one-way messages in 150+ countries. The Messaging Service will automatically set the
From parameter of your message to either your Alphanumeric Sender ID or a phone number, depending on whether Alpha sender IDs are supported. Before you can use an Alphanumeric Sender ID with your Messaging Service, it must be enabled on your Account's SMS Settings.
Keep in mind that Alphanumeric Sender IDs cannot receive replies. Even if your use case is predominantly one-way, you may wish to use a phone number instead to enable your users to text back. Different countries have different regulations around how you use sender IDs. Some countries, like France, require any A2P traffic be sent via Alphanumeric. Other countries, like India, require Alphanumeric sender IDs to be pre-registered.