Using the Twilio SMS API, can I specify multiple recipient phones in a single message?

Twilio limits the long SMS code to 1 / s. To increase throughput, I divided my batch into 5 phone numbers. I found that each HTTP POST for the Twilio API takes about 0.5 seconds.

You would think that using 5 twilio phone numbers, it would take 200 seconds to send a message to 1000 cell phones, but it would take 500 seconds to send requests. Thus, two phone numbers will double my bandwidth, but will no longer affect.

Am I missing something? I thought it would be nice if the API took a list of phone numbers for the To option. I donโ€™t want to pay for the short code, but even if I do, the maximum throughput is 2 / s, if you do not resort to the complexity of having multiple threads serving Twilio.

I noticed that TwiML during a call allows you to include several sms nodes when building a response, so it seems that there should be a way for outgoing SMS messages to do the same.

+4
source share
2 answers

The Twilight Evangelist is here. Currently, we require that you send each outgoing SMS message as your own API request.

The current speed limit for long code is 1 message per second. If more messages are sent per second, Twilio queues them and sends them at a speed of 1 second.

A potential workaround is to create asynchronous requests for multiple phone numbers. This can be done using the twilio node.js module or a framework created in this way, such as EventMachine for Ruby or a similar set of tools for your language of choice.

Hope this helps!

+10
source

If you use a trial account, even a cycle with a timeout of 5 seconds between each element of the array does not work for me. And that was just two numbers. After I updated my account, the code worked immediately, without requiring a timeout.

You know this trial account if the SMS received (when sending only to one number) says โ€œSent from your Twilio trial accountโ€.

0
source

Source: https://habr.com/ru/post/1498461/


All Articles