Bulk SMS Messaging Example

Modified on Fri, 12 May 2023 at 02:24 PM

Bulk SMS Messaging

Depending on the nature of your application it is not uncommon to be wanting to send a large volume of messages in small bursts, these may be plain SMS messages or personalised plain SMS messages where for example you are referring to the customer by name, in these sorts of cases we offer a Bulk SMS messaging endpoint which can be used for sending up to 1,000 messages in a single request.


Example 1:

Sending the Same Message to a number of people

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "to": [
    61499000100,
    61499000111,
    61499000222
  ],
  "message": "The yacht is on the river",
  "reference": "ZZZ999",
  "from": "TallBob"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api-test.tallbob.com/v2/sms/list_send", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Example 2:

Sending a personalised Message to a number of people 

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Basic YOUR_TOKEN");

var raw = JSON.stringify({
  "to": {
    "61499000100": {
      "name": "Person1"
    },
    "61499000111": {
      "name": "Person2"
    },
    "61499000222": {
      "name": "Person3"
    }
  },
  "message": "Hi {{ name }}, The yacht is on the river",
  "reference": "ZZZ999",
  "from": "TallBob"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api-test.tallbob.com/v2/sms/list_send", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Example 3

Sending different messages in a single batch

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Basic YOUR_TOKEN");

var raw = JSON.stringify({
  "to": {
    "61499000100": {
      "message": "Sample message 1"
    },
    "61499000111": {
      "message": "Sample message 2"
    },
    "61499000222": {
      "message": "Sample message 3"
    }
  },
  "message": "{{ message }}",
  "reference": "ZZZ999",
  "from": "TallBob"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api-test.tallbob.com/v2/sms/list_send", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));


Note About the Reference Field

Please note the reference field if specified will be unique for the batch of the send only, you will not be able to specify an individual using solely this reference value. If you want to match responses back to an individual you will need to use a composite key such as reference+mobile

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article