简体   繁体   中英

Twilio Bulk SMS

how can I create a bulk sms code on twilio? Right now, I'm using Twilio Service api which can send up to 10k sms in 1 request. But I read that it only sends 1 sms per second so it means 10k messages means all will be sent after 3 hours.

Is it possible to do it like this on Twilio?

All of these should happen using Twilio API

  1. Can create/delete lists that will identify the phone #.
  2. Can add/delete phone numbers on the list.
  3. Can request twilio to trigger a notification which will only ask for the list id instead of looping all phone numbers (which is the current way I'm doing it).

Currently im doing it like this:

$to = array();
$x = 0;
$message = 'Test';
foreach($phone_numbers as $phone_number){
  $to[$x] = '{"binding_type":"sms", "address":"'.$phone_number.'"}';
  $x++;
}

$notification = $client
  ->notify->services($service_id)
  ->notifications->create([
    "toBinding" => $to,
    "body" => $message
]);

If the phone numbers are more than 10k, it will not send all of them.

is there a way to make it like this?

the phone numbers are not stored on the database but instead stored on a list in twilio database then you will only need to call that list to send a message

also i can add multiple list which will identify what the notification is for

ex.

list #1 name is Room 1

list #2 name is Room 2

list #1 has phone number a, phone number b

list #2 has phone number a, phone number c

Twilio developer evangelist here.

The existing way you are using the bulk notifications API, by sending the numbers as part of the request, is just one part of the Twilio Notify API .

You can save numbers within Twilio and tag them as part of different lists. To do so, you need to create a binding . A binding is the connection of an identity and an address, in this case, the user's mobile number.

Notably though, this won't solve your delivery speed. There is a 1 message per second, per number limit when sending messages in the US to avoid carrier filtering. We also recommend you don't send more than 200 messages per day, per number to avoid the number being flagged for spam too.

Outside of the US things are less strict and the limit for sending messages is 10 per second, per number.

To overcome this you should either choose to use more numbers. If you are using Notify, then you are already using a messaging service with a number in the number pool. You can add more numbers to the number pool and the messaging service will distribute the messages between them. This will increase your throughput.

If you are sending that many messages in the US, then I would likely recommend using a short code . They are expensive, but they offer 100 messages per second throughput and, because they are more regulated, you don't need to use many different numbers.

Let me know if that helps at all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM