Bulk Messaging

It is possible to send one message to multiple destination numbers via a single API request using Plivo’s Bulk Messaging feature.

Simply provide a list of destination numbers separated with the delimiter <. (e.g. 14156667777<14157778888<14158889999).

Each destination number is sanitized and validated. Valid destination numbers are accepted, and the list of invalid destination numbers is shared in the message response.

This send message API supports up to 1000 unique destination numbers.

Note that messages to all recipients may not be delivered instantly. This is because the messages would be dequeued for delivery based on rate limits configured for your account.

Returns

A unique message_uuid is generated for each valid destination number, and the entire list of uuids is returned in the message_uuid parameter in the response body.

The list of invalid destination numbers is returned in the invalid_number parameter in the response body.

Response

HTTP Status Code: 202

{
  "api_id": "984bc856-9231-11e7-b886-067c5485c240",
  "invalid_number": [
    "jsgf3dsjh28372"
  ],
  "message": "message(s) queued",
  "message_uuid": [
    "6da4afba-2bcf-4a87-9eff-d2f88577b0f1",
    "6da384ba-19js-aand-2h3g-r2f8ja0700f1"
  ]
}

Example Request

1
2
3
4
5
6
7
8
9
10
11
12
import plivo

client = plivo.RestClient("auth_id", "auth_token")
response = client.messages.create(
    powerpack_uuid='your_powerpack_uuid',
    dst='+14152223333<+14151112222',
    text='Hello, this is a sample text',
    url='http://foo.com/sms_status/',
)
print(response)
#prints only the message_uuid
print(response.message_uuid)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require "plivo"
include Plivo

api = RestClient.new("auth_id", "auth_token")
response = api.messages.create(
  nil, #from
  ["+14151112222", "+14152223333"], #to
  "Hello, this is a sample text", #text
  { url: "http://foo.com/sms status/"},
  "your_powerpack_uuid",
  )
  puts response
  #Prints only the message_uuid
  puts response.message_uuid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var plivo = require('plivo');
(function main() {
    'use strict';
    var client = new plivo.Client("auth_id", "auth_token");
    client.messages.create(
        null, //src
        "+14152223333<+14151112222", //dst
        "Hello, this is a sample text from Plivo", // text
        {method: "GET",url: "http://foo.com/sms status/"},
        "your_powerpack_uuid"
      ).then(function (response) {
          console.log(response);
          //Prints only the message_uuid
          console.log(response.messageUuid);
      },);
  })();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
require 'vendor/autoload.php';
use Plivo\RestClient;

$client = new RestClient("auth_id", "auth_token");
$response = $client->messages->create(
  null, #src
  ['+14152223333<+14151112222'], #dst
  'Hello, this is a sample text', #text
  ["url"=>"http://foo.com/sms status/"],
  'your_powerpack_uuid'
);
print_r($response);
// Prints only the message_uuid
print_r($response->getmessageUuid(0));
?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.io.IOException;
import java.net.URL;
import java.util.Collections;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.message.Message;
import com.plivo.api.models.message.MessageCreateResponse;

class MessageCreate
{
    public static void main(String [] args)
    {
        Plivo.init("auth_id","auth_token");
        try
        {
            MessageCreateResponse response = Message.creator(Collections.singletonList("+14151112222<+14152223333"),
                    "Hello, this is test message","your_powerpack_uuid")
                    .url(new URL("http://foo.com/sms_status/") )
                    .create();
            System.out.println(response);
            // Prints only the message_uuid
            System.out.println(response.getMessageUuid());
        }

        catch (PlivoRestException | IOException e)
        {
            e.printStackTrace();
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System;
using System.Collections.Generic;
using Plivo;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("auth_id", "auth_token");
            var response = api.Message.Create(
                powerpack_uuid: "your_powerpack_uuid",
                dst: new List<String> { "+14151112222<+14152223333" },
                text: "Hello, this is sample text",
                url: "http://foo.com/sms_status/"
                );
            Console.WriteLine(response);
            // Prints the message_uuid
            Console.WriteLine(response.MessageUuid[0]);
        }
    }
}
1
2
3
4
curl -i --user auth_id:auth_token \
    -H "Content-Type: application/json" \
    -d '{"powerpack_uuid": "your_powerpack_uuid","dst": "+14152223333<+14151112222", "text": "Hello, this is a sample text"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Message/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package main
import "fmt"
import "github.com/plivo/plivo-go"

func main() {
	client, err := plivo.NewClient("auth_id", "auth_token", &plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}
	response, err := client.Messages.Create(
		plivo.MessageCreateParams{
			PowerpackUUID: "your_powerpack_uuid",
			Dst:       "+14151112222<+14152223333",
			Text:      "Hello, this is a sample text",
			URL:       "http://foo.com/sms status/",
		},
	)
	if err != nil {
		panic(err)
	}
	fmt.Printf("Response: %#v\n", response)
	// Prints only the message_uuid
	fmt.Printf("Response: %#v\n", response.MessageUUID)
}