メニュー

Expand
ページを評価:

Best Practices for Scaling with Messaging Services

When you’re ready to scale messaging for your application, you should keep a few best practices and key questions in mind as you build and work with Twilio.

This guide presents common use cases and location-specific complexities that can affect your messaging application. Knowing how, where, and to whom you plan to send messages will help you avoid some common pitfalls while scaling.

Use a Messaging Service to send messages

Perhaps you built out your messaging application’s proof of concept by sending messages from a single long-code phone number. However, as you scale, your application may rely on different types of senders, such as short codes, Alpha Sender ID, WhatsApp senders, and phone numbers. You will also want to use features such Advanced Opt-Out for compliance management and Smart Encoding to catch those segment-gobbling Unicode symbols.

Intrigued? Check out the full list of Messaging Service features.

You can think of a Messaging Service as a container to hold all of your sender IDs and to manage the configuration affecting the delivery of your messages. For example, you could put your short code and local numbers in one Messaging Service sender pool and configure them to point to the same webhook URL to respond to incoming messages. You could also define the same set of Stop words per country for all of the senders in your sender pool using the Messaging Service Advanced Opt-Out feature.

When sending messages from a Messaging Service, you can set the From parameter to your Messaging Service SID, instead of a specific phone number. This not only provides intelligent routing for the senders in your Sender Pool, but also gives you access to the various Messaging Service Features, like Advanced Opt-Out, Sticky Sender, Shortcode Reroute, Smart Encoding and more.

        
        
        
        

        If your messaging use case is Two-Factor Authentication (2FA) codes, you’ll want to use Authy or Verify, rather than Programmable Messaging.

        Depending on what you build with Twilio Programmable Messaging, you will use a sender as the primary way that customers interact with your business’ application. There are different sender types to choose from:

        • Local and international long code numbers
        • Short code numbers
        • Toll-free numbers
        • Alphanumeric sender IDs
        • WhatsApp senders

        The answers to the following questions will determine what kind(s) of senders you should select and include in your Messaging Service’s Sender Pool.

        1) Are you sending one-way or two-way messages?

        Consider your use case: do you need your recipients to be able to reply to your messages? If so, that is called “two-way messaging."

        More modern messaging channels like WhatsApp, always support two-way messaging. With SMS, however, two-way messaging is not always supported; you’ll need to make sure that you use the correct number type if available or consider an alternative such as WhatsApp.

        Check out our two-way SMS FAQ for more information, or read about WhatsApp here.

        If you only need to send one-way messages to your recipients, you generally have more options for sender types. However, you still should consider the countries to which you are sending and your use case, so read on.

        Regulations vary by country, so make sure to check out country-specific guidelines for the countries in which you plan to send SMS.

        Not all sender types work in every country, so you should determine in advance where you want to send messages:

        If you’re sending in the US and Canada:

        In the United States and Canada, you can send messages from a few types of numbers.

        • US/Canada long code phone numbers (recommended for testing only)
        • Short code phone numbers
        • US Toll-Free numbers
        • WhatsApp-enabled numbers

        As of Q4 2020, most US and Canada mobile carriers forbid sending application-to-person (A2P) messaging using long code phone numbers. Mobile carriers have message filtering systems in place to block such messages. For a comparison of number types for the US and Canada, see here.

        If you’re sending outside the US and Canada:

        Outside of the United States and Canada, your possible sender types include:

        • Alphanumeric Sender IDs
        • Long code phone numbers
        • Short code phone numbers
        • Toll-free numbers*
        • WhatsApp-enabled numbers

        *Please note that only US Toll-free numbers can send SMS. When sending messages to non-US countries, carriers treat US Toll-Free numbers just like any other non-local long code phone number.

        グローバルなメッセージ配信では国内電話番号の使用を考慮する

        In some countries, using a local, familiar phone number can improve the read and response rate of your messages. You may want to add in-country numbers to your Messaging Service for each country you want to send SMS to.

        3) What kind of content are you sending?

        When selecting senders for your Messaging Service, also consider the type of content that you’ll send to your customers. Message content affects which sender types are available for you to include in your Messaging Service.

        There are two main types of traffic to consider:

        Application-to-Person (A2P) messaging

        Application-to-Person (“A2P”) messaging is a traffic type where the receiver (“person”) receives messages from an application. Common examples of A2P traffic are marketing messages, chat bots, virtual assistants, and appointment reminders.

        Bear in mind that A2P can be both one-way, such as marketing messages and appointment reminders, as well as two-way, such as virtual assistants.

        Because A2P messages are subject to local country regulations, if you plan to send A2P-type traffic through your application, we recommend including the following sender types in your Messaging Service’s Sender Pool:

        • Short Codes (two-way)
        • Alphanumeric sender IDs (one-way only)
        • Non-local long code numbers (one-way only)
        • Local long code phone numbers (two-way supported – where allowed. Make sure to check your country’s regulations.)
        • WhatsApp

        Person-to-Person (P2P) messaging

        Person-to-Person (“P2P”) messaging is two-way, or “back-and-forth” messaging between two humans. This could be a customer service agent and a customer, a driver and a rideshare rider, or connecting two friends over a messaging application.

        For two-way, back-and-forth messaging, you should include one or more of the following in your Messaging Service’s Sender Pool:

        • Local long code phone numbers
        • Short codes
        • WhatsApp

        Determine your messaging throughput needs

        Message throughput, measured in MPS (“Messages per second”) affects which types and how many senders you should add to your Messaging Service’s Sender Pool.

        MPS varies by country and by sender type. In the US, it’s approximately 1 (one) message per second over a regular long code phone number. Outside of the US, it’s typically 10 (ten) messages per second.

        MPS Considerations for the US and Canada

        Using multiple long code or Toll-Free numbers to increase your message throughput to the US or Canada is strongly discouraged as it will result in carrier filtering.

        For the US, you can get a short code number, which can send messages at 100 MPS or more. Or you can use a single Toll-Free number and talk to Sales about upgrading the number for high-throughput of 25+ MPS.

        For Canada, short codes (offering 100+ MPS) are the only permitted way to send A2P traffic, at any volume. Using long codes or a US Toll-Free number to send A2P messaging traffic will result in carrier filtering.

        MPS Considerations for the rest of the world

        Your options for increasing MPS depend on your traffic type (one-way vs. two-way and A2P vs. P2P, discussed above) and the type of sender(s) you’ve decided to use.

        Alphanumeric Sender ID: by default, Alphanumeric Sender ID offers 10 MPS. To increase MPS on an Alphanumeric Sender ID, talk to Sales or submit a Support request. Include your expected message volume to the country or countries to which you will send messages.

        Long code numbers: by default, long code numbers sending to non-US/Canada countries offer 10 MPS. The MPS on an individual number cannot be increased, but you can add more numbers.

        Twilio has built a highly available, distributed queue, so you don’t have to worry about these limits. Your application can send Twilio’s Programmable Messaging API requests as quickly as you’d like. We’ll queue your messages for you and send them out at the appropriate rate for your senders. This keeps your application in compliance, but this can delay the delivery of your messages.

        To find out more, read this article about Twilio Rate Limits and Message Queues.

        We caution against simply adding more long code phone numbers to your Messaging Service’s Sender Pool to distribute the load, a practice known as “snowshoeing.” Instead, consider upgrading to a sender type with higher throughput, such as a toll-free number or short code, if available in your area.

        If you’re in the United States, United Kingdom, or Canada: Apply for a Short Code to take advantage of a higher throughput rate, starting at 100 messages per second. 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.

        If you’re outside the United States, United Kingdom, and Canada: Add long codes to improve deliverability, even when using short codes in your Messaging Service’s Sender Pool.

        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 IDs and Throughput

        If you are using an alphanumeric sender ID, it will take precedence over the other phone numbers in your Messaging Service sender pool, even if it has queued messages. Message delivery does not fall back from alphanumeric sender IDs to the long code phone numbers in your sender pool.

        If you are planning to use an alphanumeric sender ID in a supported country, make sure that you get the right MPS rate for it. You can request higher throughput on your alphanumeric sender ID through Support.

        Time to get scaling

        When you’re ready to scale with Twilio Programmable Messaging, we highly recommend moving your application to a Messaging Service, if you have not already done so. That way, you’ll have access to all of the built-in features that help you send messages globally and at high-volume, all while managing a single sender pool.

        The fastest way to scale your messaging application is to identify your use case and messaging needs from the start. Knowing where you’ll be sending messages, what type of content you’ll send to customers, and how quickly you need those messages to be sent will point you to the right sender types to include in your Messaging Service.

        Also check out:

        Mica Swyers
        ページを評価:

        ヘルプが必要ですか?

        誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。

              
              
              

              フィードバックくださりありがとうございます!

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

              Sending your feedback...
              🎉 Thank you for your feedback!
              Something went wrong. Please try again.

              Thanks for your feedback!

              Refer us and get $10 in 3 simple steps!

              ステップ1

              Get link

              Get a free personal referral link here

              ステップ2:

              Give $10

              Your user signs up and upgrade using link

              ステップ3

              Get $10

              1,250 free SMSes
              OR 1,000 free voice mins
              OR 12,000 chats
              OR more