Latest Legacy

Bulk Messaging

Plivo’s Bulk Messaging feature lets you send a single message to multiple destination numbers via a single API request.

To do this, use a list of destination numbers separated with the delimiter < — for example, 14156667777<14157778888<14158889999.

The API verifies that each destination number is in the correct format and removes duplicates. Valid destination numbers are accepted, and a list of invalid destination numbers is returned in the message response.

The Message API supports up to 1,000 unique destination numbers.

Note that messages to all recipients may not be delivered instantly. Messages are dequeued for delivery based on the 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='<powerpack_uuid>',
    dst='+12025551111<+12025552222',
    text='Hello, this is sample text',
    url='https://<yourdomain>.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
require "plivo"
include Plivo

api = RestClient.new("<auth_id>","<auth_token>")
response = api.messages.create(
	src: "+12025550000",
	dst:"+12025551111"<"+12025552222",
	text:"Hello, this is sample text",
	url: "https://<yourdomain>.com/sms status/",
)
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
var plivo = require('plivo');
(function main() {
    'use strict';
    var client = new plivo.Client("<auth_id>", "<auth_token>");
    client.messages.create(
      {
          src: "+12025550000", 
          dst: "+12025551111<+12025552222",
          text: "Hello, this is sample text",
          url: "https://<yourdomain>.com/sms_status/"
      }
    ).then(function (response) {
        console.log(response);
    });
})();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
require 'vendor/autoload.php';
use Plivo\RestClient;

$client = new RestClient("<auth_id>","<auth_token>");
$response = $client->messages->create(
  [  
    "src" => "+12025550000",
    "dst" => "+12025551111<+12025552222",
    "text"  =>"Hello, this is sample text",
    "url"=>"https://<yourdomain>.com/sms_status/"
 ]
);
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("+12025551111<+12025552222"),
                    "Hello, this is a test message","<powerpack_uuid>")
                    .url(new URL("https://<yourdomain>.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: "<powerpack_uuid>",
                dst: new List<String> { "+12025551111<+12025552222" },
                text: "Hello, this is sample text",
                url: "https://<yourdomain>.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": "<powerpack_uuid>","dst": "+12025551111<+12025552222", "text": "Hello, this is 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
25
26
27
28
29
30
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Messages.Create(
		plivo.MessageCreateParams{
			PowerpackUUID: "<powerpack_uuid>",
			Dst:           "+12025551111<+12025552222",
			Text:          "Hello, this is sample text",
			URL:           "https://<yourdomain>.com/sms status/",
		},
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
	// Prints only the message_uuid
	fmt.Printf("Response: %#v\n", response.MessageUUID)
}