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 sanitizes and validates each destination number. 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='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)
    }