问题描述
Twilio 将长码 SMS 限制为 1/秒.为了提高吞吐量,我将批次拆分为 5 个电话号码.我发现 Twilio API 的每个 HTTP POST 大约需要 0.5 秒.
Twilio limits long code SMS to 1/sec. To improve my throughput, I split my batch into 5 phone numbers. I've found each HTTP POST to the Twilio API takes about 0.5 seconds.
人们认为使用 5 个 twilio 电话号码向 1000 部手机发送消息需要 200 秒,但仅 POST 请求就需要 500 秒.因此,两个电话号码将使我的吞吐量翻倍,但更多则无济于事.
One would think using 5 twilio phone numbers to send a message to 1000 cell phones would take 200 seconds, but it will take 500 seconds just to POST the requests. So two phone numbers will double my throughput, but more would not make a difference.
我错过了什么吗?我想如果 API 为To"参数获取电话号码列表会很好.我不想为短代码付费,但即使我这样做,最大吞吐量似乎也是 2/秒,除非您求助于让多个线程为 Twilio 提供数据的复杂性.
Am I missing something? I was thinking it would be nice if the API would take a list of phone numbers for the "To" parameter. I don't want to pay for a short code, but even if I do it seems the maximum throughput is 2/sec unless you resort to the complexity of having multiple threads feeding Twilio.
我在通话过程中注意到 TwiML 让您在构建响应时包含多个 sms 节点,因此似乎应该有一种方法可以对出站 SMS 执行相同的操作.
I've noticed TwiML during a call let's you include multiple sms nodes when constructing a response so it seems like there should be a way to do the same for outbound SMS.
推荐答案
Twilio Evangelist 在这里.目前,我们要求您提交每个 传出 SMS 消息 作为其自己的 API 请求.
Twilio Evangelist here. At the moment, we require that you submit each outgoing SMS message as its own API request.
当前 "是每秒 1 条消息.如果每秒发送更多消息,Twilio 会将它们排队并以每秒 1 条的速率将它们发送出去.
The current rate limit on a longcode is 1 message per second. If more messages per second are sent, Twilio queues them up and sends them out at a rate of 1 per second.
一个潜在的解决方法是跨多个电话号码发出异步请求.这可以通过 twilio node.js 模块 或事件框架,例如用于 Ruby 的 EventMachine 或您选择的语言的类似工具集.
A potential workaround is to make async requests across multiple phone numbers. This can be accomplished with the twilio node.js module or an evented framework such as EventMachine for Ruby or a similar toolset for your language of choice.
希望这会有所帮助!
这篇关于使用 Twilio SMS API,我可以在一篇文章中指定多个目标电话吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!