twiliotwilio-apibulksms

I can't send bulk sms to different phone numbers in Twilio API


I have tried to send bulk sms in Twillio for a while.

Which I done things; Firstly, I created a service in Messaging Services page. And then, I created a notify services with message service sid in Notify Services page.

After those, I requested with Postman following cURL code.

How to do this? Do I definitely have to create binding before I send bulk sms?

    curl --location --request POST 'https://notify.twilio.com/v1/Services/IS1111111111111111/Notifications' \
--header 'Authorization: Basic ZmRnZGZnZGY6ZmRnZGZn' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Body=xyz message' \
--data-urlencode 'ToBinding=[{"binding_type":"sms", "address":"+12345"},{"binding_type":"sms", "address":"+123456"}]'

Response:

{
    "code": 20001,
    "message": "Can not convert incoming parameters to Notification object: Parameter 'ToBinding' is invalid",
    "more_info": "https://www.twilio.com/docs/errors/20001",
    "status": 400
}

Solution

  • Twilio developer evangelist here.

    Have you seen this StackOverflow question and answers?

    This Postman setup works: Postman for bulk SMS

    Under Body > Form-data, enter a ToBinding key value pair for each number. In the key field, enter "ToBinding" and in the value field, enter the following syntax for a phone number:

    {"binding_type":"sms", "address":"YOUR-PHONE-NUMBER"}