Latest Legacy

Overview

The Plivo API uses HTTP verbs and standard HTTP status codes to make it easier for you to integrate communications into your code. To secure your requests to our servers, we serve our API over HTTPS.

If you’re looking for our client SDKs, you can find them at iOS SDK, Android SDK, and Browser SDK.

Note: The current version of the API is v1, and the server SDKs are versioned as latest and legacy.

API Endpoint

POST https://api.plivo.com/{version}/

API Request

Plivo exposes a list of REST APIs to perform various actions. You can use these APIs in combination with XML documents to create voice and messaging applications.

POST https://api.plivo.com/v1/

Authentication

All requests to the Message API are authenticated with BasicAuth using your AUTH ID and AUTH TOKEN. You can find your AUTH ID and AUTH TOKEN on the Overview page of the Plivo console.

Example Request

1
2
3
4
5
6
7
import plivo

proxies = {
    'http': 'https://username:password@proxyurl:proxyport',
    'https': 'https://username:password@proxyurl:proxyport'
    }
client = plivo.RestClient('<auth_id>', '<auth_token>', proxies=proxies,timeout=5)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
require 'rubygems'
require 'plivo'

proxy = {
	proxy_host: "https://proxyurl",
	proxy_port: "proxyport",
	proxy_user: "username",
	proxy_pass: "password"
}
api = RestClient.new("<auth_id>", "<auth_token>", proxy, timeout=5)

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');
let options = {
	'timeout': 5000, //ms
	'host': 'https://proxyurl',
	'port': 'proxyport',
	auth: {
		username: 'my-user',
		password: 'my-password'
	}
}

var client = new plivo.Client("<auth_id>", "<auth_token>", options);

Was this code helpful

1
2
3
4
5
6
<?php
require 'vendor/autoload.php';
use Plivo\RestClient;

$client = new RestClient("<auth_id>", "<auth_token>", "<https://proxyurl>", "<proxyport>", "<username>", "<password>");
$client->client->setTimeout(5)

Was this code helpful

1
2
3
4
5
6
7
8
9
package com.plivo.api.samples.application;

import com.plivo.api.Plivo;

class AutheExample {
  public static void main(String [] args) {
    Plivo.init();
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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>",
        "<https://proxyurl>", "<proxyport>", "<username>", "<password>");
      api.Client.SetTimeout(10);
    }
  }
}

Was this code helpful

1
2
3
4
5
6
7
8
9
10
package main

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

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}
}

Was this code helpful

Content-Type

Plivo only accepts input of the type application/json.

All POST requests arguments must be passed as json with the Content-Type set as application/json.

All GET and DELETE request arguments must be passed in the query string.

Timeouts and Proxies

The server SDKs provide for specifying timeouts and proxy settings to be used while making API requests. In the code window, select the programming language of your choice and click on the latest version to see how to specify these settings.

Pagination

Plivo uses offset-based pagination to list resources.

For instance, if a search request has a result of 100 objects with limit = 10 and offset = 5, then objects with indices 51 through 60 are returned.

Parameters used for pagination

limit integer

A limit on the number phone numbers to be returned. limit can range between 1 and 20, and the default is 20.

offset integer

A pagination cursor to denote the number of objects by which the results should be offset.

Asynchronous Request

All requests to the Message API can be made asynchronous by adding the parameters listed below. When you make an asynchronous call, Plivo returns a generic response with the api_id, and the actual API response is sent to the callback URL.

Arguments

callback_url

The URL notified by the API response.

callback_method

The method used to notify the callback_url.

Allowed values: GET, POST
Defaults to POST.

Response

{
"message": "async api spawned",
"api_id": "63f0761a-e0ed-11e1-8ea7-12313924e3a6"
}

API Response

All Plivo API endpoints return a response in JSON format. An api_id in each response uniquely identifies each request. The API returns one of these HTTP status codes depending on whether the API call is successful or not.

HTTP status codes we send

200

Request has been executed

201

Resource created

202

Resource changed

204

Resource deleted

400

A parameter is missing or is invalid

401

Authentication failed

404

Resource cannot be found

405

HTTP method is not allowed

429

You are sending too many requests

500

Server error

Response Examples

Response Attributes

api_idstring

Identifies the request.

errorstring

Indicates there is an error and provides information regarding the error.

messagestring

Provides information regarding the request

Response

Success

{
  "api_id": "97ceeb52-58b6-11e1-86da-77300b68f8bb",
  "message": "call fired",
  "request_uuid": "75b26856-8638-11e0-802c-6d99d509954e"
}

Error

{
  "api_id": "97ceeb52-58b6-11e1-86da-77300b68f8bb",
  "error": "answer_url parameter is missing",
  "request_uuid": "56hf4856-8638-11e0-802c-65j6gd39954e"
}

Message

Plivo’s Message API is a simple REST interface for sending and receiving SMS, MMS, and WhatsApp messages to and from more than 200 countries around the world.

API Endpoint

BaseURI https://api.plivo.com/v1/Account/{auth_id}/Message/

The Message object

A Message Detail Record (MDR) is generated for every message sent or received by Plivo.

An MDR object has these attributes.

Attributes

message_uuid string

A 36-character string that uniquely identifies a message detail record.

message_time string

The exact timestamp at which an outbound message was initiated or an inbound message was received.

message_direction string

Indicates the direction of the message. It is set to outbound for messages sent out from Plivo’s platform, and to inbound for messages received on Plivo numbers.

message_state string

Indicates the current status of the message.

Outbound messages may be in any of the following states: queued, sent, failed, delivered, undelivered, read (WhatsApp only).

All outbound messages are initially queued. A message is marked as failed if an internal error occurs before the message is passed on to downstream carriers. A message is marked as sent when the message is successfully passed to a downstream carrier. The message is marked delivered or undelivered based on the delivery receipt received from the carrier. Note that delivery receipts are not universally supported across countries, number types, and mobile networks. The final status of a message may remain as sent in cases where delivery receipts are not received. For WhatsApp messages only, a message is marked as read when a user reads an outbound message and the user has read receipts enabled.

Inbound messages may be in any of the following states: received, delivered, undelivered.

All inbound messages are initially marked as received. If the Plivo phone number that received the message is associated with an application, and the application has a valid message_url configured, then the message is forwarded to that URL. The message is marked as delivered on a successful response from the message_url, else it is marked undelivered.

message_type string

Set to sms for SMS messages, mms for MMS messages, and whatsapp for WhatsApp messages.

from_number string

Identifies the source address of the message. For outbound messages, this could be a Plivo phone number, short code, alphanumeric sender ID, or a phone number linked to your WhatsApp Business Account.

For inbound messages, this is the phone number from which the message to the Plivo phone number was initiated.

conversation_id string

WhatsApp-only attribute.

Represents the ID of the conversation to which the given message belongs.

conversation_origin string

WhatsApp-only attribute.

Possible values: utility, authentication, marketing, service

Describes how a WhatsApp conversation was initiated.

service conversations are initiated when a user sends a message to the business.

utility, authentication, and marketing conversations are initiated when a business sends a message to users using a template in the respective category.

conversation_expiry_timestampstring

WhatsApp-only attribute.

Unix timestamp applies when the current conversation expires. This is 24 hours after the conversation started. A conversation is considered started when you send the first outbound message.

to_number stringThe destination phone number to which the message was sent. For inbound messages, this is the Plivo phone number on which the message was received.
destination_country_iso2 stringThe ISO2 code of the country associated with the destination number.
units integer

Indicates the number of units that a message was split into.

total_rate string

The charge applicable per unit of the message.

total_amount stringThe total amount charged for this message. Typically, this is equal to the product of total_rate and units.
requester_ip stringThe IP address from which the message request originated. We recommend you monitor this field to identify possible account misuse and authentication credential takeovers.
error_code string

The Plivo SMS error code that helps identify the cause for a message delivery failure. For successfully delivered messages, this attribute is set to 000. For failed and undelivered messages it’s set to one of these error codes.

tendlc_registration_status stringIndicates nature of 10DLC registration for that message. Relevant only for long code messaging in the US.
tendlc_campaign_id stringThe campaign ID associated with the message. Relevant only for long code messaging in the US.
replaced_senderstringSender ID (numeric or alphanumeric) that left Plivo’s system. In some instances, Plivo replaces the sender to ensure compliance and deliverability.
is_domesticbooleanIndicates whether a message is treated as domestic. Relevant only for long code messaging in India; supports India-specific use cases such as DLT messaging and India DND filtering. The value of the field is derived from the way the organization classifies the sender ID at registration.
dlt_entity_idstringThe DLT entity ID passed in the message request. Relevant only for DLT-eligible India customers.
dlt_template_idstringThe DLT template ID passed in the message request. Relevant only for DLT-eligible India customers.
dlt_template_category stringThe template categorization registered in DLT portal. Relevant only for DLT-eligible India customers.

Allowed values: transactional, promotional, service_implicit, service_explicit
destination_network stringIndicates the carrier network for the recipient number you are sending messages to.
carrier_fees_rate stringThe carrier surcharge fee applicable per unit of the message.
carrier_fees stringThe total carrier surcharge fee charged for this message. Typically, this is equal to the product of carrier_fees_rate and units.
log string

For outbound messages, the data logging preferences were set in the message request. For inbound messages, preferences were set during the application setup as shown here.

Possible values: true, false, content_only, number_only If set to true, this message’s phone number and content data (text and media) will be logged on Plivo’s infrastructure.

If set to false, this message's phone number and content data (text and media) will not be logged on Plivo’s infrastructure, and the value will be masked (for example, +141XXXXX528). Media URLs will not be logged for MMS messages, and the message's media sub-resource will return an empty list.

If set to content_only, this message's content data (text and media) will be logged on Plivo’s infrastructure. Phone number data will be masked. This is applicable for outbound messages only.

If set to number_only, the phone number data of this message will be logged on Plivo’s infrastructure. Content data (text and media) will be masked. This is applicable for outbound messages only.

Response

{
    "api_id": "85a704c8-e47a-11eb-9a69-0242ac110004",
    "carrier_fees": "0.00000",
    "carrier_fees_rate":"0.0000"
    "error_code": "000",
    "from_number": "17087654321",
    "is_domestic": true,
    "mcc": "312",
    "message_direction": "outbound",
    "message_state": "delivered",
    "message_time": "2021-07-13 13:04:06.799021+05:30",
    "message_type": "whatsapp",
    "message_uuid": "b48d95dc-e3ac-11eb-a9c2-0242ac110005",
    "mnc": "650",
    "powerpack_id": "1d5f3dd8-b207-4738-b59f-3c2ac7d3461c",
    "resource_uri": "/v1/Account/{auth_id}/Message/b48d95dc-e3ac-11eb-a9c2-0242ac110005/",
    "to_number": "12401234567",
    "total_amount": "0.00140",
    "total_rate": "0.00140",
    "tendlc_campaign_id": "CD4WJJD",
    "tendlc_registration_status": "registered",
    "destination_country_iso2": "US",
    "units": 1,
    "replaced_sender": "",
    "dlt_entity_id": "",
    "dlt_template_id": "",
    "dlt_template_category": "",
    "conversation_id": "d0dfd12bed80dca89636268d0a67c383",
    "conversation_origin": "utility",
    "conversation_expiry_time": "2023-05-26 18:54:00.000000",
    "requester_ip": "192.168.0.1",
    "log":"true",
    "destination_network": "verizon"
}

Send SMS/MMS/WhatsApp

This API enables you to send messages via Plivo’s SMS service.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Message/

Arguments

src string Required — Conditional

The sender ID you want to use, which may be a phone number, a short code, or an alphanumeric string. For a WhatsApp message, use the phone number associated with your WhatsApp Business Account and mapped to your Plivo account.

You may use either src or powerpack_uuid but not both.

If you’re sending a message toward India and are registered on a DLT portal, use the registered DLT header that's mapped to the template you're sending.

All characters other than A-Z, a-z, and 0-9 are stripped off automatically as part of the sanitization process.

Sanitized phone numbers must begin with the international country code (for example, 14152828726), and should be <= 14 characters in length.

Sanitized alphanumeric sender IDs should be <= 11 characters in length. Support for alphanumeric sender IDs is disabled by default.

You must have a Plivo phone number to send messages to the US or Canada. You can buy a Plivo number from Phone Numbers > Buy Numbers on the Plivo console or via the Numbers API.

powerpack_uuid string Required — Conditional

Set this to the UUID of the SMS Powerpack you wish to use for this message. You may use either src or powerpack_uuid but not both.

dst string Required

The phone number to which the message is to be delivered.

The following characters are stripped off automatically as part of the sanitization process: /, -, ., +, (, ), and white spaces.

Sanitized phone numbers must begin with the international country code (for example, 14152828726), and should be <= 14 characters in length.

To send messages to multiple numbers, separate your destination phone numbers with the delimiter < — for example, 14156667777<14157778888<14158889999.

When you send WhatsApp messages to multiple destination numbers in a single request, each destination number will result in a unique conversation and will be tracked separately.

text string Required - Conditional

The content of the text message.

For SMS

Messages containing only GSM 03.38 7-bit characters have a maximum limit of 1,600 characters. Messages longer than 160 characters are split into multiple message units, each unit consisting of 153 characters.

Messages containing one or more UCS-2 16-bit Unicode characters have a maximum limit of 737 characters. Messages longer than 70 characters are split into multiple message units, each unit consisting of 67 characters.

Multiunit messages are automatically stitched back together and delivered as a single message in countries where mobile networks support long message concatenation.

For WhatsApp messages

You can send messages with this field when sending freeform messages. Non-templated messages can only be sent when an active conversation is ongoing. If no conversation is ongoing, such messages will fail with error 340.

Use this parameter when you’re sending freeform (non-templated) text messages. These messages may be no longer than 4,096 characters.

When sent along with media, this text will be displayed in WhatsApp as a media caption. When sent with media, text may be no longer than 1,024 characters.

type string

Allowed values: sms for SMS messages, mms for MMS messages, or whatsapp for WhatsApp messages Defaults to sms.

media_urls string Required — Conditional

For MMS messages

A comma-separated list of URL-encoded hyperlinks to the images or media to be included in the MMS message. This is a required field if the message type is mms.

Up to 10 media files may be included in a single MMS message.

Images of type gif, png, and jpeg will be formatted correctly for device compatibility before being forwarded downstream. Plivo may also resize an image if the original attachment exceeds the maximum size supported by the destination network.

You may include other media types (audio, video, vcards), but attachments of these types are not optimized for device compatibility.

The total size of the MMS must not exceed 5MB. Messages exceeding this limit will be marked as Failed with error code 120.

Note that Plivo will attempt to order media attachments on the device in the order specified in the API request, but the ordering cannot be guaranteed.

For WhatsApp messages

Use only a single media URL per message. Image, video, documents, and audio files are supported. For valid file types and maximum file size accepted refer to Meta documentation.

template object Required — Conditional

JSON object to send templated WhatsApp messages when type is whatsapp.

Message templates are used to initiate conversations with customers. Templated messages are the only types of message that you can send to customers who have yet to initiate a conversation with you, or who have not sent you a message in an existing conversation thread within the last 24 hours.

You can create templates using WhatsApp Manager.

Templates are uniquely identified by a combination of template name and language code. Components are used if dynamic variables are sent within a template.

Here are the arguments sent in the Template object.

interactive object optional

JSON object to send interactive WhatsApp messages when type is whatsapp.

Interactive messages are non-templated messages and cannot be sent unless there is an active conversation. Interactive messages include list buttons, reply buttons, click-to-action url buttons

Here are the arguments sent in the Interactive object.

location object optional

JSON object to define location attributes when type is whatsapp. Location attributes that can be passed are -

  • latitude - Location latitude in decimal degrees. Required.
  • longitude - Location longitude in decimal degrees. Required.
  • name - Location name. Optional
  • address - Location address. Optional
  • message_expiry string

    Set this parameter to control the time your message remains in the messaging queue. Once this period elapses your messages will fail with error code 420. The error code will be relayed back to your message URL, if configured. The value can be between 5 and 10,799 seconds.

    Defaults to 10,800 seconds (3 hours).

    url string

    Set this parameter to the fully qualified URL to which status update callbacks for the message should be sent. Read more about the message attributes passed to this callback URL.

    dlt_entity_id string Required — Conditional

    The DLT entity ID that was generated during the DLT registration process. Used only by customers with India DLT registrations that have their Plivo accounts configured to support India DLT traffic. For more information see DLT Registration Process for Sending SMS to India.

    Your message will fail with Plivo error code 160 if you pass this parameter incorrectly.

    dlt_template_id string Required — Conditional

    The DLT template ID that was generated during template creation in DLT portal. Used only by customers that have their Plivo accounts configured to support India DLT traffic. For more information see DLT Registration Process for Sending SMS to India.

    The template should be associated with the DLT header that’s passed as the src as part of this request.

    Your message will fail with Plivo error code 160 if you pass this parameter incorrectly.

    dlt_template_category string Required — Conditional

    The DLT template category from the DLT portal. Used only by customers that have their Plivo accounts configured to support India DLT traffic.

    Incorrect tagging of this parameter might result in message failures due to DND scrubbing.

    Allow values: transactional, promotionalservice_implicit, service_explicit

    method string

    The HTTP method to be used when calling the URL defined above.

    Allow values: GET, POST
    Defaults to POST

    trackable boolean

    Set this parameter to true for messages that have a trackable user action, such as entering a 2FA verification code. Setting this parameter to true implies that you intend to update Plivo upon successful delivery of the message using the Conversion Feedback API.

    Defaults to false.

    log string

    Possible values: true, false, content_only, number_only

    Defaults to true.

    If set to true, this message’s phone number and content data (text and media) will be logged on Plivo’s infrastructure.

    If set to false, this message's phone number and content data (text and media) will not be logged on Plivo’s infrastructure, and the value will be masked (for example, +141XXXXX528). Media URLs will not be logged for MMS messages, and the message's media sub-resource will return an empty list.

    If set to content_only, this message's content data (text and media) will be logged on Plivo’s infrastructure. Phone number data will be masked.

    If set to number_only, the phone number data of this message will be logged on Plivo’s infrastructure. Content data (text and media) will be masked.

    The customer agrees and acknowledges that Plivo may need to override this setting and log the content of some messages from time to time to ensure compliance with the applicable local laws or to monitor and debug for service quality.

    Arguments sent in Template Object

    name string Required

    Name of the template

    language string Required

    string indicating locale by combining language in ISO 639-1 format and region in ISO 3166-1 format.

    Ex: en_US, en, en_GB

    components object optional

    If you have defined dynamic variables in your template, you need to set this object.

    Array of components objects containing the dynamic parameters of the message. This specifies where the dynamic variables appear in your template and the values against those variables. Review the Components object.

    Review the Components object.

    Arguments sent in Components Object

    type string Required

    Describes the component type. Supported values are header, body, button.

    header — Supports dynamic variables of type text or media .

    body — Supports dynamic variables of type text.

    button — use this component if your template has a button which accepts dynamic variables. Example use case being -

  • You have defined a url button in your template and you want to append a text parameter to the predefined prefix URL.
  • You have defined a quick reply button in your template and you want to return a developer-defined payload that is returned when the button is clicked in addition to the display text on the button.
  • sub_type string Required — Conditional

    Required when component type=button. This further defines the type of button. Not used for the other types. Supported values are :

  • quick_reply: Refers to a quick reply button that allows for the customer to return a predefined message.
  • url: Refers to a button that allows the customer to visit the URL generated by appending the text parameter to the predefined prefix URL in the template.
  • index string Required — Conditional

    Required when component type is button. Not used for the other types. Position index of the button. You can have up to 10 buttons using index values of 0 to 9.

    parametersobject Required

    Parameters object describes the parameters and the values that need to replace the dynamic variables defined in your template.

    Pass the parameters array in the same order in which you have defined this in your templates. Review the Parameters object.

    Arguments sent in Parameters Object

    type string Required

    Describes the parameter type. Supported values:

  • text
  • media (only supported when component type is header)
  • payload (only supported when component type is button)
  • text string Required — Conditional

    This parameter is required when parameter type is text.

    When component type is header, text can be upto 60 chars long.

    When component type is body, text can be upto 1024 characters if other component types are included and 32768 characters if body is the only component type included.

    When component type is button, this is the developer-provided suffix that is appended to the predefined prefix URL in the template. Only applicable when component type is button and component sub type is url

    media string Required — Conditional

    This parameter can only be passed for component type is header and is required when parameter type is media.

    Supports images, documents and videos only.For valid file types and maximum file size accepted refer to Meta documentation

    payloadstring Required — Conditional

    This parameter is required when component type is button, component sub type is quick_reply and parameter type is payload

    This is the Developer-defined payload that is returned when the button is clicked in addition to the display text on the button.

    Arguments sent in Interactive Object

    type string Required

    Required for all interactive messages; this specifies the type of interactive message you want to send. Possible values: list, reply, cta_url.

    body object Required

    Required for all interactive messages. This object specifies the body of the message and contains the following argument:

    text: The content of the message. Emojis and markdown are supported. Maximum length: 1024 characters.

    footer object optional

    This object specifies the footer section of the message and contains the following argument:

    text: The content of the message. Emojis and markdown are supported. Maximum length: 60 characters.

    header object optional

    This object specifies the header section of the message and contains the following argument:

    type: The header type you would like to use. Supported values: text, media. Note that media is supported for interactive type reply only.

    text: The content of the header. Required if type is set to text.

    media: The content of the header. Required if type is set to media. Only supports images, documents, and videos. For valid file types and the maximum allowable file size, please refer to Meta documentation.

    action object Required

    This object specifies the nature of interactive messages and supports the following arguments:

    buttons(array of objects): Can accommodate only one array object for interactive message of type cta_url or list. Can accommodate up to three array objects for reply. The array consists of

  • id: Unique identifier for your button. This ID is returned in the callback response on your webhook when the reply button is clicked by the user. Maximum length: 256 characters. This is required for reply
  • buttons.
  • title: Title of your button. This can be up to 20 chars. This is required for all interactive message types.
  • cta_url: Valid url. This is required for cta_url buttons.
  • sections(array of objects): This is required for list messages and will be ignored for other interactive message types. This array is used to specify the sections in a list message. There can be a minimum of one section and a maximum of 10 sections. These objects support the following arguments:

  • rows(array of objects): Contains a list of rows. You can have a total of 10 rows across your sections. Each row must have:
  • title: Maximum length: 24 characters

    id: Maximum length: 200 characters

  • description: This is an optional field. Maximum length: 72 characters.
  • title: This is required if the message has more than one section. The title of the section can be a maximum of 24 characters.
  • Returns

    Returns a JSON response containing the API request ID and message UUID(s).

    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(
        src='<from_number>',
        dst='<destination_number>',
        text='Hello, this is sample text',
        url='https://<yourdomain>.com/sms_status/',
        )
    print(response)
    #prints only the message_uuid
    print(response.message_uuid)
    

    Was this code helpful

    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: "<from_number>",
    	dst:"<destination_number>",
    	text:"Hello, this is sample text",
    	url: "https://<yourdomain>.com/sms status/",
    )
    puts response
    #Prints only the message_uuid
    puts response.message_uuid
    

    Was this code helpful

    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: "<from_number>", 
              dst: "<destination_number>",
              text: "Hello, this is sample text",
              url: "https://<yourdomain>.com/sms_status/"
          }
          ).then(function (response) {
            console.log(response);
        });
    })();
    

    Was this code helpful

    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" => "<from_number>",
        "dst" => "<destination_number>",
        "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));
    ?>
    

    Was this code helpful

    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("<from_number>","+12025551111",
                        "Hello, this is a test message")
                        .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();
            }
        }
    }
    

    Was this code helpful

    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(
                    src: "<from_number>",
                    dst: "<destination_number>",
                    text: "Hello, this is sample text",
                    url: "https://<yourdomain>.com/sms_status/"
                    );
                Console.WriteLine(response);
                // Prints the message_uuid
                Console.WriteLine(response.MessageUuid[0]);
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    
    curl -i --user auth_id:auth_token \
        -H "Content-Type: application/json" \
        -d '{"src": "<from_number>","dst": "+12025551111", "text": "Hello, this is sample text", "url":"https://<yourdomain>.com/sms_status/"}' \
        https://api.plivo.com/v1/Account/{auth_id}/Message/
    

    Was this code helpful

    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{
    			Src:  "<from_number>",
    			Dst:  "<destination_number>",
    			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)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 202

    {
    "message": "message(s) queued",
    "message_uuid": ["db3ce55a-7f1d-11e1-8ea7-1231380bc196"],
    "api_id": "db342550-7f1d-11e1-8ea7-1231380bc196"
    }
    

    </p></td></tr></tbody></table>

    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.

    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)
    

    Was this code helpful

    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
    

    Was this code helpful

    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);
        });
    })();
    

    Was this code helpful

    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));
    ?>
    

    Was this code helpful

    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();
            }
        }
    }
    

    Was this code helpful

    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]);
            }
        }
    }
    

    Was this code helpful

    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/
    

    Was this code helpful

    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)
    }
    

    Was this code helpful

    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"
      ]
    }
    

    Retrieve a Message

    Retrieves a Message Detail Record (MDR).

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Message/{message_uuid}/

    Arguments

    No arguments need to be passed.

    Returns

    This API call returns the Message Detail Record for the message identified by the message_uuid specified in the request URL.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import plivo
    
    client = plivo.RestClient(auth_id="<auth_id>", auth_token="auth_token")
    
    # Get MDR
    response = client.messages.get(message_uuid='d6d17dd2-b9fe-4cf8-acfd-c6a8b959ea38')
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    # Environment
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    # GET MDR
    begin
    response = api.messages.get("c9d8f08d-4f1f-4765-b7e4-83e0d35a36c5")
    puts response
    rescue PlivoRESTError => e
        puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    let plivo = require('plivo')
    
    let client = new plivo.Client('<auth_id>','<auth_token>');
    
    // Get MDR
    client.messages.get("62085fe8-9b8a-4c9d-9527-5996e94333ab")
    .then(function(response) {
        console.log(response);
    }).catch(function(error) {
        console.log(error);
    });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    // ENVIORNMENT
    $client = new RestClient("<auth_id>", "<auth_token>");
    
    // Get MDR
    try {
        $response = $client->messages->get('c9d8f08d-4f1f-4765-b7e4-83e0d35a36c5');
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    package com.plivo.examples;
    import java.io.IOException;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.models.message.Message;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.exceptions.PlivoValidationException;
    
    public class Sample {
    
    	public static void main(String[] args) throws PlivoValidationException {
            Plivo.init("<auth_id>", "<auth_token>");
    
            // Get MDR
    		try {
    		Message response = Message.getter("62085fe8-9b8a-4c9d-9527-5996e94333ab").get();		
    		System.out.println(response);
    		} catch (PlivoRestException | IOException e) {
    			e.printStackTrace();
    		}
        }
    }
    

    Was this code helpful

    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
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace dotnet_sdk
    {
        class Sms
        {
            static void Main(string[] args)
            {
                // ENVIRONMENT
                var api = new PlivoApi("<auth_id>","<auth_token>");
    
                // Get MDR
                try
                {   
                    Console.WriteLine("Get MDR");
                    var response = api.Message.Get(
                    messageUuid: "d6af1134-ab76-11ed-bf27-0242ac110003"
                );
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
    
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user auth_id:auth_token \
        https://api.plivo.com/v1/Account/{auth_id}/Message/{message_uuid}/
    

    Was this code helpful

    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
    
    package main
    
    import (
    	"fmt"
    
    	plivo "github.com/plivo/plivo-go"
    )
    
    func main() {
    
    	// ENVIRONMENT
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>",
    		&plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    
    	// GET MDR
    	response, err := client.Messages.Get("e0f9ab26-bec2-4f21-b1f0-47014e15e268")
    	if err != nil {
    		panic(err)
    	}
    	fmt.Printf("Response: %#v\n", response)
    
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "api_id": "85a704c8-e47a-11eb-9a69-0242ac110004",
        "carrier_fees": "0.04",
        "carrier_fees_rate": "0.04",
        "error_code": "000",
        "from_number": "17087654321",
        "is_domestic": "false",
        "mcc": "312",
        "message_direction": "outbound",
        "message_state": "delivered",
        "message_time": "2021-07-13 13:04:06.799021+05:30",
        "message_type": "sms",
        "message_uuid": "b48d95dc-e3ac-11eb-a9c2-0242ac110005",
        "mnc": "650",
        "powerpack_id": "1d5f3dd8-b207-4738-b59f-3c2ac7d3461c",
        "resource_uri": "/v1/Account/{auth_id}/Message/b48d95dc-e3ac-11eb-a9c2-0242ac110005/",
        "to_number": "12401234567",
        "total_amount": "0.00140",
        "total_rate": "0.00140",
        "tendlc_campaign_id": "CD4WJJD",
        "tendlc_registration_status": "registered",
        "destination_country_iso2": "US",
        "units": 1,
        "replaced_sender": "17087654321",
        "is_domestic": false,
        "dlt_entity_id": "",
        "dlt_template_id": "",
        "dlt_template_category": "",
        "requester_ip": "192.168.0.1",
        "destination_network": "verizon", 
        "conversation_id": "2b89d38b573b5ca0a1e85ba3b8d159fc",
        "conversation_origin": "authentication",
        "conversation_expiration_timestamp": "2024-02-13 01:21:00-08:00", 
        "log": "number_only"
    
    }
    

    List all messages

    This API retrieves a list of Message Detail Records (MDR) based on a filter criteria over the last 90 days.

    Note: The default rate limit for this API is 20 requests per minute. If the rate limit is exceeded, the following error would be thrown: "too many requests"

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Message/

    Arguments

    subaccount string

    Filters for

    • Outbound messages sent using a specific subaccount’s Auth Token.
    • Inbound messages received on a phone number associated with a specific subaccount.
    Note: The subaccount filter is implicitly applied when a subaccount’s API credentials are used to fire this API. This argument should be used only when the parent account’s API credentials are used to fire this API.
    message_direction string

    Filters the results by message direction. Allowed values: inbound, outbound

    message_time

    Filters outbound and inbound messages based on the time the message was initiated or received.

    Timestamps are expected to be in YYYY-MM-DD HH:MM[:ss[.uuuuuu]] format, and are considered to be in UTC time zone.

    If you do not specify this attribute, the MDR for the last 24 hours will be retrived by default.

    The filter can be used in five forms:

    • message_time: Use this argument to filter for messages by exact timestamp. The format expected is YYYY-MM-DD HH:MM:ss:uuuuuu. To get all messages that were sent or received at 2021-03-21 11:47:30.982811, use message_time=2021-03-21 11:47:30.982811

    • message_time__gt: gt stands for greater than. Use this argument to filter for messages sent or received after a given time. To get all messages that were sent or received after 2021-03-21 11:47, use message_time__gt=2021-03-21 11:47

    • message_time__gte: gte stands for greater than or equal to. To get all messages that were sent or received after or exactly at 2021-03-21 11:47[:30], use message_time__gte=2021-03-21 11:47[:30]

    • message_time__lt: lt stands for less than. Use this argument to filter for messages sent or received before a given time. To get all messages that were sent or received before 2021-03-21 11:47, use message_time__lt=2021-03-21 11:47

    • message_time__lte: lte stands for less than or equal to. To get all messages that were sent or received before or exactly at 2012-03-21 11:47[:30], use message_time__lte=2012-03-21 11:47[:30]

    Note: You can combine the above filters to get messages that were sent or received in a particular time range.
    message_state string

    Filter results by the current status of a message.

    Allowed values: queued, sent, failed, delivered, undelivered, received, rejected

    message_type string

    Filter results by the type of message.

    Allowed values: sms, mms, whatsapp

    error_code string

    Filter results by a standard Plivo error code.

    powerpack_id string

    Filter results based on messages sent using a specific Power pack.

    from_number string

    Filters results by the number or sender ID from which the messages were sent using Plivo APIs. You can filter the details by using the exact number in E.164 format — for example, +12025551212 — or the exact sender ID.

    to_number string

    Filters results by the number to which messages were sent using Plivo APIs. You can filter the details by using the exact number in E.164 format — for example, +12025553434.

    limit integer

    Denotes the number of results per page. The maximum number of results that can be fetched is 20.

    Defaults to 20.

    offset integer

    Denotes the number of value items by which the results should be offset. Defaults to 0. Read more about offset-based pagination.

    destination_country_iso2 string

    Filters results by the ISO2 code of the country associated with the destination number.

    tendlc_registration_status string

    Filters results by the 10DLC registration status of the message. Only relevant for long code messaging in the US.

    tendlc_campaign_id string

    Filters results by the 10DLC campaign ID associated with the message. Only relevant for long code messaging in the US.
    conversation_id string Filters results by the WhatsApp conversation ID. 
    conversation_origin string

    Filters results by the WhatsApp Conversation Origin (Conversation type). 

    Possible values: utility, authentication, marketing, service

    Returns

    This API returns a list of Message Detail Records matching the filters specified in the request.

    The API response also contains a meta field with the fields:

    • limit: the size of the page returned in the response
    • offset: the offset for the page returned in the response
    • next: the URL that points to the next page of results
    • previous: the URL that points to the previous page of results

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import plivo
    
    client = plivo.RestClient(auth_id="<auth_id>", auth_token="auth_token")
    
    # List MDR
    response = client.messages.list(limit=1,offset=0)
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    # Environment
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    # GET MDR
    begin
    response = api.messages.get("c9d8f08d-4f1f-4765-b7e4-83e0d35a36c5")
    puts response
    rescue PlivoRESTError => e
        puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    let plivo = require('plivo')
    
    let client = new plivo.Client('<auth_id>','<auth_token>');
    
    // List MDR
    client.messages.list()
    .then(function(response) {
        console.log(response);
    }).catch(function(error) {
        console.log(error);
    });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    // ENVIORNMENT
    $client = new RestClient("<auth_id>", "<auth_token>");
    
    // List all Messages
    try {
        $response = $client->messages->list(['limit' => 1,'offset' => 0]);
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    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
    32
    33
    
    package com.plivo.examples;
    import java.io.IOException;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.models.message.Message;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.exceptions.PlivoValidationException;
    
    public class Sample {
    
    	public static void main(String[] args) throws PlivoValidationException {
            Plivo.init("<auth_id>", "<auth_token>");
    
            // List MDR
    		try
    	        {
    	            ListResponse<Message> response = Message.lister()
    	                    .limit(2)
    	                    .offset(0)
    	                    .list();
    
    	            List<Message>  res = response.getObjects();
    	            for (int i = 0; i < res.size(); i++) {
    	                System.out.println(res.get(i));
    	            }
    	        }
    	        catch (Exception e)
    	        {
    	            e.printStackTrace();
    	        }
    		
        }
    }
    

    Was this code helpful

    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
    32
    33
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace dotnet_sdk
    {
        class Sms
        {
            static void Main(string[] args)
            {
                // ENVIRONMENT
                var api = new PlivoApi("<auth_id>","<auth_token>");
    
                // List all Message Detail
                try
                {   
                    Console.WriteLine("List all Messages");
                    var response = api.Message.List(
                        limit:1,
                        offset:0
                        // subaccount:"subaccount_auth_id"
                    );
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
    
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user auth_id_ID:auth_token \
        https://api.plivo.com/v1/Account/{auth_id}/Message/
    

    Was this code helpful

    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
    
    package main
    
    import (
    	"fmt"
    
    	plivo "github.com/plivo/plivo-go"
    )
    
    func main() {
    
    	// ENVIRONMENT
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>",
    		&plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    
    	// List all Messages
    	response, err := client.Messages.List(
    		plivo.MessageListParams{
    			Limit:  1,
    			Offset: 0,
    		})
    	if err != nil {
    		panic(err)
    	}
    	fmt.Printf("Response: %#v\n", response)
    
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
       "Api_id":"f237ffbd-e1b1-4bd3-a2cb-874hebb",
       "meta":{
          "limit":1,
          "offset":0,
          "next":"/v1/Account/<AUTH_ID>/Message/?limit=1&offset=1",
          "previous":null
       },
       "objects":[
          {
             "message_uuid":"63f0462e-d744-453d-a387-d8e8e7e7ee",
             "from_number":"15732556666",
             "to_number":"12017138888",
             "message_direction":"outbound",
             "message_state":"sent",
             "message_time":"2023-10-18 17:27:36.499871+05:30",
             "message_type":"sms",
             "total_amount":"0.02600",
             "total_rate":"0.02600",
             "units":1,
             "mcc":"312",
             "mnc":"650",
             "error_code":"000",
             "resource_uri":"/v1/Account/<AUTH_ID>/Message/63f0462e-d744-453d-a387-dc4ad0aadff5/",
             "carrier_fees":"0.01000",
             "carrier_fees_rate":"0.01000",
             "powerpack_id":"31dbf456-b639-4d06-afc9-6b5hryr7r7r7",
             "tendlc_campaign_id":null,
             "tendlc_registration_status":"not_applicable",
             "destination_country_iso2":"US",
             "is_domestic":false,
             "requester_ip":"52.8.218.266",
             "replaced_sender":"15732554678",
             "conversation_id":"",
             "conversation_origin":"",
             "conversation_expiration_timestamp":"",
             "dlt_entity_id":"",
             "dlt_template_id":"",
             "dlt_template_category":"",
             "destination_network":"Level3",
             "log": "number_only"
          }
       ]
    }
    

    List MMS Media by Message UUID

    Lists the media files sent or received with an MMS message.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Message/{message_uuid}/Media/

    Arguments

    No arguments need to be passed.

    Returns

    This API call returns the list of media files associated with the MMS message identified by the message_uuid specified in the request URL.

    Example Request

    1
    2
    3
    4
    5
    6
    
    import plivo
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    
    response = client.messages.get(message_uuid="your_message_uuid").listMedia()
    print str(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    
    begin
        response = api.messages.get('your_message_uuid').listMedia()
        puts response
       rescue PlivoRESTError => e
        puts 'Exception: ' + e.message
       End
       
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    let plivo = require('plivo');
    let client = new plivo.Client('auth_id', 'auth_token');
    
    let optionalParams = {};
    client.messages.get("your_message_uuid").then(function (message) {
        return client.messages.listMedia(message.messageUuid)
      })
      .then(function (result) {
        console.log("\n============ list Media ===========\n", result)
      })
      .catch(function (response) {
        console.log("\n============ Error :: ===========\n", response);
      });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>","<auth_token>");
    
    $response = $client->messages->get('your_message_uuid')->listMedia();
    print_r($response);
    
    ?>
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    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.MmsMedia;
    
    public class Test {
        public static void main(String[] args) {
          Plivo.init("<auth_id>", "<auth_token>");
    
          try {
            ListResponse<MmsMedia>  response = MmsMedia.listMedia("<message_uuid>").list();
              System.out.println(response);
            } 
            
          catch (PlivoRestException | IOException e) {
            e.printStackTrace();
          }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    
    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.Get("your_message_uuid").ListMedia();
                   Console.WriteLine(response);
            }
        }
    }    
    

    Was this code helpful

    1
    2
    
    curl -i --user auth_id:auth_token \
        https://api.plivo.com/v1/Account/{auth_id}/Message/{message_uuid}/Media/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    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.ListMedia("your_message_uuid")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
      "api_id": "035eeada-6df1-11e6-b608-06a72a185e87",
      "objects": [
          {
              "content_type": "application/pdf",
              "media_id": "0178eb8a-461a-4fd1-bc37-13eebfdc0676",
              "media_url": "https://media.plivo.com/Account/{auth_id}/Message/24d742b9-9b12-4397-93a7-da496bc874d9/Media/0178eb8a-461a-4fd1-bc37-13eebfdc0676",
              "message_uuid": "24d742b9-9b12-4397-93a7-da496bc874d9",
              "size": 433994
          }
      ]
    }
    

    Message Status Callbacks

    The recommended way to keep track of the status of your outbound messages is to set up a server endpoint to receive status update events in real time.

    Once you’ve configured this endpoint, specify its url and HTTP method in the Send Message API request. Plivo will call this endpoint with the latest message details as and when the message status changes.

    Attributes

    These message attributes are passed to the status update URL with every status change event. They’re passed as form data if the method configured is POST, and as query parameters if it’s GET.

    MessageUUID

    The unique ID for the message.

    To

    Phone number of the recipient.

    From

    The sender ID used as the source address for the message.

    Type

    The type of message.

    Allowed values: sms, mms, whatsapp

    Status

    Status of the message.

    Allows values: queued, sent, failed, delivered, undelivered, read (WhatsApp only)

    ConversationExpirationTimestamp

    WhatsApp-only attribute.

    Unix timestamp when the current ongoing conversation expires.

    ConversationOrigin

    WhatsApp-only attribute

    Describes how the WhatsApp conversation was initiated.

    Allowed values: utility, authentication, marketing, service

    utility, authentication, and marketing conversations are initiated when a business sends a message to users using a template fromthe respective category.

    service conversations are initiated when a user sends a message to the business.

    ConversationID

    WhatsApp-only attribute.

    Represents a unique identifier ID for a conversation to which the message belongs. Can be null for inbound messages.

    Units

    Number of units into which a long SMS message was split.

    TotalRate

    The charge applicable per outbound SMS unit.

    TotalAmount

    Total charge for sending the SMS (TotalRate * number of Units)

    MCC

    Mobile Country Code of the To number.

    MNC

    Mobile Network Code of the To number. (See here for more details)

    ErrorCode

    The Plivo error code that identifies the reason for the message delivery failure. This parameter is only defined for “failed” or “undelivered” messages.

    ParentMessageUUIDreserved for future use

    Same as the MessageUUID. This parameter is reserved for future use, and should be ignored for now.

    PartInforeserved for future use

    This parameter is reserved for future use, and should be ignored for now.

    Sequence

    Use this attribute to track the sequence in which callbacks for this SMS were generated by the Plivo system.

    MessageTime

    The timestamp at which the SMS was initiated. Format: YYYY-mm-dd HH:MM:SS.SSSSSS

    QueuedTime

    The timestamp at which the SMS was queued. Format: YYYY-mm-dd HH:MM:SS.SSSSSS

    SentTime

    The timestamp at which the SMS was submitted to the downstream carrier for delivery. Format: YYYY-mm-dd HH:MM:SS.SSSSSS

    DeliveryReportTime

    The timestamp at which the delivery report for this SMS was received from the downstream carrier. Format: YYYY-mm-dd HH:MM:SS.SSSSSS

    RequesterIP The IP address from which the message request originated. We recommend you monitor this field to identify possible account misuse and authentication credential takeovers.
    PowerpackUUID

    The SMS Powerpack UUID used for the message. This will be empty if a Powerpack was not used.

    Handling incoming SMS/MMS/WhatsApp

    Plivo forwards incoming messages to the message_url configured for the application associated with the phone number on which the message was received.

    Certain values provided in the list of attributes below will be posted to your callback based on the number type (long code, toll-free, or short code) and message type (SMS or MMS). We’ve updated the availability of these attributes under the name attribute.

    Note: LC — long code, TF — toll-free, SC — short code

    Attributes

    MessageUUID SMS, MMS, WhatsApp LC, TF, SC

    The unique identifier for the message.

    From SMS, MMS, WhatsApp LC, TF, SC

    The source number of the incoming message — the phone number from which the message originated.

    To SMS, MMS, WhatsApp LC, TF, SC

    The Plivo number on which the message was received.

    Text SMS LC, TF, SC

    The content of the message. Note that Plivo automatically concatenates multipart long messages before forwarding them to your message_url.

    Body MMS, WhatsApp LC, TF

    The text content (if any) in the multimedia message (MMS). Together, Body and Media should not exceed 5MB.

    For WhatsApp, any inbound text content (with or without media).

    Type SMS, MMS, WhatsApp LC, TF, SC

    Allowed values:  sms, mms, whatsapp
    Defaults to sms.

    Units SMS, MMS LC, TF, SC

    The number of parts in which the incoming message was received. This is > 1 for multipart long messages.

    For whatsapp, this is always 1.

    TotalRate SMS, MMS, WhatsApp LC, TF, SC

    The charge applicable per incoming message unit.

    TotalAmount SMS, MMS, WhatsApp LC, TF, SC

    The total charge for receiving the SMS (TotalRate * number of Units).

    ContentType WhatsApp

    Specifies the content type of inbound WhatsApp message. Allowed values: text, media, button, unknown

    MimeType WhatsApp

    Valid for inbound WhatsApp media only. Specifies the type of media file — for example, video/mp4.

    ErrorCode WhatsApp,MMS LC, TF

    The Plivo error code that identifies the reason for inbound message delivery failure.

    This parameter is only defined for failed or undelivered messages.

    Context WhatsApp

    Json object. An object containing the ID of a previous message to which you are replying.

    Example -

    “Context”:{
    "MessageUUID":"1Aff6e1cc-1d26-42a0-ba55-b748fc8013d"
    }

    Button WhatsApp

    Json object. This is present when the ContentType is button.

    Contains two fields -

    Text - Display text on the button you have configured in the template

    Payload - Developer-defined payload that is returned when the button is clicked in addition to the display text on the button.

    Example -

    "Button":{
    "Text":"Yes",
    "Payload":"Yes-Button-Payload"
    }

    MessageIntent SMS LC, TF

    Set to optout if the incoming message matches with one of the standard opt-out keywords. Set to optin if the incoming message matches with one of the standard opt-in keywords. Set to help if the incoming message matches with one of the standard help keywords. Left blank in all other cases.

    PowerpackUUID SMS, MMS LC, TF, SC

    The UUID of the Powerpack associated with the To phone number. If the phone number does not belong to a Powerpack, this field is empty.

    MediaCount MMS LC, TF

    The number of media files attached with this MMS message.

    Media<count> ex: Media1, Media2 ... MMS LC, TF

    The URL to a specific media file associated with the MMS message. The integer suffixes range from 1 to the count of media files received.

    Replying to an incoming message

    You can reply to an incoming message (except for WhatsApp) by returning a Plivo Message XML element in the response to the incoming request.

    Set the response Content-Type to application/xml.

    Compliance

    10DLC

    Plivo’s 10DLC APIs let you automate the 10DLC registration process and eliminate the need for manual data entry on the console. The process has four steps: create a profile, register a brand using the profile, add campaigns to the brand, and link numbers to campaigns.

    API Endpoint

    POST https://api.plivo.com/v1/Account/{auth_id}/10dlc/

    Profile

    Create a profile object to provide details about your company to Plivo. You can use the profile to create 10DLC brands for messaging customers.

    API Endpoint

    BaseURI https://api.plivo.com/v1/Account/{auth_id}/Profile/

    The Profile object

    Attributes

    profile_uuid A unique identifier for each profile.
    profile_type Indicates whether this is a primary or secondary profile.
    primary_profile A unique identifier for the account’s primary profile.
    profile_alias A friendly name for the profile.
    customer_type Indicates the nature of your operations and how you use Plivo’s voice and messaging offerings.
    entity_type Indicates ownership of the business.
    company_name Legal name of the company.
    vertical Company industry.
    ein Employer Identification Number.
    ein_issuing_country ISO country code of the country that issued the EIN.
    address Postal address of the company.
    authorized_contact Details of the authorized contact person at the company.
    stock_symbol Stock symbol of the company.
    stock_exchange Stock exchange where the company is listed.
    alt_business_id Alternate business identification number.
    alt_business_id_type Alternate business ID type.
    website Business website.
    plivo_subaccount Subaccount mapped to the profile.

    Example Object

    {
        "profile": {
            "address": {
                "city": "New York",
                "country": "US",
                "postal_code": "10001",
                "state": "NY",
                "street": "123"
            },
            "alt_business_id": "ABC",
            "alt_business_id_type": "DUNS",
            "authorized_contact": {
                "email": "john@example.com",
                "first_name": "john",
                "last_name": "doe",
                "phone": "12125557777",
                "seniority": "admin",
                "title": "Doe"
            },
            "company_name": "ABC Inc.12345",
            "customer_type": "RESELLER",
            "ein": "12125552222",
            "ein_issuing_country": "US",
            "entity_type": "PUBLIC",
            "plivo_subaccount": "SA2025RK4E639VJFZAMM",
            "primary_profile": "c780f9d0-e3c9-4d13-87f7-b898654569b0",
            "profile_alias": "john_doe",
            "profile_type": "SECONDARY",
            "profile_uuid": "f19c4773-4ae6-4b75-92ea-9cf3ea4227d6",
            "stock_exchange": "NYSE",
            "stock_symbol": "HIBYE",
            "vertical": "ENTERTAINMENT",
            "website": "hibye.com"
        }
    }
    
    

    Create a profile

    This API lets you create a business profile for your end customers.

    API Endpoint

    POST https://api.plivo.com/v1/Account/{auth_id}/Profile/

    Arguments

    profile_aliasstringrequired

    A friendly name for your profile.

    customer_typestringrequired

    Indicates the nature of your operations.

    Allowed values: DIRECT, RESELLER.

    Select RESELLER if your business provides communication services such as messaging and voice calling to other businesses.

    entity_typestringrequired

    Indicates ownership of the company.

    Allowed values: PRIVATE, PUBLIC, NON_PROFIT, GOVERNMENT, INDIVIDUAL.

    company_namestringrequired

    Legal name of the company.

    vertical stringrequired

    Indicates industry.

    Allowed values: PROFESSIONAL, REAL_ESTATE, HEALTHCARE, HUMAN_RESOURCES, ENERGY,ENTERTAINMENT, RETAIL, TRANSPORTATION,AGRICULTURE,INSURANCE,POSTAL,EDUCATION,HOSPITALITY, FINANCIAL, POLITICAL, GAMBLING, LEGAL, CONSTRUCTION, NGO, MANUFACTURING, GOVERNMENT, TECHNOLOGY, COMMUNICATION

    ein integer

    Employer Identification Number.

    Plivo strongly recommends providing your EIN if your company is registered to unlock premium features like high throughput for Plivo products.

    ein_issuing_countrystring

    The ISO country code of the country that issued the EIN.

    address objectrequired

    Valid postal address of the company.

    {
    "street": "",
    "city": "",
    "state": "",
    "postal_code": "",
    "country": ""

    }

    state: A valid state code, e.g. TX for Texas.
    postal_code: ZIP code.
    country: ISO alpha-2 country code (US).

    authorized_contact objectrequired

    Authorized contact person at the company.

    "first_name": "John",
    "last_name": "Doe",
    "email": "john@example.com",
    "title": "Mr",
    "seniority": "admin",
    "phone": ""

    Fields first_name and last_name are free-form.

    email: Email address.
    title: Salutation of the contact at the given company.
    seniority: Allowed values: DIRECTOR, GM, VP, CEO, CFO, GENERAL_COUNSEL, OTHER.
    phone: Company phone number in E.164 format.
    stock_symbol string

    Stock symbol of the company.

    stock_exchange enum

    Stock exchange where your company is listed.

    Allowed values: NASDAQ, NYSE, AMEX, AMX, ASX, B3, BME, BSE, FRA, ICEX ,JPX, JSE, KRX ,LON, NSE, OMX, SEHK, SGX, SSE, STO, SWX, SZSE, TSX ,TWSE, VSE, OTHER

    alt_business_id string

    Alternate business identification number.

    alt_business_id_type enum

    Alternate business ID type.

    Allowed values: DUNS, LEI, GIIN, NONE

    website string

    Website of the business.

    plivo_subaccount string

    Subaccount mapped to the profile.

    Create a profile — individuals

    If you use the Create a Profile API and specify entity_type=INDIVIDUAL you can skip fields like ein, ein_issuing_country, stock_symbol, stock_exchange, alt_business_id, and alt_business_id_type.

    Returns

    api_id for the request, unique profile_uuid, and success message

    Example Request

    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
    32
    33
    34
    35
    36
    
    import sys
    sys.path.append("../plivo-python")
    import plivo
    
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.profile.create(
        profile_alias="profile name sample",
        customer_type="DIRECT",
        entity_type="PRIVATE",
        company_name="ABC Inc.",
        ein="123456789",
        ein_issuing_country="US",
        stock_symbol="ABC",
        stock_exchange="NSE",
        website="www.example.com",
        vertical="REAL_ESTATE",
        alt_business_id="",
        alt_business_id_type="NONE",
        plivo_subaccount="",
        address={
            "street": "123",
            "city": "New York",
            "state": "NY",
             "postal_code": "10001",
            "country": "US"
        },
        authorized_contact={
            "first_name": "john",
            "last_name": "con",
            "phone": "1876865565",
            "email": "xyz@plivo.com",
            "title": "Mr",
            "seniority": "admin"
        },
    )
    print(response)
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
            # Create Profile
            puts('Create Profile')
    
            authorized_contact_data = {
                    "first_name" => "ruby",
                    "last_name" => "test-1",
                    "email" => "vlc@gmail.com",
                    "title" => "Mr.",
                    "seniority" => "admin",
                    "phone" => "919539113734",
            }
        address_data = {
                    "street" => "Street Name",
                    "city" => "City Name",
                    "state" => "NY",
                    "postal_code" => "10001",
                    "country" => "US"
            }
    
            response = api.profile.create(  profile_alias: "pa1", 
                    customer_type: "DIRECT",
                    entity_type: "PRIVATE",
                    company_name: "vlc",
                    vertical: "ENERGY",
                    stock_symbol: "NSE",
                    stock_exchange: "NASDAQ",
                    alt_business_id: "NONE",
                    alt_business_id_type: "NONE",
                    ein: "123456789",
                    ein_issuing_country: "IN",
                    website: "www.vlc.com",
                    address: address_data,
                    authorized_contact: authorized_contact_data
            )
        puts response
    rescue PlivoRESTError => e
            puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    
    let plivo = require('plivo');
    
    var authorized_contact = {
        "first_name": "John",
        "last_name": "Doe",
        "email": "john@example.com",
        "title": "manager",
        "seniority": "admin",
        "phone": "+12125551234"
    }
    var address = {
        "street": "660 Broadway",
        "city": "New York City",
        "state": "NY",
        "postal_code": "10001",
        "country": "US"
    }
    var client = new plivo.Client("<auth_id>", "<auth_token>");
    client.profile.create(
        "my_profile", // profile_alias
        "SA2025RK4E639VJFZAMS", // plivo_subaccount 
        "DIRECT", // customer_type
        "GOVERNMENT", // entity_type
        "ABC Inc", // compnay_name
        "111111111", // ein
        "PROFESSIONAL", // vertical
        "US", // ein_issuing_country
        "ABC", // stock_symbol
        "NASDAQ", // stock exchange
        "NONE", // alt_business_id_type
        "google.com", // website
        address,
        authorized_contact)
        .then(function (response) {
            console.log(response);
        })
        .catch(function (error) {
            console.log(error);
        });
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    
    <?php
    
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    
    $client
        ->client
        ->setTimeout(60);
    try
    {
        $authorized_contact = array(
            "first_name" => "John",
            "last_name" => "Doe",
            "email" => "john@example.com",
            "title" => "Mr",
            "seniority" => "admin",
            "phone" => "9381590950"
        );
        $address = array(
            "street" => "660 Broadway",
            "city" => "New York City",
            "state" => "NY",
            "postal_code" => "10001",
            "country" => "US"
        );
        $res = $client
            ->profile
            ->create("vishnu104", "", "DIRECT", "GOVERNMENT", "ABC Inc", "111111111", "PROFESSIONAL", "US", "ABC", "NASDAQ", "NONE", "google.com", $address, $authorized_contact);
        print_r($res);
    }
    catch(PlivoRestException $ex)
    {
        print_r($ex);
    }
    
    ?>
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    
    package com.plivo.examples;
    import com.plivo.api.Plivo;
    import com.plivo.api.models.profile.Profile;
    import com.plivo.api.models.profile.ProfileAddResponse;
    import com.plivo.api.models.profile.ProfileAddress;
    import com.plivo.api.models.profile.ProfileAuthorizedContact;
    
    
    public class PlivoTest  {
    
    
       public static void main(String[] args) {
    
    
           Plivo.init("<auth_id>","<auth_token>");
    
    
           // Create Profile
    
    
           ProfileAddress address = new ProfileAddress("street name", "New York", "NY", "123456", "US");
           ProfileAuthorizedContact authorizedContact = new ProfileAuthorizedContact("firstname",
                   "lastname",
                   "12017135399",
                   "test@plivo.com",
                   "Mr.",
                   "admin");
    
    
           try {
               ProfileAddResponse response = Profile.creator("profile_alias-1", "DIRECT", "PRIVATE", "Plivo Inc",
                       "12345678", "IN", address, "ABC",
                       "NSE", "www.javasdk.com",
                       "ENERGY", "", "", "",
                       authorizedContact).create();
               System.out.println(response);
           } catch (Exception e) {
               e.printStackTrace();
           }
       }
    }
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    
    // Available in versions >= 5.9.0 (https://github.com/plivo/plivo-dotnet/releases/tag/v5.9.0)
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    using Plivo.Resource.Profile;
    
    namespace dotnet_project
    {
        class Ten_dlc
        {
            static void Main(string[] args)
            {
    
                var api = new PlivoApi("<auth_id>", "<auth_token>");
    
                // Create a Profile
                try
                {
                    AuthorizedContact contact = new AuthorizedContact();
                    contact.Email = "john@example.com";
                    contact.Phone = "12025551234";
                    contact.FirstName = "John";
                    contact.LastName = "Doe";
                    contact.Seniority = "none";
                    contact.Title = "Mr";
                    Address address = new Address();
                    address.Street = "660 Broadway";
                    address.City = "New York";
                    address.PostalCode = "10001";
                    address.Country = "US";
                    var response = api.Profile.Create("john_profile_1", "", "RESELLER", "PUBLIC", "Company Name Inc",
                    "111111111", "PROFESSIONAL", "US", "ABC", "NASDAQ", "www.webistename.com", "NONE", contact, address);
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
    
            }
        }
    }
    

    Was this code helpful

    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
    32
    33
    34
    
    curl -i --user auth_id:auth_token \
        -H 'Content-Type: application/json' \
        -d '{
            "profile_alias": "john_new",
            "customer_type": "reseller",
            "entity_type": "public",
            "company_name": "ABC Inc.",
            "vertical": "Entertainment",
            "plivo_subaccount" :"SA2025RK4E639VJFZAMM",
            "ein": "122321231",
            "ein_issuing_country":"US", 
            "address": {
                "street": "660 Broadway",
                "city": "New York City",
                "state": "NY",
                "postal_code": "10001",
                "country": "US"
            },
            "stock_symbol": "TESLA",
            "stock_exchange": "NYSE",
            "alt_business_id_type": "DUNS",
            "alt_business_id": "ABC",
            "website": "hibye.com",
            "authorized_contact": {
                "first_name": "John",
                "last_name": "Doe",
                "email": "john@example.com",
                "title": "manager",
                "seniority": "admin",
                "phone": "12125551234"
            }
        
        }' \
        https://api.plivo.com/v1/Account/{auth_id}/Profile/
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    
    package main
    
    import (
            "fmt"
            "os"
    
            plivo "github.com/plivo/plivo-go/v7"
    )
    
    var client *plivo.Client
    
    func initClient(authID, authToken string) {
            var er error
            copts := &plivo.ClientOptions{}
            client, er = plivo.NewClient(authID, authToken, copts)
            if er != nil {
                    panic(er)
            }
    }
    func main() {
            initClient("<auth_id>", "<auth_token>")
            //Profile create
            input := plivo.CreateProfileRequestParams{
                    ProfileAlias:         "api_reference_go",
                    CustomerType:        "DIRECT",
                    EntityType:          "PRIVATE",
                    CompanyName:         "golang",
                    Vertical:             "ENERGY",
                    StockSymbol:         "NSE",
                    StockExchange:       "NASDAQ",
                    AltBusinessidType: "NONE",
                    Ein:                  "123456789",
                    EinIssuingCountry:  "IN",
                    Website:              "www.google.com",
                    Address: &plivo.Address{
                            Street:      "Street Name",
                            City:        "City Name",
                            State:       "NY",
                            PostalCode: "10001",
                            Country:     "US",
                    },
                    AuthorizedContact: &plivo.AuthorizedContact{
                            FirstName: "goes",
                            LastName:  "lang",
                            Email:      "vlc@gmail.com",
                            Title:      "Mr.",
                            Seniority:  "admin",
                            Phone:      "919381590950",
                    },
            }
            response, err := client.Profile.Create(input)
            if err != nil {
                    fmt.Printf("Error occurred while creating profile. error:%+v\n", err)
                    os.Exit(1)
            } else {
                    fmt.Printf("%+v\n", response)
            }
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "api_id": "4e1f954c-baf3-11ec-bafe-0242ac110003",
        "message": "Profile created successfully.",
        "profile_uuid": "f19c4773-4ae6-4b75-92ea-9cf3ea4227d6"
    }
    

    Retrieve all profiles

    This API lets you fetch all profiles created by your account.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Profile/

    Arguments

    limitinteger

    Denotes the number of results per page. The maximum number of results that can be fetched is 20.

    Defaults to 20.

    offset integer

    Denotes the number of value items by which the results should be offset. Defaults to 0. Read more about offset-based pagination.

    entity_typestring

    Filter by entity_type.

    Allowed values: PRIVATE, PUBLIC, NON_PROFIT, GOVERNMENT, INDIVIDUAL.

    typestring

    Filter by profile_type.

    Allowed values: PRIMARY, SECONDARY.

    verticalstring

    Filter by vertical.

    Allowed values: PROFESSIONAL,REAL_ESTATE, HEALTHCARE, HUMAN_RESOURCES, ENERGY, ENTERTAINMENT, RETAIL, TRANSPORTATION,AGRICULTURE, INSURANCE, POSTAL, EDUCATION, HOSPITALITY, FINANCIAL, POLITICAL, GAMBLING, LEGAL, CONSTRUCTION, NGO, MANUFACTURING, GOVERNMENT, TECHNOLOGY, COMMUNICATION.

    Returns

    api_id for the request and a dictionary with an objects property that contains a list of up to 20 profiles. Each tuple in the list is a separate profile object.

    Example Request

    1
    2
    3
    4
    5
    
    import plivo
    
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.profile.list(limit=1, offset=0)
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    	# List all Profiles
    	response = api.profile.list(limit: 10, offset: 0)
    
    	puts response
    rescue PlivoRESTError => e
    	puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    let plivo = require('plivo');
    
    var client = new plivo.Client("<auth_id>", "<auth_token>");
    client.profile.list({
        limit: 5,
        offset: 0,
    })
        .then(function (response) {
            console.log(response);
        })
        .catch(function (error) {
            console.log(error);
        });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    <?php
    
    # Available in versions >= 4.29.0 (https://github.com/plivo/plivo-php/releases/tag/v4.29.0)
    
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>","<auth_token>");
    
    
    
    $client->client->setTimeout(60);
    try {
        $res =  $client->profile->list();
         print_r( $res);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    
    ?>
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    package com.plivo.examples;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.models.profile.Profile;
    import com.plivo.api.models.base.ListResponse;
    
    public class PlivoTest {
    
        public static void main(String[] args) {
    
            Plivo.init("<auth_id>", "<auth_token>");
    
            // List all Profiles
            try {
                ListResponse < Profile > response = Profile.lister().limit(1).offset(0).list();
                System.out.println(response);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    using Plivo.Resource.Profile;
    
    namespace dotnet_project
    {
        class Ten_dlc
        {
            static void Main(string[] args)
            {
    
                var api = new PlivoApi("<auth_id>", "<auth_token>");
    
                // List Profiles
                try
                {
                    var response = api.Profile.List();
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
    
    
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user auth_id:auth_token \
        https://api.plivo.com/v1/Account/{auth_id}/Profile/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    package main
    
    import (
    	"fmt"
    	"os"
    
    	plivo "github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    	//List Profiles
    	response, err := client.Profile.List(plivo.ProfileListParams{Limit: 2, Offset: 0})
    	if err != nil {
    		fmt.Printf("Error occurred while getting profiles error:%+v\n", err)
    		os.Exit(1)
    	} else {
    		fmt.Printf("%+v\n", response)
    	}
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
       "api_id":"837b1e38-68a1-4fd6-a532-ea4jj888uuhh",
       "meta":{
          "limit":1,
          "offset":0,
          "next":"/v1/Account/<AUTH_ID>/Profile/?limit=1&offset=1",
          "previous":null
       },
       "profiles":[
          {
             "profile_uuid":"7a799f1a-5f44-43fb-ac82-999uujnnhhy",
             "profile_alias":"sample name",
             "profile_type":"SECONDARY",
             "primary_profile":"a7fe9aa3-dbca-401e-80a2-f88dudhdbhd",
             "customer_type":"DIRECT",
             "entity_type":"PRIVATE_PROFIT",
             "company_name":"Name of Company",
             "ein":"111111111",
             "ein_issuing_country":"US",
             "address":{
                "street":"5d807cf24ada0f",
                "city":"New York",
                "state":"NY",
                "postal_code":"10001",
                "country":"US"
             },
             "website":"www.example.com",
             "vertical":"COMMUNICATION",
             "plivo_subaccount": "SAXXXXX",
             "stock_symbol": "NSQ",
             "stock_exchange": "NASDAQ",
             "alt_business_id": "ABC",
             "alt_business_id_type": "DUNS",
             "authorized_contact":{
                "first_name":"First Name",
                "last_name":"Last Name",
                "phone":"919033998877",
                "email":"xxxxxxxx@plivo.com",
                "title":"Manager",
                "seniority":"Mr."
             },
             "created_at":"2023-10-17T20:57:54.164054Z"
          }
       ]
    }
    

    Retrieve a specific profile

    This API lets you fetch details about a specific profile_id associated with an account.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Profile/{profile_uuid}/

    Arguments

    No arguments need to be passed.

    Returns

    api_id and the profile object identified by the profile_id specified in the request URL.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import sys
    sys.path.append("../plivo-python")
    import plivo
    
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.profile.list(limit=1, offset=0)
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    # List all Profiles
    puts('List all Profiles')
    response = api.profile.list(limit: 10, offset: 0)
    
    puts response
    rescue PlivoRESTError => e
    puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    let plivo = require('plivo');
    
    var client = new plivo.Client("<auth_id>", "<auth_token>");
    client.profile.get("<profile_uuid>")
        .then(function (response) {
            console.log(response);
        })
        .catch(function (error) {
            console.log(error);
        });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    <?php
    
    # Available in versions >= 4.29.0 (https://github.com/plivo/plivo-php/releases/tag/v4.29.0)
    
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    
    
    
    $client->client->setTimeout(60);
    try {
        $res =  $client->profile->list();
         print_r( $res);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    
    ?>
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    package com.plivo.examples;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.models.profile.Profile;
    
    public class PlivoTest {
    
        public static void main(String[] args) {
    
            Plivo.init("<auth_id>", "<auth_token>");
    
            try {
                Profile response = Profile.getter("<Profile_UUID>").get();
                System.out.println(response);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    32
    
    // Available in versions >= 5.9.0 (https://github.com/plivo/plivo-dotnet/releases/tag/v5.9.0)
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    using Plivo.Resource.Profile;
    
    namespace dotnet_project
    {
        class Ten_dlc
        {
            static void Main(string[] args)
            {
     
                  var api = new PlivoApi("<auth_id>","<auth_token>");
    
                 // Get a Profile
                try
                {
                    var response = api.Profile.Get("f8ca5a50-50b8-438d-8068-28427b1c0e90");
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
    
                    
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user auth_id:auth_token \
        https://api.plivo.com/v1/Account/{auth_id}/Profile/{profile_uuid}/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    package main
    
    import (
    	"fmt"
    	"os"
    
    	plivo "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.Profile.Get("<Profile UUID>")
    	if err != nil {
    		fmt.Printf("Error occurred while getting Profile error:%+v\n", err)
    		os.Exit(1)
    	} else {
    		fmt.Printf("%+v\n", response)
    	}
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "api_id": "752e99d0-baf3-11ec-ac74-0242ac110002",
        "profile": {
            "address": {
                "city": "New York",
                "country": "US",
                "postal_code": "10001",
                "state": "NY",
                "street": "123"
            },
            "alt_business_id": "ABC",
            "alt_business_id_type": "DUNS",
            "authorized_contact": {
                "email": "john@example.com",
                "first_name": "john",
                "last_name": "doe",
                "phone": "12125557777",
                "seniority": "admin",
                "title": "Doe"
            },
            "company_name": "ABC Inc.12345",
            "customer_type": "RESELLER",
            "ein": "12125552222",
            "ein_issuing_country": "US",
            "entity_type": "PUBLIC",
            "plivo_subaccount": "SAXXXXX",
            "primary_profile": "c780f9d0-e3c9-4d13-87f7-b898654569b0",
            "profile_alias": "john_doe",
            "profile_type": "SECONDARY",
            "profile_uuid": "f19c4773-4ae6-4b75-92ea-9cf3ea4227d6",
            "stock_exchange": "NYSE",
            "stock_symbol": "HIBYE",
            "vertical": "ENTERTAINMENT",
            "website": "hibye.com"
        }
    

    Update a profile

    This API lets you update certain information in a profile.

    API Endpoint

    POST https://api.plivo.com/v1/Account/{auth_id}/Profile/{profile_uuid}/

    Arguments

    You can update only these fields of a profile. You can pass one or more of the fields during the update.

    entity_typestring

    Filter by entity_type.

    Allowed values: PRIVATE, PUBLIC, NON_PROFIT, GOVERNMENT, INDIVIDUAL.

    company_namestring

    Legal name of the company.

    verticalstring

    Filter by vertical.

    Allowed values: PROFESSIONAL ,REAL_ESTATE, HEALTHCARE, HUMAN_RESOURCES, ENERGY, ENTERTAINMENT, RETAIL, TRANSPORTATION,AGRICULTURE, INSURANCE, POSTAL, EDUCATION, HOSPITALITY, FINANCIAL, POLITICAL, GAMBLING, LEGAL, CONSTRUCTION, NGO, MANUFACTURING, GOVERNMENT, TECHNOLOGY, COMMUNICATION.

    address object

    Postal address of the company.

    authorized_contact object

    Details of the authorized contact person at the company. You must provide at least one contact.

    websitestring

    Business website.

    plivo_subaccountstring

    Subaccount mapped to the profile.

    Returns

    api_id for the request, the respective profile_uuid, and success message

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    
    import sys
    sys.path.append("../plivo-python")
    import plivo
    
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    param = {"company_name": "google", "website": "www.example.com"}
    response = client.profile.update("<profile_uuid>", param)
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    	# Update Profile
    	puts('Update Profile')
    	response=api.profile.update("<profile_uuid>", 
    		company_name: "Name of Company",
    	    website: "www.plivo.com");
    
    	puts response
    rescue PlivoRESTError => e
    	puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    let plivo = require('plivo');
    
    var params = { "company_name": "twitter.com" }
    var client = new plivo.Client("<auth_id>", "<auth_token>");
    client.profile.update("<profile_uuid>", params)
        .then(function (response) {
            console.log(response);
        })
        .catch(function (error) {
            console.log(error);
        });
    

    Was this code helpful

    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
    
    <?php
    
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    $client = new RestClient("<auth_id>", "<auth_token>");
    $address = array(
        "street" => "123",
        "city" => "Band",
        "state" => "NY",
        "postal_code" => "10008",
        "country" => "US"
    );
    
    $client
        ->client
        ->setTimeout(60);
    try
    {
        $res = $client
            ->profile
            ->update("<profile_uuid>", ['address' => $address, 'vertical' => "PROFESSIONAL"]);
        print_r($res);
    }
    catch(PlivoRestException $ex)
    {
        print_r($ex);
    }
    
    ?>
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    package com.plivo.examples;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.models.profile.Profile;
    
    public class PlivoTest {
    
        public static void main(String[] args) {
    
            Plivo.init("<auth_id>", "<auth_token>");
    
            // Update Profile
            try {
                Profile response = Profile.update("<Profile_UUID>")
                    .companyName("new company name")
                    .vertical("PROFESSIONAL")
                    .update();
                System.out.println(response);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    
    // Available in versions >= 5.9.0 (https://github.com/plivo/plivo-dotnet/releases/tag/v5.9.0)
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    using Plivo.Resource.Profile;
    
    namespace dotnet_project
    {
        class Ten_dlc
        {
            static void Main(string[] args)
            {
    
                var api = new PlivoApi("<auth_id>", "<auth_token>");
    
                // Update a Profile
                try
                {
                    AuthorizedContact contact = new AuthorizedContact();
                    contact.Email = "test@gmail.com";
                    Address address = new Address();
                    address.PostalCode = "560099";
                    var response = api.Profile.Update("f8ca5a50-50b8-438d-8068-28427b1c0e90", "Update Name");
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
    
    
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    
    curl -i --user auth_id:auth_token \
        -H 'Content-Type: application/json' \
        -d '{
            "vertical":"ENTERTAINMENT"    
        }' \
        https://api.plivo.com/v1/Account/{auth_id}/Profile/{profile_uuid}/
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    
    package main
    
    import (
            "fmt"
            "os"
    
            plivo "github.com/plivo/plivo-go/v7"
    )
    
    var client *plivo.Client
    
    func initClient(authID, authToken string) {
            var er error
            copts := &plivo.ClientOptions{}
            client, er = plivo.NewClient(authID, authToken, copts)
            if er != nil {
                    panic(er)
            }
    }
    
    func main() {
            initClient("<auth_id>", "<auth_token>")
            //Update Profile
            input := plivo.UpdateProfileRequestParams{
                    Website: "www.google1.com",
                    EntityType: "PRIVATE",
                    Address: &plivo.Address{
                            Street:      "Street Name",
                            City:        "City Name",
                            State:       "NY",
                            PostalCode: "10001",
                            Country:     "US",
                    },
            }
            response, err := client.Profile.Update("<profile_uuid>", input)
            if err != nil {
                    fmt.Printf("Error occurred while updating profile. error:%+v\n", err)
                    os.Exit(1)
            } else {
                    fmt.Printf("%+v\n", response)
            }
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "api_id": "752e99d0-baf3-11ec-ac74-0242ac110002",
        "profile": {
            "address": {
                "city": "New York",
                "country": "US",
                "postal_code": "10001",
                "state": "NY",
                "street": "123"
            },
            "alt_business_id": "ABC",
            "alt_business_id_type": "DUNS",
            "authorized_contact": {
                "email": "edith@example.com",
                "first_name": "edith",
                "last_name": "sam",
                "phone": "12125557778",
                "seniority": "admin",
                "title": "Sam"
            },
            "company_name": "ABC Inc.12345",
            "customer_type": "RESELLER",
            "ein": "12125552222",
            "ein_issuing_country": "US",
            "entity_type": "PUBLIC",
            "plivo_subaccount": "SA2025RK4E639VJFZAMM",
            "primary_profile": "c780f9d0-e3c9-4d13-87f7-b898654569b0",
            "profile_alias": "edith_sam",
            "profile_type": "SECONDARY",
            "profile_uuid": "f19c4773-4ae6-4b75-92ea-9cf3ea4227d6",
            "stock_exchange": "NYSE",
            "stock_symbol": "HIBYE",
            "vertical": "ENTERTAINMENT",
            "website": "hibye.com"
        }
    }
    

    Delete a profile

    This API lets you delete a particular profile from your account. This action is irreversible. You cannot delete the primary profile of an account.

    API Endpoint

    DELETEhttps://api.plivo.com/v1/Account/{auth_id}/Profile/{profile_uuid}/

    Arguments

    No arguments need to be passed.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import sys
    sys.path.append("../plivo-python")
    import plivo
    
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.profile.delete(profile_uuid="<profile_uuid>")
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    # Delete a Profile
    response = api.profile.delete("<profile_uuid>")
    
    puts response
    rescue PlivoRESTError => e
    puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    let plivo = require('plivo');
    
    var client = new plivo.Client("<auth_id>", "<auth_token>");
    client.profile.delete("<profile_uuid>")
        .then(function(response) {
            console.log(response);
        })
        .catch(function(error) {
            console.log(error);
        });
    

    Was this code helpful

    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
    
    <?php
    
    # Available in versions >= 4.29.0 (https://github.com/plivo/plivo-php/releases/tag/v4.29.0)
    
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    
    // delete Powerpack
    $client
        ->client
        ->setTimeout(60);
    try
    {
        // $res =  $client->profile->list();
        $res = $client
            ->profile
            ->delete("<profile_uuid>");
        print_r($res);
    }
    catch(PlivoRestException $ex)
    {
        print_r($ex);
    }
    
    ?>
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    package com.plivo.examples;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.models.profile.Profile;
    
    public class PlivoTest {
            
            public static void main(String[] args) {
            
                    Plivo.init("<auth_id>", "<auth_token>");
    
                    // Delete Profile
                    try
                    {
                            Profile response = Profile.delete("<Profile_UUID>").delete();
                            System.out.println(response);
                    }
                    catch (Exception e)
                    {
                            e.printStackTrace();
                    }
            }
    }
    

    Was this code helpful

    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
    32
    
    // Available in versions >= 5.9.0 (https://github.com/plivo/plivo-dotnet/releases/tag/v5.9.0)
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    using Plivo.Resource.Profile;
    
    namespace dotnet_project
    {
        class Ten_dlc
        {
            static void Main(string[] args)
            {
    
                var api = new PlivoApi("<auth_id>", "<auth_token>");
    
                // Delete a  Profile
                try
                {
                    var response = api.Profile.Delete("f8ca5a50-50b8-438d-8068-28427b1c0e90");
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
    
    
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -X DELETE -i --user auth_id:auth_token \
        https://api.plivo.com/v1/Account/{auth_id}/Profile/{profile_uuid}/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    package main
    
    import (
    	"fmt"
    	"os"
    
    	plivo "github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    	//Delete Profile
    	response, err := client.Profile.Delete("<Profile UUID>")
    	if err != nil {
    		fmt.Printf("Error occurred while deleting profile error:%+v\n", err)
    		os.Exit(1)
    	} else {
    		fmt.Printf("%+v\n", response)
    	}
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
    "api_id": "aaf7717a-c149-11ec-a932-0242ac110003",
    "message": "Profile deleted successfully."
    }
    

    Brand

    Use the brand endpoint to register a brand for your or your end customers’ businesses. Brand registration requires customers to have profile information; create a profile for the brand before you register it.

    API Endpoint

    BaseURI https://api.plivo.com/v1/Account/{auth_id}/10dlc/Brand/

    The Brand object

    Attributes

    address Postal address indicated during brand creation.
    authorized_contact Authorized contact information indicated during brand creation.
    brand_id Unique identifier for the brand created.
    brand_type Type of registration indicated during brand creation.
    company_name Legal name of the company
    ein Employer Identification Number associated with a Standard brand.
    ein_issuing_country ISO alpha-2 code for the country that issued the EIN.
    entity_type Type of ownership indicated during brand creation.
    profile_uuid Unique identifier for the profile used to create brand.
    registration_status Indicates status of brand.
    vertical Company industry.
    vetting_score Vetting score assigned to brand by TCR.
    vetting_status Vetting status of a brand.

    Example Object

    {
       "brand": {
           "address": {
               "city": "New York",
               "country": "US",
               "postal_code": "10001",
               "state": "NY",
               "street": "123"
           },
           "authorized_contact": {
               "email": "john@example.com",
               "first_name": "John",
               "last_name": "Doe",
               "phone": "+12125557777",
               "seniority": "admin",
               "title": "Doe"
           },
           "brand_id": "BCDEF1G",
           "brand_type": "STANDARD",
           "company_name": "ABC Inc.",
           "ein": "111111111",
           "ein_issuing_country": "US",
           "entity_type": "PRIVATE_PROFIT",
           "profile_uuid": "09849948-656a-41a2-99da-8370251c804b",
           "registration_status": "COMPLETED",
           "vertical": "ENERGY",
           "vetting_score": 80,
           "vetting_status": "ACTIVE"
       }
    }
    

    Register a Standard brand

    This API lets you register a standard brand using a preexisting profile.

    addressPostal address indicated during brand creation.
    authorized_contactAuthorized contact information indicated during brand creation.
    brand_idUnique identifier for the brand created.
    brand_typeType of registration indicated during brand creation.
    company_nameLegal name of the company
    einEmployer Identification Number associated with a Standard brand.
    ein_issuing_countryISO alpha-2 code for the country that issued the EIN.
    entity_typeType of ownership indicated during brand creation.
    profile_uuidUnique identifier for the profile used to create brand.
    registration_statusIndicates status of brand.
    verticalCompany industry.
    vetting_scoreVetting score assigned to brand by TCR.
    vetting_statusVetting status of a brand.
    POST https://api.plivo.com/v1/Account/{auth_id}/10dlc/Brand/

    Arguments

    profile_uuidstringrequiredUnique identifier for the profile that you want to use for creating a brand. The profile should not have been used to create another brand.
    brand_aliasstringrequiredA friendly name for the brand.
    brand_typestring

    Indicate type of registration.

    Allowed values: STANDARD, STARTER. STANDARD not allowed for profiles not containing an EIN.

    Defaults to STARTER.

    secondary_vettingboolean

    Allowed values: true, false. Only applicable for STANDARD registration.

    Defaults to true.

    Plivo strongly recommends opting for vetting to get the highest throughput for your brands and campaigns.

    urlstringThe fully qualified URL to which status update callbacks for the message should be sent.
    methodstring

    The HTTP method to be used when calling the URL defined above.

    Allowed values: GET, POST

    Defaults to POST.

    Returns

    api_id for the request, unique brand_id, and success message

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    import sys
    sys.path.append("../plivo-python")
    import plivo
    
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.brand.create(
        brand_alias="brand name sample",
        brand_type="STANDARD",
        profile_uuid="7bc67ed6-dc92-4958-9acc-e4fdb09bd923",
        secondary_vetting=False,
        url="https://example.come/test",
        method="POST",
    )
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    response = api.brand.create(    brand_alias: "<brand name>",
                                    profile_uuid: "<profile_uuid>",
                                    secondary_vetting: true,
                                    brand_type: "STANDARD",
                                    url:"<https://<yourdomain>.com/create_brand_status/>",
                                    method: "POST"
                                )
    
    puts response
    rescue PlivoRESTError => e
        puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
    let plivo = require('plivo');
    
    let client = new plivo.Client("<auth_id>", "<auth_token>");
    var callback = {"url":"https://<yourdomain>.com/tendlc_status/", "method":"POST"}
    
    client.brand.create("govt", "<profile_uuid>", "STANDARD", true, callback)
        .then(function (response) {
            console.log(JSON.stringify(response));
        }).catch(function (error) {
            console.log("err");
            console.log(error);
        });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    <?php
    
    # Available in versions >= 4.29.0 (https://github.com/plivo/plivo-php/releases/tag/v4.29.0)
    
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client
        ->client
        ->setTimeout(60);
    try
    {
        $callback = array("url"=>"https://<yourdomain>.com/tendlc_status/", "method"=>"POST");
        $res = $client
            ->brand
            ->create("govt321", "<profile_uuid>", "STANDARD", true, $callback);
        print_r($res);
    }
    catch(PlivoRestException $ex)
    {
        print_r($ex);
    }
    ?>
    

    Was this code helpful

    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
    
    package com.plivo.examples;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.models.brand.Brand;
    import com.plivo.api.models.brand.BrandCreateResponse;
    
    public class PlivoTest {
    
        public static void main(String[] args) {
    
            Plivo.init("<auth_id>", "<auth_token>");
    
            // Create Brand
            try {
                BrandCreateResponse response = Brand.creator("brand name",
                    "<profile_uuid>",
                    "STANDARD",
                    true,
                    "<https://<yourdomain>.com/create_brand_status/>",
                    "POST").create();
                System.out.println(response);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace dotnet_project
    {
        class Ten_dlc
        {
            static void Main(string[] args)
            {
    
                    var api = new PlivoApi("<auth_id>","<auth_token>");
    
                    // Create Brand
                try
                {
                    var response = api.Brand.Create("brand_001", "201faedc-7df9-4840-9ab1-3997ce3f7cf4", "STANDARD", true, "https://<yourdomain>.com/tendlc_status/", "POST");
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                        Console.WriteLine("Exception: " + e.Message);
                }
    
    
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    curl -i --user auth_id:auth_token \
        -H "Content-Type: application/json" \
        -d '{
                "brand_alias": "gov234t",
                "profile_uuid": "d61eaaaa-18b1-4473-8810-0b9d80573aa9",
                "brand_type": "STANDARD",
                "secondary_vetting": true,
                "url": "https://<yourdomain>.com/tendlc_status/",
                "method": "POST"
            }' \
            https://api.plivo.com/v1/Account/{auth_id}/10dlc/Brand/
    

    Was this code helpful

    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
    
    package main
    
    import (
            "fmt"
            "os"
    
            plivo "github.com/plivo/plivo-go/v7"
    )
    
    func main() {
            client, err := plivo.NewClient("<auth_id>","<auth_token>", &plivo.ClientOptions{})
            if err != nil {
                    panic(err)
            }
            //Create Brand
            response, err := client.Brand.Create(plivo.BrandCreationParams{
                    BrandAlias:  "gosdktestapi-reference",
                    Type:        "STANDARD",
                    ProfileUUID: "57e1976b-ab0b-4701-8ee3-3b40f3b33c64",
                    URL:         "https://example.come/test",
                    Method:      "POST",
            })
            if err != nil {
                    fmt.Printf("Error occurred while creating brand. error:%+v\n", err)
                    os.Exit(1)
            } else {
                    fmt.Printf("%+v\n", response)
            }
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
    "api_id": "5df3fffa-64ab-11ed-b94d-0242ac110002",
    "brand_id": "BB9TT3V",
    "message": "Request to create brand was received and is being processed."
    }
    

    Register a Starter brand

    We have paused support for Starter brands.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
    let plivo = require('plivo');
    
    let client = new plivo.Client("<auth_id>", "<auth_token>");
    var callback = {"url":"https://<yourdomain>.com/tendlc_status/", "method":"POST"}
    
    client.brand.create("sole", "<profile_uuid>", "STARTER",false, callback)
        .then(function (response) {
            console.log(JSON.stringify(response));
        }).catch(function (error) {
            console.log("err");
            console.log(error);
        });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    <?php
    
    # Available in versions >= 4.29.0 (https://github.com/plivo/plivo-php/releases/tag/v4.29.0)
    
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client
        ->client
        ->setTimeout(60);
    try
    {
        $callback = array("url"=>"https://<yourdomain>.com/tendlc_status/", "method"=>"POST");
        $res = $client
            ->brand
            ->create("sole121", "<profile_uuid>", "STARTER",false, $callback);
        print_r($res);
    }
    catch(PlivoRestException $ex)
    {
        print_r($ex);
    }
    ?>
    

    Was this code helpful

    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
    
    // Available in versions >= 5.9.0 (https://github.com/plivo/plivo-dotnet/releases/tag/v5.9.0)
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace dotnet_project
    {
        class Ten_dlc
        {
            static void Main(string[] args)
            {
    
                var api = new PlivoApi("<auth_id>", "<auth_token>");
    
                // Create Brand
                try
                {
                    var response = api.Brand.Create("brand_starter", "<profile_uuid>", "STARTER", false, "https://<yourdomain>.com/tendlc_status/", "POST");
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
    
    
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    curl -i --user auth_id:auth_token \
        -H "Content-Type: application/json" \
        -d '{
                "brand_alias": "sole234t",
                "profile_uuid": "f3d02ebd-6e4e-439a-a404-9beedc5ecd80",
                "brand_type":"STARTER",
                "url": "https://<yourdomain>.com/tendlc_status/",
                "method": "POST"
            }'  \
            https://api.plivo.com/v1/Account/{auth_id}/10dlc/Brand/
    

    Was this code helpful

    Retrieve all brands

    This API lets you fetch all the brands associated with an account.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/10dlc/Brand/

    Arguments

    limitinteger

    Denotes the number of results per page. The maximum number of results that can be fetched is 20.

    Defaults to 20.

    offset integer

    Denotes the number of value items by which the results should be offset. Defaults to 0. Read more about offset-based pagination.

    registration_statusstring

    Filter by registration_status.

    Allowed values: FAILED, PROCESSING, COMPLETED

    typestring

    Filter by registration type.

    Allowed values: STARTER, STANDARD

    Returns

    api_id and a dictionary with an objects property that contains up to 20 brands. Each tuple in the list is a separate Brand object.

    Example Request

    1
    2
    3
    4
    5
    
    import plivo
    
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.campaign.list(limit=1, offset=0)
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    response = api.brand.list(limit: 1, offset: 0)
    
    puts response
    rescue PlivoRESTError => e
        puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    let plivo = require('plivo');
    
    let client = new plivo.Client("<auth_id>", "<auth_token>");
    client.brand.list()
        .then(function (response) {
            console.log(JSON.stringify(response));
        }).catch(function (error) {
            console.log("err");
            console.log(error);
        });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    <?php
    
    # Available in versions >= 4.29.0 (https://github.com/plivo/plivo-php/releases/tag/v4.29.0)
    
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client
        ->client
        ->setTimeout(60);
    try
    {
        $res = $client
            ->brand
            ->list();
        print_r($res);
    }
    catch(PlivoRestException $ex)
    {
        print_r($ex);
    }
    ?>
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    package com.plivo.examples;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.models.base.ListResponse;
    import com.plivo.api.models.brand.Brand;
    
    public class PlivoTest {
    
        public static void main(String[] args) {
    
            Plivo.init("<auth_id>", "<auth_token>");
    
            // List Brand
            try {
                ListResponse < Brand > response = Brand.lister().limit(1).offset(2).list();
                System.out.println(response);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace dotnet_project
    {
        class Ten_dlc
        {
            static void Main(string[] args)
            {
    
                var api = new PlivoApi("<auth_id>", "<auth_token>");
    
                // List Brand
                Console.WriteLine("List Brand");
                try
                {
                    var response = api.Brand.List();
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user auth_id:auth_token \
        https://api.plivo.com/v1/Account/{auth_id}/10dlc/Brand/  
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    package main
    
    import (
            "fmt"
            "os"
    
            plivo "github.com/plivo/plivo-go/v7"
    )
    
    func main() {
            client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
            if err != nil {
                    panic(err)
            }
            //List Brands
            response, err := client.Brand.List(plivo.BrandListParams{Limit: 1, Offset: 0})
            if err != nil {
                    fmt.Printf("Error occurred while getting brands. error:%+v\n", err)
                    os.Exit(1)
            } else {
                    fmt.Printf("%+v\n", response)
            }
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
       "api_id":"553379bc-6c9a-4f5d-8e8f-e0999euejene8",
       "meta":{
          "limit":1,
          "offset":0,
          "next":"/v1/Account/<AUTH_ID>/10dlc/Brand/?limit=1&offset=1",
          "previous":null,
          "total_count":45
       },
       "brands":[
          {
        	"brand_alias": "sample name”,
            "brand_id": "BXXXXX",
            "brand_type": "STANDARD",
            "company_name": "sample company",
            "ein": "123456789",
            "ein_issuing_country": "US",
            "entity_type": "PUBLIC",
            "profile_uuid": "7b8ff904-a1d2-46b2-888d-34d4df4cf95a",
            "registration_status": "COMPLETED",
            "vertical": "COMMUNICATION",
            "vetting_score": 80,
            "vetting_status": "ACTIVE",
            "website": "www.samplewebsite.com"
            "Address":{
                "city": "Dallas",
                "country": "US",
                "postal_code": "10001",
                "state": "Texas",
                "street": "#11, Nashville Street"
                },
            "Authorized_contact":{
                "email": "xxxx@gmail.com",
                "first_name": "John",
                "last_name": "Doe",
                "phone": “14845355113",
                "seniority": "Admin",
                "title": "Mr"
                },
            "created_at":"2023-03-06T20:59:26.040592Z"
              }
       ]
    }
    

    Retrieve a specific brand

    This API lets you fetch details about a specific brand associated to your account.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Brand/{brand_id}/

    Arguments

    No arguments need to be passed.

    Returns

    api_id and the brand object identified by the brand_id specified in the request URL.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import sys
    sys.path.append("../plivo-python")
    import plivo
    
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.campaign.list(limit=1, offset=0)
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    	# Get Brand
    	puts('Get Brand')
    	response = api.brand.get("<Brand_ID>")
    
    	puts response
    rescue PlivoRESTError => e
    	puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    let plivo = require('plivo');
    
    let client = new plivo.Client("<auth_id>", "<auth_token>");
    client.brand.get("<brand_id>")
        .then(function (response) {
            console.log(JSON.stringify(response));
        }).catch(function (error) {
            console.log("err");
            console.log(error);
        });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    <?php
    
    # Available in versions >= 4.29.0 (https://github.com/plivo/plivo-php/releases/tag/v4.29.0)
    
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client
        ->client
        ->setTimeout(60);
    try
    {
        $res = $client
            ->brand
            ->get("<brand_id>");
        print_r($res);
    }
    catch(PlivoRestException $ex)
    {
        print_r($ex);
    }
    ?>
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    package com.plivo.examples;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.models.brand.Brand;
    
    public class PlivoTest {
    
        public static void main(String[] args) {
    
            Plivo.init("<auth_id>", "<auth_token>");
    
            // Get Brand Details
            try {
                Brand response = Brand.getter("<Brand_ID>").get();
                System.out.println(response);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    
    // Available in versions >= 5.9.0 (https://github.com/plivo/plivo-dotnet/releases/tag/v5.9.0)
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace dotnet_project
    {
        class Ten_dlc
        {
            static void Main(string[] args)
            {
    
                var api = new PlivoApi("<auth_id>", "<auth_token>");
    
                // Get Brand
                Console.WriteLine("Get Brand");
                try
                {
                    var response = api.Brand.Get("B8OD95Z");
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user auth_id:auth_token \
        https://api.plivo.com/v1/Account/{auth_id}/10dlc/Brand/{brand_id}/  
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    package main
    
    import (
            "fmt"
            "os"
    
            plivo "github.com/plivo/plivo-go/v7"
    )
    
    func main() {
            client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
            if err != nil {
                    panic(err)
            }
            //List Brands
            response, err := client.Brand.List(plivo.BrandListParams{Limit: 1, Offset: 0})
            if err != nil {
                    fmt.Printf("Error occurred while getting brands. error:%+v\n", err)
                    os.Exit(1)
            } else {
                    fmt.Printf("%+v\n", response)
            }
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {'api_id': '0215c238-1701-11ed-9d48-0242ac110003',
    'brand': {'address': {'city': 'New York',
    'country': 'IN',
    'postal_code': '10001',
    'state': 'NY',
    'street': '123'},
    'authorized_contact': {'email': 'test@plivo.com',
    'first_name': 'John',
    'last_name': 'Doe',
    'phone': '1890342302',
    'seniority': 'admin',
    'title': 'Doe'},
    'brand_id': 'BVMN1EM',
    'brand_type': 'STARTER',
    'ein_issuing_country': 'IN',
    'entity_type': 'PRIVATE',
    'profile_uuid': 'dd0b418d-73df-4eb4-a7ab-171b774bf4a9',
    'registration_status': 'COMPLETED',
    'vertical': 'ENERGY',
    'website': 'www.google.com'}}
    

    Supported use cases for a brand

    Fetches details about what kind of campaigns are supported under a particular brand ID.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Brand/{brand_id}/usecases/

    Arguments

    No arguments need to be passed.

    Returns

    api_id, brand_id and a tuple containing all the types of campaign types allowed for the brand.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    
    import sys
    sys.path.append("../plivo-python")
    import plivo
    
    client = plivo.RestClient("<auth_id>", "<auth_token>") 
    
    response = client.brand.get_usecases(brand_id='<Brand_ID>') 
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    puts('Get Brand Usecase')
    response = api.brand.get_usecases("<Brand_ID>")
    puts response
    rescue PlivoRESTError => e
    puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    let plivo = require('plivo');
    let fs = require('fs');
    
    let client = new plivo.Client("<Auth_ID>","<Auth_Token>");
    client.brand.get_usecases("<Brand ID>")
    .then(function (response) {
    console.log(JSON.stringify(response));
    }).catch(function (error) {
    console.log("err");
    console.log(error);
    });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    <?php
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    $client = new RestClient("<auth_id>","<auth_token>");
    $client->client->setTimeout(60);
    try {
    $response = $client->brand->get_brand_usecases("<Brand_ID>");
    print_r($response);
    }
    catch (PlivoRestException $ex) {
    print_r($ex);
    }
    ?>
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.*;
    import com.plivo.api.models.brand.Brand;
    import com.plivo.api.models.brand.BrandUsecase;
    
    
    public class PlivoTest  {        
            public static void main(String[] args) {
                    Plivo.init("<auth_id>", "<auth_token>");
                   // List all Brand Usecases
                    try
                    {
                            BrandUsecase response = Brand.get_usecases("<brand_id>").get();
                            System.out.println(response);
                    }
                    catch (Exception e)
                    {
                            e.printStackTrace();
                    }
            }
    } 
    

    Was this code helpful

    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
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace dotnet_project
    {
    class Ten_dlc
    {
    static void Main(string[] args)
    {
    
    var api = new PlivoApi("<auth_id>", "<auth_token>");
    
    // List Campaigns
    Console.WriteLine("Get Brand Usecase");
    try
    {
    var response = api.Brand.ListUsecases("<Brand ID>");
    Console.WriteLine(response);
    }
    catch (PlivoRestException e)
    {
    Console.WriteLine("Exception: " + e.Message);
    }
    }
    }
    }
    

    Was this code helpful

    1
    2
    
    curl --location --request GET 'https://api.plivo.com/v1/Account/<auth_id>/10dlc/Brand/<Brand_ID>/usecases/' \
    --header 'Authorization: Basic XXXX=='
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    package main
    
    import (
    "fmt"
    "os"
    plivo "github.com/plivo/plivo-go/v7"
    )
    func main() {
    client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    if err != nil {
    panic(err)
    }
    //Get Campaign Numbers
    response, err := client.Brand.Usecases("<Brand_ID>")
    if err != nil {
    fmt.Printf("Error occurred while getting usecases. error:%+v\n", err)
    os.Exit(1)
    } else {
    fmt.Printf("%+v\n", response)
    }
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
    "api_id": "0db62668-5f2d-11ed-bee0-0242ac110002",
    "brand_id": "BJZN6KW",
    "use_cases": [
    {
    "code": "2FA",
    "details": "Any two-factor authentication with passcodes used to unlock accounts",
    "name": "Two-Factor Authentication"
    },
    {
    "code": "ACCOUNT_NOTIFICATION",
    "details": "Notification sent to account holders about changes in accounts",
    "name": "Account Notification"
    },
    {
    "code": "CUSTOMER_CARE",
    "details": "Customer care interactions by the support and other customer-facing teams",
    "name": "Customer Care"
    },
    {
    "code": "DELIVERY_NOTIFICATION",
    "details": "Updates about the delivery of products and services",
    "name": "Delivery Notification"
    },
    {
    "code": "FRAUD_ALERT",
    "details": "Notifications of suspicious behavior identified the business",
    "name": "Fraud Alert"
    },
    {
    "code": "HIGHER_EDUCATION",
    "details": "Messages sent by colleges, universities, and other educational institutions",
    "name": "Higher Education"
    },
    {
    "code": "LOW_VOLUME",
    "details": "A combination of two to five standard usage cases - for low throughput requirements",
    "name": "Low Volume"
    },
    {
    "code": "MARKETING",
    "details": "Communications related to time-bound events and sales",
    "name": "Marketing"
    },
    {
    "code": "MIXED",
    "details": "A combination of two to five standard usage cases",
    "name": "Mixed"
    },
    {
    "code": "POLLING_VOTING",
    "details": "Surveys, polling, and voting campaigns used for non-political purposes",
    "name": "Polling Voting"
    },
    {
    "code": "PUBLIC_SERVICE_ANNOUNCEMENT",
    "details": "Messages aimed at creating awareness about important topics",
    "name": "Public Service Announcement"
    },
    {
    "code": "SECURITY_ALERT",
    "details": "Notifications that alert users about a potential breach of systems",
    "name": "Security Alert"
    }
    ]
    }
    

    Delete a brand

    Deletes a particular 10DLC brand from your account. This action is irreversible and is only allowed for brands with no associated active campaigns.

    API Endpoint

    DELETE https://api.plivo.com/v1/Account/{auth_id}/Brand/{brand_id}/ 

    Arguments

    No arguments need to be passed.

    Returns

    api_id, brand_id and a confirmation (or error message). 

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import sys
    sys.path.append("../plivo-python")
    import plivo
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    
    bresponse = client.brand.delete(brand_id='<Brand_id>')
    print(bresponse)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    
    puts('Delete Brand')
    response = api.brand.delete("<Brand_id>")
    
    puts response
    rescue PlivoRESTError => e
    puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    let plivo = require('plivo');
    let fs = require('fs');
    
    let client = new plivo.Client("<auth_id>", "<auth_token>");
    client.brand.deleteBrand("<Brand_ID>").then(function(response) {
    console.log(JSON.stringify(response));
    }).catch(function(error) {
    console.log("err");
    console.log(error);
    });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    <?php
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client->client->setTimeout(60);
    try {
    $res = $client->brand->delete("<Brand_ID>");
    print_r( $res);
    }
    catch (PlivoRestException $ex) {
    print_r($ex);
    }
    ?>
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.*;
    import com.plivo.api.models.brand.Brand;
    import com.plivo.api.models.brand.BrandDeleteResponse;
    
    
    public class GetCampaignTest {
    public static void main(String[] args) {
    Plivo.init("<auth_id>", "<auth_token>");
    // Get Brand Details
    try
    {
    BrandDeleteResponse response = Brand.deleter("<Brand_ID>").delete();
    System.out.println(response);
    }
    catch (PlivoRestException | IOException| PlivoValidationException e)
    {
    e.printStackTrace();
    }
    }
    }
    

    Was this code helpful

    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
    
    using System;
    using Plivo;
    using Plivo.Exception;
    
    namespace test
    {
    class Program
    {
    static void Main(string[] args)
    {
    var api = new PlivoApi("<auth_id>", "<auth_token>");
    try
    {
    Console.WriteLine("Delete Brand");
    var brand_delete_response = api.Brand.Delete("<Brand_ID>");
    Console.WriteLine(brand_delete_response);
    }
    catch (PlivoRestException e)
    {
    Console.WriteLine("Exception: " + e.Message);
    }
    }
    
    }
    }
    

    Was this code helpful

    1
    2
    
    curl --location --request DELETE 'https://api.plivo.com/v1/Account/<auth_id>/10dlc/Brand/<Brand_ID>/' \
    --header 'Authorization: Basic XXXX=='
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    package main
    
    import (
    "fmt"
    "os"
    plivo "github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    if err != nil {
    panic(err)
    }
    // Delete Brand
    response, err := client.Brand.Delete("<Brand_ID>")
    if err != nil {
    fmt.Printf("Error occurred while deleting brand. error:%+v\n", err)
    os.Exit(1)
    } else {
    fmt.Printf("%+v\n", response)
    }
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
    "api_id": "785ed2dc-7493-11ed-97ac-0242ac110003",
    "brand_id": "BCHVILW",
    "message": "Brand Deactivated"
    }
    

    Campaign

    The campaign endpoint lets you create campaigns for your use cases. Register a brand before creating a campaign.

    API Endpoint

    BaseURI https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/

    The Campaign object

    Attributes

    brand_idThe brand_id associated with the campaign.
    campaign_idUnique identifier for the campaign created.
    campaign_attributes

    Tuple indicating status of the following attributes that were specified at the time of campaign creation:
    affiliate_marketing
    age_gated
    direct_lending
    embedded_link
    embedded_phone
    subscriber_help
    subscriber_optin
    subscriber_optout

    descriptionA brief description of the campaign and how it’s relevant to your business.
    registration_status

    Indicates status of a campaign.

    usecaseUse case used to create the campaign.
    sub_usecasesSub-use cases used to create mixed campaigns.
    sample1

    Sample message indicated at campaign creation time. Campaign creation requires at least two sample messages.

    sample2Sample message indicated at campaign creation time. Campaign creation requires at least two sample messages.
    mno_metadataTuple containing allowed transactions per minute (TPM) and brand_tier (specific to T-Mobile transactions per day (TPD)).
    message_flow

    A brief description of how a customer opts in to the campaign and provides consent to the sender to receive their messages.

    help_messageResponse to HELP keyword on this campaign’s numbers.
    optin_messageMessage sent to subscribers to confirm their opt-in to the campaign.
    optout_messageResponse to STOP keyword on this campaign’s numbers.
    optin_keywordsOpt-in keyword(s) associated with the campaign. If more than one, provide a comma-separated list with no special characters or embedded spaces.
    optout_keywordsOpt-out keyword(s) associated with the campaign. If more than one, provide a comma-separated list with no special characters or embedded spaces.
    help_keywordsHelp keyword(s) associated with the campaign. If more than one, provide a comma-separated list with no special characters or embedded spaces.
    campaign_sourceIndicates how a campaign has been created. If you have created this campaign on Plivo, campaign_source will be plivo. If you have created a campaign directly on TCR and imported to Plivo, campaign_source will be shared.

    Example Object

    {
        "api_id": "497b1284-3a49-11ed-a2ca-0242ac110004",
        "campaign": {
            "brand_id": "BHXDNDJ",
            "campaign_id": "CZISKSM",
            "mno_metadata": {
                "at&t": {
                    "tpm": "4500",
                    "brand_tier": null
                },
                "t-mobile": {
                    "tpm": null,
                    "brand_tier": "TOP"
                },
                "us cellular": {
                    "tpm": "4500",
                    "brand_tier": null
                },
                "verizon wireless": {
                    "tpm": "4500",
                    "brand_tier": null
                }
            },
            "reseller_id": "",
            "usecase": "MIXED",
            "sub_usecase": "CUSTOMER_CARE,2FA",
            "message_flow": "Message flow is a mandatory parameter, minimum 40 characters",
            "optin_keywords": "YES, SUBSCRIBE, TRUE",
            "optin_message": "Opt-in message should have a minimum of 20 characters",
            "optout_keywords": "NO, STOP",
            "optout_message": "Opt-out message should have a minimum of 20 characters",
            "help_keywords": "HELP, INFO, MORE",
            "help_message": "Help message is a mandatory parameter, minimum 20 characters"
        }
    }
    

    Register a campaign

    This API lets you register a campaign using a preexisting brand.

    API Endpoint

    POST https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/

    Arguments

    campaign_aliasstringrequiredA friendly name for your campaign. This name appears on the Plivo console.
    brand_idstringrequiredID of the for which campaign creation request is being submitted.
    verticalstringrequiredIndicates the industry specific to the message use case.

    Allowed values: PROFESSIONAL, REAL_ESTATE, HEALTHCARE,HUMAN_RESOURCES, ENERGY, ENTERTAINMENT, RETAIL, TRANSPORTATION, AGRICULTURE, INSURANCE, POSTAL, EDUCATION, HOSPITALITY, FINANCIAL, POLITICAL, GAMBLING, LEGAL, CONSTRUCTION, NGO,MANUFACTURING, GOVERNMENT, TECHNOLOGY,COMMUNICATION

    descriptionstringrequiredA brief description of the campaign and how it’s relevant to your business — minimum of 40 characters.
    usecasestringrequiredIndicates your messaging use case.

    Allowed values: 2FA, ACCOUNT_NOTIFICATION, CUSTOMER_CARE, DELIVERY_NOTIFICATION, FRAUD_ALERT, HIGHER_EDUCATION, LOW_VOLUME, MARKETING, MIXED, POLLING_VOTING, PUBLIC_SERVICE_ANNOUNCEMENT, SECURITY_ALERT, STARTER.

    STARTER brands can only use STARTER as their use case.

     

    sample1stringrequiredThe content of a sample message that you will send through this campaign. You must provide at least two samples, each with a minimum of 20 characters.
    sample2stringrequiredThe content of the second sample message.
    subscriber_optinbooleanrequiredA confirmation that you are collecting and processing customer opt-ins.

    Allowed value: true

    subscriber_optoutbooleanrequiredA confirmation that you are collecting and processing customer opt-outs.

    Allowed value: true

    subscriber_helpbooleanrequiredA confirmation that you have implemented a message reply that tells customers how they can contact the message sender when they reply with the “HELP” keyword.

    Allowed value: true

    direct_lendingbooleanrequiredIndicates whether this campaign includes content related to direct lending or other loan arrangements.

    Allowed values: true, false

    embedded_linkbooleanrequiredIndicates whether embedded links are being used. Operators do not accept public URL shorteners.

    Allowed values: true, false

    embedded_phonebooleanrequiredIndicates whether the campaign is using an embedded phone number other than the required HELP contact number.

    Allowed values: true, false

    age_gatedbooleanrequiredIndicates whether the campaign includes any age-gated content as defined by operator and CTIA guidelines.

    Allowed values: true, false

    affiliate_marketingbooleanrequiredIndicates whether affiliate marketing was used in the construction of this campaign.

    Allowed values: true, false

    sub_usecaseslistOnly applicable when use case is STARTER, MIXED, or LOW_VOLUME. Indicates two to five comma-separated use cases.

    Allowed values: 2FA, ACCOUNT_NOTIFICATION,CUSTOMER_CARE, DELIVERY_NOTIFICATION, FRAUD_ALERT, HIGHER_EDUCATION, MARKETING, POLLING_VOTING, PUBLIC_SERVICE_ANNOUNCEMENT, SECURITY_ALERT

    message_flow stringrequiredDescribes how a customer opts in to a campaign, thereby giving consent to the sender to send messages. The message flow must be clear and inform customers about the nature of the campaign. If a campaign supports multiple opt-in mechanisms, you must mention all of them here.

    Check documentation for samples.

    help_message stringrequiredIndicates the response to the HELP keyword. It may include the brand name and support contact information.

    Check documentation for samples.

    optout_message stringrequiredIndicates the response to the STOP keyword. It must include acknowledgement of the opt-out request and confirmation that no further messages will be sent, and may include the brand name.

    Check documentation for samples.

    optin_messagestringMessage sent to subscribers to confirm their opt-in to the campaign.
    optin_keywordsstringOpt-in keywords associated with the campaign. If more than one, provide a comma-separated list with no special characters or embedded spaces.
    help_keywordsstringHelp keywords associated with the campaign, in all capital letters. If more than one, provide a comma-separated list with no special characters or embedded spaces.
    urlstringThe fully qualified URL to which status update callbacks for the message should be sent.
    methodstringThe HTTP method to be used when calling the URL defined above.

    Allowed values: GET, POST
    Defaults to POST

    Returns

    api_id for the request, unique campaign_id, and success message

    Example Request

    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
    32
    33
    
    import sys
    sys.path.append("../plivo-python")
    import plivo
    
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    sub_usecase = ["CUSTOMER_CARE", "2FA"]
    response = client.campaign.create(
        brand_id="<brand_id>",
        campaign_alias="campaign_sample message",
        vertical="INSURANCE",
        usecase="MIXED",
        sub_usecases=sub_usecase,
        description="Campaign description is a mandatory parameter, minimum 40 characters",
        embedded_link=False,
        embedded_phone=False,
        age_gated=False,
        subscriber_optin=True,
        subscriber_optout=True,
        subscriber_help=True,
        affiliate_marketing=False,
        sample1="Sample message 1 should have a minimum of 20 characters",
        sample2="Sample message 2 should have a minimum of 20 characters",
        url="https://<yoursite>.com/test",
        method="POST",
        message_flow="Message flow is a mandatory parameter, minimum 40 characters",
        help_keywords="HELP,INFO,MORE",
        help_message="Help message is a mandatory parameter, minimum 20 characters",
        optin_keywords="YES,SUBSCRIBE",
        optin_message="Opt-in message should have a minimum of 20 characters",
        optout_keywords="NO,STOP",
        optout_message="Opt-out message should have a minimum of 20 characters",
    )
    print(response)
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin# Create Campaign
    response = api.campaign.create(brand_id: "<brand_id>",
        campaign_alias: "rubytest-1",
        vertical: "ENTERTAINMENT",
        usecase: "MIXED",
        sub_usecases: ["2FA", "MARKETING"],
        description: "Campaign description should have minimum of 40 characters",
        direct_lending: false,
        affiliate_marketing: false,
        embedded_link: false,
        embedded_phone: false,
        age_gated: false,
        subscriber_optin: true,
        subscriber_optout: true,
        subscriber_help: true,
        sample1: "Sample message 1 should have a inimum of 20 characters",
        sample2: "Sample message 2 should have a minimum of 20 characters",
        url: "<https://<yourdomain>.com/create_campaign_status/>",
        method: "POST",
        message_flow: "Message flow is a mandatory parameter, minimum 40 characters",
        help_keywords: "HELP,INFO,MORE",
        help_message: "Help message is a mandatory parameter, minimum 20 characters",
        optin_keywords: "YES,SUBSCRIBE",
        optin_message: "Opt-in message should have a minimum of 20 characters",
        optout_keywords: "NO,STOP",
        optout_message: "Opt-out message should have a minimum of 20 characters",
    )
    puts response
    rescue PlivoRESTError => e
        puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    
    let plivo = require('plivo');
    let fs = require('fs');
    
    let client = new plivo.Client("<auth_id>", "<auth_token>");
    var callback = {"url":"http://plivobin.non-prod.plivops.com/xvm5fsxv", "method":"POST", "optout_keywords":"NO,STOP", "optin_keywords":"YES,SUBSCRIBE", "help_keywords":"HELP,INFO,MORE", "optin_message":"Opt-in message should have a minimum of 20 characters"}
    console.log('test');
    client.campaign.create("<brand_id>","all 7 fields optional","INSURANCE","MIXED",[
        "CUSTOMER_CARE",
        "2FA"
    ],"sample description text should 40 character following attributes that were specified at the time", false,false,false,false,true,true,true,true, "Sample message 1 should have a minimum of 20 characters", "Sample message 2 should have a minimum of 20 characters","Message flow is a mandatory parameter, minimum 40 characters ","Help message is a mandatory parameter, minimum 20 characters","Opt-out message should have a minimum of 20 characters", callback )
     .then(function (response) {
        console.log(JSON.stringify(response));
    }).catch(function (error) {
      console.log("err");
      console.log(error);
     });
    

    Was this code helpful

    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
    
    <?php
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client
        ->client
        ->setTimeout(60);
    try
    {
        $callback = array(
            "url" => "https://<yourdomain>.com/tendlc_status/",
            "method" => "POST",
            "optout_keywords" => "optout,keyword",
            "help_keywords" => "helpkeywords",
            "optin_keywords" => "optinkeywords",
            "optin_message" => "In case you want to use optin"
        );
        $res = $client
            ->campaign
            ->create("<brand_id>", "campaign name sample", "INSURANCE", "MIXED", ["CUSTOMER_CARE", "2FA"], "sample description text should be 40 characters", False, False, False, False, True, True, True, true, "sample test - 1 description text should be 40 characters ", "sample test 2 description text should be 40 characters ", "message_flow description text should be 40 characters", "help_message description text should be 40 characters", "optout_message description text should be 40 characters", $callback);
        print_r($res);
    }
    catch(PlivoRestException $ex)
    {
        print_r($ex);
    }
    ?>
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    
    package com.plivo.examples;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.models.campaign.Campaign;
    import com.plivo.api.models.campaign.CampaignCreateResponse;
    
    public class GetCampaign {
      public static void main(String[] args) {
        Plivo.init("<auth_id>", "<auth_token>");
    
        try {
          String[] sub_usecase = new String[] {
            "2FA",
            "MARKETING"
          };
          CampaignCreateResponse response = Campaign.creator("<brand_id>",
            "java campaign",
            "ENTERTAINMENT",
            "MIXED",
            sub_usecase,
            "description",
            false,
            false,
            false,
            false,
            false,
            true,
            true,
            true,
            "sample message 1",
            "sample message 2",
            "http://plivobin.non-prod.plivops.com/y27a0hy2",
            "POST",
            "sample message_flow text",
            "sample help_message text",
            "sample optout_message text",
            "YES,SUBSCRIBE",
            "sample optin_message text",
            "NO,STOP",
            "HELP,INFO,MORE").create();
          System.out.println(response);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace dotnet_project {
      class Ten_dlc {
        static void Main(string[] args) {
    
          var api = new PlivoApi("<auth_id>", "<auth_token>");
    
          // Create Campaign
          string[] sub_usecase = {
            "CUSTOMER_CARE",
            "2FA"
          };
    
          Console.WriteLine("Create Campaign");
          try {
            var response = api.Campaign.Create(
              campaign_alias: "camapaign_ren_1",
              description: "Dotnet_Test_Ren",
              brand_id: "BHXDNDJ",
              vertical: "INSURANCE",
              usecase: "MIXED",
              embedded_link: false,
              embedded_phone: false,
              direct_lending: false,
              age_gated: false,
              affiliate_marketing: false,
              subscriber_optin: true,
              subscriber_optout: true,
              subscriber_help: true,
              sample1: "sample message 1",
              sample2: "sample message 2",
              message_flow: "",
              help_message: "empty case for message flow",
              optout_message: "test optout message",
              sub_usecases: sub_usecase,
              url: "https://<yourdomain>.com/tendlc_status/",
              method: "POST",
              optin_keywords: "",
              optin_message: "In case you want to use optin",
              optout_keywords: "stop, info",
              help_keywords: "HELP,info,more"
            );
            Console.WriteLine(response);
          } catch (PlivoRestException e) {
            Console.WriteLine("Exception: " + e.Message);
          }
    
        }
      }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    curl -i --user auth_id:auth_token \
        -H "Content-Type: application/json" \
        -d '{
                "brand_id": "{brand_id}",
                "vertical": "INSURANCE",
                "usecase": "MIXED",
                "sub_usecases":["2FA","ACCOUNT_NOTIFICATION", "CUSTOMER_CARE", "DELIVERY_NOTIFICATION", "FRAUD_ALERT"],
                "description": "OTP registration",
                "direct_lending": true,
                "affiliate_marketing": false,
                "embedded_link": false,
                "embedded_phone": false,
                "age_gated": false,
                "subscriber_optin": true,
                "subscriber_optout": true,
                "subscriber_help": true,
                "sample1": "Your OTP is 1234",
                "sample2": "Your order {ID} is out for delivery",
                "url": "https://<yourdomain>.com/tendlc_status/",
                "method": "POST"
            }' \
        https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    
    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
            }
            campaignAlias := "campaign name sample"
            embeddedLink := false
            embeddedPhone := false
            ageGated := false
            directLending := false
            subUsecases := []string{"CUSTOMER_CARE", "2FA"}
            sample1 := "Sample message 1 should have a minimum of 20 characters"
            sample2 := "Sample message 2 should have a minimum of 20 characters"
            response, err := client.Campaign.Create(plivo.CampaignCreationParams{
                    BrandID:          "<brand_id>",
                    CampaignAlias:    &campaignAlias,
                    Vertical:         "INSURANCE",
                    Usecase:          "MIXED",
                    SubUsecases:      &subUsecases,
                    Description:      "Campaign description should have minimum of 40 characters",
                    EmbeddedLink:     &embeddedLink,
                    EmbeddedPhone:    &embeddedPhone,
                    AgeGated:         &ageGated,
                    DirectLending:    &directLending,
                    SubscriberOptin:  true,
                    SubscriberOptout: true,
                    SubscriberHelp:   true,
                    Sample1:          &sample1,
                    Sample2:          &sample2,
                    MessageFlow:      "Message flow is a mandatory parameter, minimum 40 characters",
                    HelpKeywords:     "HELP,INFO,MORE",
                    HelpMessage:      "Help message is a mandatory parameter, minimum 20 characters",
                    OptinKeywords:    "YES,SUBSCRIBE",
                    OptinMessage:     "Opt-in message should have a minimum of 20 characters",
                    OptoutKeywords:   "NO,STOP",
                    OptoutMessage:    "Opt-out message should have a minimum of 20 characters",
            },
    )
    if err != nil {
            fmt.Print("Error", err.Error())
            return
    }
    fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "apiId": "a640fba2-3b14-11ed-95d8-0242ac110004",
        "campaignId": "CVWMV6V",
        "message": "Request to create campaign was received and is being processed."
    }
    

    Import a campaign

    This API lets you import a campaign that you have registered directly with The Campaign Registry (TCR). This feature is currently in private beta - please contact our support team to enable this feature for your account.

    API Endpoint

    POST https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/Import

    Arguments

    campaign_alias string RequiredA friendly name for your campaign.
    campaign_id string RequiredID for the campaign that needs to be imported.

    Make sure you have shared the campaign with Plivo from your TCR portal before submitting the API request.

    url stringThe fully qualified URL to which status update callbacks for the message should be sent.
    method stringThe HTTP method to be used when calling the URL defined above.

    Allowed values: GET, POST

    Defaults to POST

    Returns

    api_id for the request, campaign_id and success message.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new(<auth_id>", "<auth_token>)
    
    begin
      puts("import Campaign")
      response = api.campaign.import(campaign_id:"C1234567", campaign_alias:"campaign name")
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    curl -i --user auth_id:auth_token \
        -H "Content-Type: application/json" \
        -d '{
            "campaign_alias": “Friendly Name”,
            "campaign_id": “C1234567”,
            "url": "https://<yourdomain>.com/tendlc_status/",
            "method": "POST"
        }' \
        https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/Import/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    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.Println("err", err.Error)
    }
    response, err := client.Campaign.Import(plivo.ImportCampaignParams{CampaignID: "C1234567", CampaignAlias: "My partner campaign"})
    if err != nil {
    fmt.Println(err.Error)
    return
    }
    fmt.Println("response", response)
    }
    

    Was this code helpful

    Response

    {
    "api_id": "a640fba2-3b14-11ed-95d8-0242ac110003",
    "campaign_id": "<Campaign ID used in the request API>",
    "message": "Request to import campaign was received and is being processed."
    }
    

    Retrieve all campaigns

    This API lets you fetch all the campaigns associated with an account.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/

    Arguments

    limitinteger

    Denotes the number of results per page. The maximum number of results that can be fetched is 20.

    Defaults to 20.

    offset integer

    Denotes the number of value items by which the results should be offset. Defaults to 0. Read more about offset-based pagination.

    usecasestring

    Filter by use case.

    Allowed values: 2FA, ACCOUNT_NOTIFICATION, CUSTOMER_CARE, DELIVERY_NOTIFICATION, FRAUD_ALERT, HIGHER_EDUCATION, LOW_VOLUME, MARKETING, MIXED, POLLING_VOTING, PUBLIC_SERVICE_ANNOUNCEMENT, SECURITY_ALERT, STARTER.

    brand_idstring

    Filters results by a brand_id

    registration_statusstring

    Filter by registration status of a campaign.

    Allowed values:Active,Failed,Processing,Expired

    campaign_sourcestring

    Filters results by campaign source.

    Allowed values:plivo,shared

    Returns

    api_id and a dictionary with an objects property that contains up to 20 campaigns. Each tuple in the list is a separate Campaign object.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    import sys  
    sys.path.append("../plivo-python")  
    import plivo 
    
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.campaign.get_number(
        campaign_id="<campaign_id>", number="14845197139"
    )
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
            response = api.campaign.get("<campaign_id>")
    
            puts response
    rescue PlivoRESTError => e
            puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
    let plivo = require('plivo');
    
    let client = new plivo.Client("<auth_id>", "<auth_token>");
    client.campaign.list(param = {
            limit: 20,
            offset: 0
        })
        .then(function(response) {
            console.log(JSON.stringify(response));
        }).catch(function(error) {
            console.log(error);
        });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    <?php
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client->client->setTimeout(60);
    try {
         $res = $client->campaign->getNumber("<campaign_id>","14845197716");
         print_r( $res);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    
    ?>
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    package com.plivo.examples;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.models.base.ListResponse;
    import com.plivo.api.models.campaign.Campaign;
    
    public class PlivoTest {
    
        public static void main(String[] args) {
            Plivo.init("<auth_id>", "<auth_token>");
    
            // List Campaign
            try {
                ListResponse < Campaign > response = Campaign.lister().limit(1).offset(0).list();
                System.out.println(response);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace dotnet_project
    {
        class Ten_dlc
        {
            static void Main(string[] args)
            {
    
                var api = new PlivoApi("<auth_id>", "<auth_token>");
                try
                {
                    var response = api.Campaign.List();
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user auth_id:auth_token \
        https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    package main
    
    import (
    	"fmt"
    	"os"
    
    	plivo "github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    	//List All Campaigns
    	response, err := client.Campaign.List(plivo.CampaignListParams{Limit: 2, Offset: 0})
    	if err != nil {
    		fmt.Printf("Error occurred while listing campaigns. error:%+v\n", err)
    		os.Exit(1)
    	} else {
    		fmt.Printf("%+v\n", response)
    	}
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "api_id": "f5013b11-8d0e-4156-b7a2-feeea076b6fb",
        "meta": {
            "limit": 1,
            "offset": 0,
            "next": "/v1/Account/<auth_id>/10dlc/Campaign/?limit=1&offset=1",
            "previous": null,
            "total_count": 16
        },
        "campaigns": [
            {
                "campaign_id": "CY2UXXX",
                "registration_status": "FAILED",
                "reseller_id": "",
                "brand_id": "BANGXXX",
                "usecase": "2FA",
                "campaign_alias": "campaign name",
                "mno_metadata": {
                    "AT&T": {
                        "tpm": 4500
                    },
                    "T-Mobile": {
                        "brand_tier": "TOP"
                    },
                    "US Cellular": {
                        "tpm": 4500
                    },
                    "Verizon Wireless": {
                        "tpm": 4500
                    }
                },
                "sample1": "Your one-time passcode is 6. Please do not reply to this message.",
                "sample2": "Your one-time passcode is 6.",
                "description": "We use this campaign to send multi factor authentication 6 digit codes to end users and customers.",
                "campaign_attributes": {
                    "embedded_link": false,
                    "embedded_phone": false,
                    "age_gated": false,
                    "direct_lending": false,
                    "subscriber_optin": true,
                    "subscriber_optout": true,
                    "subscriber_help": true,
                    "affiliate_marketing": false
                },
                "message_flow": "Agents and customers using our service daily. Agents login required to validate the MFA code. Customers login required to validate the MFA code. ",
                "help_message": "Please call {800 number} if you're having issues with login.",
                "optout_message": "You are not going to receive MFA codes by SMS moving forward.",
                "created_at": "2023-09-25T20:36:00.83971Z",
                "vertical": "ENTERNTAINMENT"
                "campaign_source": "plivo"
            }
        ]
    }
    

    Retrieve a specific campaign

    This API lets you fetch details about a specific campaign associated with your account.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/{campaign_id}/

    Arguments

    No arguments need to be passed.

    Returns

    api_id and the campaign object identified by the campaign_id specified in the request URL.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import sys
    sys.path.append("../plivo-python")
    import plivo
    
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.campaign.list(limit=1, offset=0)
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
            response = api.campaign.get("<campaign_id>")
    
            puts response
    rescue PlivoRESTError => e
            puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    let plivo = require('plivo');
    
    let client = new plivo.Client("<auth_id>", "<auth_token>");
    client.campaign.get("<campaign_id>")
        .then(function(response) {
            console.log(JSON.stringify(response));
        }).catch(function(error) {
            console.log(error);
        });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    <?php
    
    # Available in versions >= 4.29.0 (https://github.com/plivo/plivo-php/releases/tag/v4.29.0)
    
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client
        ->client
        ->setTimeout(60);
    try
    {
        $res = $client
            ->campaign
            ->get("<campaign_id>");
        print_r($res);
    }
    catch(PlivoRestException $ex)
    {
        print_r($ex);
    }
    ?>
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    package com.plivo.examples;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.models.campaign.Campaign;
    
    public class PlivoTest {
    
        public static void main(String[] args) {
    
            Plivo.init("<auth_id>", "<auth_token>");
    
            // Get Campaign Details
            try {
                Campaign response = Campaign.getter("<Campaign_ID>").get();
                System.out.println(response);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace dotnet_project
    {
        class Ten_dlc
        {
            static void Main(string[] args)
            {
    
                var api = new PlivoApi("<auth_id>", "<auth_token>");
    
                // Get Campaign
                Console.WriteLine("Get Campaign");
                try
                {
                    var response = api.Campaign.Get("<Campaign_ID>");
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user auth_id:auth_token \
        https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/{campaign_id}/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    package main
    
    import (
    	"fmt"
    	"os"
    
    	plivo "github.com/plivo/plivo-go"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    	//Get Campaign Detail
    	response, err := client.Campaign.Get("<Campaign_ID>")
    	if err != nil {
    		fmt.Printf("Error occurred while getting campaign. error:%+v\n", err)
    		os.Exit(1)
    	} else {
    		fmt.Printf("%+v\n", response)
    	}
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "api_id": "4dea744b-7b9b-4525-a380-d2b2c26c523c",
        "campaign": {
            "campaign_id": "CY5JZZZ",
            "registration_status": "ACTIVE",
            "reseller_id": "",
            "brand_id": "BOANNZO",
            "usecase": "CUSTOMER_CARE",
            "campaign_alias": "campaign name",
            "mno_metadata": {
                "AT&T": {
                    "tpm": 4500
                },
                "T-Mobile": {
                    "brand_tier": "TOP"
                },
                "US Cellular": {
                    "tpm": 4500
                },
                "Verizon Wireless": {
                    "tpm": 4500
                }
            },
            "sample1": "You can confirm by responding to this text or by logging into the customer portal.",
            "sample2": "Your next scheduled deposit is on [Deposit Date]",
            "description": "We use this campaign for customer care communications for opted in customers.",
            "campaign_attributes": {
                "embedded_link": true,
                "embedded_phone": true,
                "age_gated": false,
                "direct_lending": false,
                "subscriber_optin": true,
                "subscriber_optout": true,
                "subscriber_help": true,
                "affiliate_marketing": false
            },
            "message_flow": "Customer opts in by sending an inbound YES message.",
            "help_message": "Reply YES to receive text communications, STOP to opt out. Call [Company Phone] for support. Msg rates may apply.",
            "optout_message": "You will not receive any more text communications. Reply YES to subscribe.",
            "created_at": "2023-04-04T15:21:01.064199Z",
            "vertical": "ENTERNTAINMENT"
            "campaign_source": "plivo"
        }
    }
    

    Update a campaign

    Update a 10DLC campaign from your account. This action is only allowed for campaigns that failed to register previously — that is, current registration_status = failed.

    Note that updating a campaign submits it for another vetting review with the carriers at a cost of $15. See our 10DLC support page for more details on vetting.

    Please note that updates to campaigns will be allowed when the registration_status is set to processing. However, in some cases, when the registration_status is in the processing stage, updates to campaigns will not be allowed (via console) or may result in an error through the API, as the campaign may be undergoing carrier approval with the registry.

    API Endpoint

    POST https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/{campaign_id}/

    Arguments

    You can update only these fields of a campaign. You can pass one or more of the fields during the update.

    campaign_aliasstring

    A friendly name for your campaign. This name appears on the Plivo console.

    description string

    A brief description of the campaign and how it’s relevant to your business — minimum of 40 characters. 

    sample1 stringThe content of a sample message that you will send through this campaign. You must provide at least two samples, each with a minimum of 20 characters. 
    sample2 stringThe content of the second sample message. 
    message_flow stringDescribes how a customer opts in to a campaign, thereby giving consent to the sender to send messages. The message flow must be clear and inform customers about the nature of the campaign. If a campaign supports multiple opt-in mechanisms, you must mention all of them here.
    Check documentation for samples. 
    help_message string

    Indicates the response to the HELP keyword. It may include the brand name and support contact information. 

    Check documentation for samples. 

    optout_message stringIndicates the response to the STOP keyword. It must include acknowledgement of the opt-out request and confirmation that no further messages will be sent, and may include the brand name.
    Check documentation for samples. 
    optout_keywords stringOpt-out keywords associated with the campaign. If more than one, provide a comma-separated list with no special characters or embedded spaces.  
    optin_message stringMessage sent to subscribers to confirm their opt-in to the campaign. 
    optin_keywords stringOpt-in keywords associated with the campaign. If more than one, provide a comma-separated list with no special characters or embedded spaces. 
    help_keywords stringHelp keywords associated with the campaign, in all capital letters. If more than one, provide a comma-separated list with no special characters or embedded spaces. 

    Returns

    api_id and the campaign object for the campaign in question.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import sys
    sys.path.append("../plivo-python")
    import plivo
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    
    response = client.campaign.update('<Campaign_id>, sample1='update sample1 on plivo and tcr', message_flow='message flow is mandatory param and minimum 40 characters', help_message='help message is mandatory param and minimum 20 character')
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new(""<auth_id>", "<auth_token>")
    
    begin
    
    puts("Update Campaign")
    response = api.campaign.update("<Campaign_ID>", params={sample1: "Sample message 1 text", message_flow:"Message flow is a mandatory parameter, minimum 40 characters", help_message:"Help message is a mandatory parameter, minimum 20 characters"})
    
    puts response
    rescue PlivoRESTError => e
    puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    let plivo = require('plivo');
    let fs = require('fs');
    let client = new plivo.Client("<auth_id>", "<auth_token>");
    client.campaign.update("<Campaign_id>","","Campaign description should have a minimum of 40 characters","Sample message 1 should have a minimum of 20 characters","Sample message 2 should have a minimum of 20 characters","Message flow is a mandatory parameter, minimum 40 characters","Help messgae is mandatory parameter, minimum 20 characters","YES,SUBSCRIBE","Opt-in message should have a minimum of 20 characters","NO,STOP","Opt-out message should have a minimum of 20 characters","HELP,INFO,MORE").then(function(response) {
        console.log(JSON.stringify(response));
        }).catch(function(error) {
        console.log("err");
        console.log(error);
        });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    <?php
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client->client->setTimeout(60);
    try {
    $res = $client->campaign->update("<Campaign_ID>", "Campaign description should have a minimum of 40 characters","","Sample message 1 should have a minimum of 20 characters","Sample message 2 should have a minimum 2of 0 characters","Message flow is a mandatory parameter, minimum 40 characters","Help messgae is a mandatory parameter, minimum 20 characters","YES,SUBSCRIBE","Opt-in message should have a minimum of 20 characters","NO,STOP","Opt-out message should have a minimum of 20 characters","HELP,INFO,MORE");
    print_r( $res);
    }
    catch (PlivoRestException $ex) {
    print_r($ex);
    }
    ?>
    

    Was this code helpful

    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
    
    import java.io.IOException;
    
    import com.fasterxml.jackson.databind.ObjectMapper;
    import java.io.FileWriter;
    import java.util.Collections;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Random;
    import java.net.URL;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.*;
    import com.plivo.api.models.campaign.Campaign;
    import com.plivo.api.models.campaign.CampaignUpdateResponse;
    
    public class GetCampaignTest {
    public static void main(String[] args) {
    Plivo.init("<auth_id>", "<auth_token>");
    // Update Campaign
    try
    {
    CampaignUpdateResponse response = Campaign.updater("<Campaign_ID>","","Campaign description should have a minimum of 40 characters","Sample message 1 should have a minimun of 20 characters","Sample message 2 should have a minimum of 20 characters","Message flow is a mandatory parameter, minimum 40 characters","Help message is a mandatory parameter, minimum 20 characters","YES,SUBSCRIBE","Opt-in message should have a minimum of 20 characters","NO,STOP","Opt-out message should have a minimum of 20 characters","HELP,INFO,MORE").update();
    System.out.println(response);
    }
    catch (PlivoRestException | IOException| PlivoValidationException e)
    {
    e.printStackTrace();
    }
    }
    }
    

    Was this code helpful

    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
    
    using System;
    using Plivo;
    using Plivo.Exception;
    using Plivo.Utilities;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Linq;
    
    namespace test
    {
    class Program
    {
    static void Main(string[] args)
    {
    var api = new PlivoApi("<auth_id>", "<auth_token>");
    try
    {
    Console.WriteLine("-------------------------------------campaign_update-------------------------------------");
    var campaign_update_response = api.Campaign.Update("<Campaign_ID>", description:"Campaign description should have a minimum of 40 characters", sample1: "Sample message 1 should have a minimum of 20 characters", sample2: "Sample message 2 should have a minimum of 20 characters", message_flow:"Message flow is a mandatory parameter, minimum 40 characters", help_message:"Help message is a mandatory parameter, minimum 20 characters", optin_keywords:"YES,SUBSCRIBE", optin_message:"Opt-in message should have a minimum of 20 characters", optout_keywords:"NO,STOP", optout_message:"Opt-out message should have a minimum of 20 characters", help_keywords:"HELP,INFO,MORE");
    Console.WriteLine(campaign_update_response);
    
    }
    catch (PlivoRestException e)
    {
    Console.WriteLine("Exception: " + e.Message);
    }
    }
    
    }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    curl --location --request POST 'https://api.plivo.com/v1/Account/<Auth_id>/10dlc/Campaign/<Campaign_id>/' \
    --header 'Authorization: Basic XXXX==' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "description":"Description should have minimum of 40 characters",
    "sample1": "Sample message 1 should have minimum of 20 characters",
    "sample2": "Sample message 2 should have minimum of 20 characters",
    "message_flow":"Message flow is a mandatory parameter, minimum 40 characters",
    "help_message":"Help message is a mandatory parameter, minimum 20 characters",
    "optout_message":"Opt-out message should have a minimum of 20 characters",
    "optout_keywords":"NO,STOP",
    "optin_message":"Opt-in message should have a minimum of 20 characters",
    "optin_keywords":"YES,SUBSCRIBE",
    "help_keywords":"HELP,INFO,MORE"
    }'
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    
    package main
    import (
    "fmt"
    "os"
    plivo "github.com/plivo/plivo-go/v7"
    )
    func main() {
    client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    if err != nil {
    panic(err)
    }
    // Update Campaign
            description:= "Campaign description should have minimum of 40 characters"
            sample1:= "Sample message 1 should have a minimum of 20 characters"
            sample2:= "Sample message 2 should have a minimum of 20 characters"
            message_flow:= "Message flow is a mandatory parameter, minimum 40 characters"
            help_message:= "Help messgae is a mandatory parameter, minimum 20 characters"
            optin_keywords:= "YES,SUBSCRIBE"
            optin_message:= "Opt-in message should have a minimum of 20 characters"
            optout_keywords:= "NO,STOP"
            optout_message:= "Opt-out message should have a minimum of 20 characters"
            help_keywords:= "HELP,INFO,MORE"
    response, err := client.Campaign.Update("<Campaign_id>", plivo.CampaignUpdateParams{
            Description:description,
            Sample1: sample1,
            Sample2: sample2,
            MessageFlow: message_flow,
            HelpMessage: help_message,
            OptinKeywords: optin_keywords,
            OptinMessage: optin_message,
            OptoutKeywords: optout_keywords,
            OptoutMessage: optout_message,
            HelpKeywords: help_keywords,
    })
    if err != nil {
    fmt.Printf("Error occurred while updating camapign — error:%+v\n", err)
    os.Exit(1)
    } else {
    fmt.Printf("%+v\n", response)
    }
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
    "api_id": "6739b738-80ff-11ed-95f2-0242ac110003",
    "campaign": {
    "brand_id": "BSJXPJH",
    "campaign_attributes": {
    "affiliate_marketing": false,
    "age_gated": false,
    "direct_lending": false,
    "embedded_link": false,
    "embedded_phone": false,
    "subscriber_help": true,
    "subscriber_optin": true,
    "subscriber_optout": true
    },
    "campaign_id": "CDB3KGW",
    "description": "Campaign description is a mandatory parameter, minimum 40 characters",
    "help_keywords": "HELP,INFO,MORE",
    "help_message": "Help message is a mandatory parameter, minimum 20 characters",
    "message_flow": "Message flow is a mandatory parameter, minimum 40 characters",
    "mno_metadata": {
    "AT&T": {
    "tpm": 4500
    },
    "T-Mobile": {
    "brand_tier": "TOP"
    },
    "US Cellular": {
    "tpm": 4500
    },
    "Verizon Wireless": {
    "tpm": 4500
    }
    },
    "optin_keywords": "YES,SUBSCRIBE",
    "optin_message": "Opt-in message should have a minimum of 20 characters",
    "optout_keywords": "NO,STOP",
    "optout_message": "Opt-out message should have a minimum of 20 characters",
    "registration_status": "FAILED",
    "reseller_id": "",
    "sample1": "Sample message 1 should have a minimum of 20 characters",
    "sample2": "Sample message 2 should have a minimum of 20 characters",
    "usecase": "2FA"
    }
    }
    

    Delete a campaign

    Deletes a 10DLC campaign from your account. This action is irreversible and is only allowed for campaigns that have no numbers in processing status.

    API Endpoint

    DELETE https://api.plivo.com/v1/Account/{auth_id}/Campaign/{campaign_id}/ 

    Arguments

    No arguments need to be passed.

    Returns

    api_id, campaign_id, and a confirmation (or error message).

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import sys  
    sys.path.append("../plivo-python")  
    import plivo  
    client = plivo.RestClient("<auth_id>", "<auth_token>")  
    
    bresponse = client.campaign.delete(campaign_id='<Campaign_id>')  
    print(bresponse) 
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    
    puts('Delete Campaign')
    response = api.campaign.delete("<Campaign_ID>")
    
    puts response
    rescue PlivoRESTError => e
    puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    let plivo = require('plivo');
    let fs = require('fs');
    
    let client = new plivo.Client("<auth_id>", "<auth_token>");
    client.campaign.deleteCampaign("<Campaign_ID>").then(function(response) {
    console.log(JSON.stringify(response));
    }).catch(function(error) {
    console.log("err");
    console.log(error);
    });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    <?php
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client->client->setTimeout(60);
    try {
    $res = $client->campaign->delete("<Campaign_ID>");
    print_r( $res);
    }
    catch (PlivoRestException $ex) {
    print_r($ex);
    }
    ?>
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    import java.io.IOException;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.*;
    import com.plivo.api.models.campaign.Campaign;
    import com.plivo.api.models.campaign.CampaignDeleteResponse;
    
    public class PlivoTest {
    public static void main(String[] args) {
    Plivo.init("<auth_id>", "<auth_token>");
    // Get Brand Details
    try
    {
    CampaignDeleteResponse response = Campaign.deleter("<Campaign_id>").delete();
    System.out.println(response);
    }
    catch (PlivoRestException | IOException| PlivoValidationException e)
    {
    e.printStackTrace();
    }
    }
    }
    

    Was this code helpful

    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
    
    using System;
    using Plivo;
    using Plivo.Exception;
    
    namespace test
    {
    class Program
    {
    static void Main(string[] args)
    {
    var api = new PlivoApi("<auth_id>", "<auth_token>");
    try
    {
    Console.WriteLine("Delete Campaign");
    var campaign_delete_response = api.Campaign.Delete("<Campaign_id>");
    Console.WriteLine(campaign_delete_response);
    }
    catch (PlivoRestException e)
    {
    Console.WriteLine("Exception: " + e.Message);
    }
    }
    
    }
    }
    

    Was this code helpful

    1
    2
    
    curl --location --request DELETE 'https://api.plivo.com/v1/Account/<auth_id>/10dlc/Campaign/<Campaign_ID>/' \
    --header 'Authorization: Basic XXXX=='
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    package main
    
    import (
    "fmt"
    "os"
    plivo "github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    if err != nil {
    panic(err)
    }
    // Delete Campaign
    response, err := client.Campaign.Delete("<Campaign_ID>")
    if err != nil {
    fmt.Printf("Error occurred while deleting camapign. error:%+v\n", err)
    os.Exit(1)
    } else {
    fmt.Printf("%+v\n", response)
    }
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
    "api_id": "d899b83a-7464-11ed-9120-0242ac110003",
    "campaign_id": "CTPC3HL",
    "message": "Campaign Deactivated"
    }
    

    The 10DLC numbers endpoint lets you link and unlink numbers from your campaign.

    API Endpoint

    BaseURI https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/{campaign_id}/Number/

    The Number object

    Attributes

    campaign_id Unique identifier for a campaign.
    campaign_alias Friendly name for the campaign.
    usecase Use case of the campaign.
    phone_numbers Tuple containing status of each number linked to the campaign.

    Example Object

    {
    "campaign_alias": "ABC Campaign",
    "campaign_id": "CUOGHIN",
    "phone_numbers": [
    {
    "number": "12125557778",
    "status": "PROCESSING"
    }
    ],
    "usecase": "STARTER"
    }
    

    Retrieve all numbers linked to a campaign

    This API lets you fetch all the numbers linked to a particular campaign.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/{campaign_id}/Number/

    Arguments

    No arguments need to be passed.

    Returns

    The number object for that campaign. The status in the phone_numbers tuple indicates the status of the linking request. The phone_numbers tuple contains a status that can take the values

    FAILED,

    PROCESSING, or

    COMPLETED.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import sys  
    sys.path.append("../plivo-python")  
    import plivo 
    
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.campaign.get_numbers(campaign_id="<campaign_id>", limit=20, offset=0)
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    	response = api.campaign.get_numbers("<Campaign_ID>",limit:2, offset:0)
    
    	puts response
    rescue PlivoRESTError => e
    	puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    let plivo = require('plivo');
    
    let client = new plivo.Client('<auth_id>', '<auth_token>');
    
    client.campaign.listNumber("<campaign_id>", {})
        .then(function (response) {
            console.log(JSON.stringify(response));
        }).catch(function (error) {
            console.log("err");
            console.log(error);
        });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    <?php
    
    # Available in versions >= 4.29.0 (https://github.com/plivo/plivo-php/releases/tag/v4.29.0)
    
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client
        ->client
        ->setTimeout(60);
    try
    {
        $res = $client
            ->campaign
            ->listNumber("<campaign_id>");
        print_r($res);
    }
    catch(PlivoRestException $ex)
    {
        print_r($ex);
    }
    
    ?>
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    package com.plivo.examples;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.models.campaign.CampaignNumbers;
    
    public class PlivoTest {
    
        public static void main(String[] args) {
    
            Plivo.init("<auth_id>", "<auth_token>");
    
            // List all Campaign Numbers
            try {
                CampaignNumbers response = CampaignNumbers.getNumbers("<Camapign_ID>")
                    .limit(2).offset(0).get();
                System.out.println(response);
    
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace dotnet_project
    {
        class Ten_dlc
        {
            static void Main(string[] args)
            {
    
                    var api = new PlivoApi("<auth_id>","<auth_token>");
    
                  // Get all Campaign Numbers
                Console.WriteLine("Get all Campaign Numbers");
                try
                {   
                        var response = api.Campaign.ListNumber("<campaign_id>");
                        Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                        Console.WriteLine("Exception: " + e.Message);
                }
    
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user auth_id:auth_token \
        https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/{campaign_id}/Number/?limit=10&offset=0
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    package main
    
    import (
    	"fmt"
    	"os"
    
    	plivo "github.com/plivo/plivo-go"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    	//Get Campaign Numbers
    	response, err := client.Campaign.NumbersGet("<Campaign_ID>", plivo.CampaignNumbersGetParams{Limit: 20, Offset: 0})
    	if err != nil {
    		fmt.Printf("Error occurred while getting numbers. error:%+v\n", err)
    		os.Exit(1)
    	} else {
    		fmt.Printf("%+v\n", response)
    	}
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "api_id": "8010803c-b4a1-11ec-8f25-0242ac110002",
        "campaign_alias": "ABC Campaign",
        "campaign_id": "CUOGHIN",
        "phone_numbers": [
            {
                "number": "12125557777",
                "status": "PROCESSING"
            },
            {
                "number": "12125557778",
                "status": "PROCESSING"
            },
            {
                "number": "12125557779",
                "status": "FAILED"
            }
        ],
        "usecase": "STARTER"
    }
    

    Retrieve status of number linked to a campaign

    This API lets you fetch the status of a particular number associated with a campaign.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/{campaign_id}/Number/{number}/

    Arguments

    No arguments need to be passed.

    Returns

    The number object for the number and campaign specified in the request URL. Status can take the values

    FAILED,

    PROCESSING,

    COMPLETED.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    
    import plivo
    
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.campaign.get_number(
        campaign_id="<Campaign_ID>", number="<phone_number>"
    )
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    require "rubygems"
    require "/etc/plivo-ruby/lib/plivo.rb"
    include Plivo
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    	# Get Campaign Number
    	puts('Get Campaign Number')
    	response = api.campaign.get_number("<Campaign_ID>","<phone_ number>")
    
    	puts response
    rescue PlivoRESTError => e
    	puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    let plivo = require('plivo');
    
    let client = new plivo.Client('<auth_id>', '<auth_token>');
    
    client.campaign.getNumber("<campaign_id>", "<number>")
        .then(function (response) {
            console.log(JSON.stringify(response));
        }).catch(function (error) {
            console.log("err");
            console.log(error);
        });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    <?php
    
    # Available in versions >= 4.29.0 (https://github.com/plivo/plivo-php/releases/tag/v4.29.0)
    
    require '/etc/plivo-php/vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client
        ->client
        ->setTimeout(60);
    try
    {
        $res = $client
            ->campaign
            ->listNumber("<campaign_id>");
        print_r($res);
    }
    catch(PlivoRestException $ex)
    {
        print_r($ex);
    }
    
    ?>
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    package com.plivo.examples;
    
    import com.plivo.api.Plivo;
    import com.plivo.api.models.campaign.CampaignNumbers;
    
    public class PlivoTest {
    
        public static void main(String[] args) {
    
            Plivo.init("<auth_id>", "<auth_token>");
    
            // Get Campaign Number Detail
            try {
                CampaignNumbers response = CampaignNumbers.getNumber("<Campaign_ID>")
                    .number("<number>").get();
                System.out.println(response);
    
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    
    // Available in versions >= 5.9.0 (https://github.com/plivo/plivo-dotnet/releases/tag/v5.9.0)
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace dotnet_project
    {
        class Ten_dlc
        {
            static void Main(string[] args)
            {
     
                    var api = new PlivoApi("<auth_id>","<auth_token>");
    
                    // Get Number
                Console.WriteLine("Get a Number");
                try
                {   
                        var response = api.Campaign.GetNumber("campaign_id", "<number>");
                        Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                        Console.WriteLine("Exception: " + e.Message);
                }
    
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user auth_id:auth_token \
        https://api.plivo.com/v1/Account/{auth_id}/10dlc/Campaign/{campaign_id}/Number/12025551111/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    package main
    
    import (
    	"fmt"
    	"os"
    
    	plivo "github.com/plivo/plivo-go"
    )
    
    func main() {
    	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    	//Get Campaign Number
    	response, err := client.Campaign.NumberGet("<Campaign_ID>", "<phone_ number>")
    	if err != nil {
    		fmt.Printf("Error occurred while getting number detail. error:%+v\n", err)
    		os.Exit(1)
    	} else {
    		fmt.Printf("%+v\n", response)
    	}
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
    "api_id": "56df0724-b4a1-11ec-a357-0242ac110002",
    "campaign_alias": "ABC Campaign",
    "campaign_id": "CUOGHIN",
    "phone_numbers": [
    {
    "number": "12125557777",
    "status": "PROCESSING"
    }
    ],
    "usecase": "STARTER"
    }
    

    Toll-free SMS Verification APIs

    The Plivo Toll-free Verification API allows you to create, retrieve, update, and delete toll-free verification requests. This guide provides all the information you need to manage your toll-free verification requests and enable messaging on your US and Canadian toll-free numbers.

    Base URL

    Base URI https://api.plivo.com/v1/Account/{auth_id}/TollfreeVerification

    Toll-free Verification Object

    The Toll-free Verification Object contains the following fields.

    uuid string

    The unique identifier for the verification request.

    profile_uuidstring

    The unique identifier of an existing Plivo profile.

    numberstring

    The toll-free number for which verification is being initiated.

    usecaselist

    The messaging use case(s) for which the toll-free number will be used. This should be set as one or more of the following options:

    • 2FA
    • ACCOUNT_NOTIFICATION
    • CUSTOMER_CARE
    • DELIVERY_NOTIFICATION
    • FRAUD_ALERT
    • HIGHER_EDUCATION
    • MARKETING
    • POLLING_VOTING
    • PUBLIC_SERVICE_ANNOUNCEMENT
    • SECURITY_ALERT

    One use case is mandatory. Multiple use cases can be added as a list of strings.

    usecase_summary string

    The explanation of how messaging will be used on the toll-free phone number(s) by your business.

    message_sample string

    Sample message(s) that your business will send to the end-user/mobile device. Multiple sample messages are allowed.

    optin_image_urllist

    A valid URL where you submit images explaining details of the opt-in process for the end user. Multiple URLs are allowed as a list of strings.

    Note: This URL should align with the details added to the optin_type.

    optin_typestring

    Describes how a user opts into receiving text messages. One of the following exact values should be provided:

    • VERBAL
    • WEB_FORM
    • PAPER_FORM
    • VIA_TEXT
    • MOBILE_QR_CODE

    -VERBAL must include the sample verbal consent collection and examples in a document linked in the optin_image_url parameter.

    -WEB_FORM must include the link to the form in the optin_image_url parameter.

    -PAPER_FORM must include a link to the form in the optin_image_url parameter. It can be a scanned image.

    -VIA_TEXT must describe the keyword campaign in a document linked in the optin_image_url parameter.

    -MOBILE_QR_CODE must include the QR code in a document linked in the optin_image_url parameter.

    The sample submitted in the opt-in_image_url parameter should match the opt-in type selection.

    volume string

    An estimate of the monthly volume of messages you will send from the toll-free number. One of the following exact values should be provided:

    • 1,000
    • 10,000
    • 100,000
    • 250,000
    • 500,000
    • 750,000
    • 1,000,000
    • 5,000,000
    • 10,000,000+
    • If your monthly volumes are expected to increase, it is advisable to provide a value that accommodates the projected growth and remains suitable for the next six to eight months.

    additional_information string

    Any additional information related to the website, such as a link to the terms of service (TOS) page or privacy policy, that can help clarify the verification request.

    extra_data string

    Any additional information that you would like to include for your own internal reference.

    status string

    The status of the toll-free verification request.

    rejection_reason string

    The reason for toll-free verification rejection.

    callback_url string

    A valid URL where verification-related callbacks will be sent.

    created datetime

    The date when the verification request was created.

    last_modified datetime

    The date when the verification request was last modified.

    Create a new toll-free verification request

    It is required to create a Plivo profile before you can start the toll-free verification process via API.

    POST https://api.plivo.com/v1/Account/{auth_id}/TollfreeVerification/


    ParamDescription
    profile_uuid stringRequired

    The unique identifier of an existing Plivo profile.

    usecase stringRequired

    The messaging use case(s) for which the toll-free number will be used. This should be set as one or more of the following options:

    • 2FA
    • ACCOUNT_NOTIFICATION
    • CUSTOMER_CARE
    • DELIVERY_NOTIFICATION
    • FRAUD_ALERT
    • HIGHER_EDUCATION
    • MARKETING
    • POLLING_VOTING
    • PUBLIC_SERVICE_ANNOUNCEMENT
    • SECURITY_ALERT

    One use case is mandatory. Multiple use cases can be added as a string.

    Example
    "2FA, CUSTOMER_CARE"

    usecase_summary stringRequired

    The explanation of how messaging will be used on this toll-free phone number by your business. To enter multiple summaries, follow one of these best practices:

    Example 1
    "1. We send 2FA codes to customers when they sign up. 2. We send notifications to customers when they have signed up successfully.."

    Example 2 "TWO_FACTOR_AUTHENTICATION - We send 2FA codes to customers when they sign up. ACCOUNT_NOTIFICATIONS - We send notifications to customers when they have signed up successfully."
    Max character limit = 500.

    message_sample stringRequired

    Sample message(s) that you will send to the end user/mobile device. To enter multiple samples, follow one of these best practices:

    Example 1
    "1. Your Plivo verification code is xxxx. 2. Dear <customer name>, you have signed up on Plivo successfully."

    Example 2 "Sample1 - Your Plivo verification code is xxxx. Sample2 - Dear <customer name>, you have signed up on Plivo successfully."
    Max character limit = 1000.

    optin_image_url stringRequired

    A valid URL where you submit images demonstrating the opt-in process for the end user. Multiple URLs are allowed as a string.

    Example
    "https://www.url1.com, https://www.url2.com"

    optin_type stringRequired

    Describes how a user opts into text messages. One of the following exact values should be provided:

    • VERBAL
    • WEB_FORM
    • PAPER_FORM
    • VIA_TEXT
    • MOBILE_QR_CODE

    -VERBAL must include the sample verbal consent collection and examples in a document linked in the optin_image_url parameter.
    -WEB_FORM must include the link to the form in the optin_image_url parameter.
    -PAPER_FORM must include a link to the form in the optin_image_url parameter. It can be a scanned image.
    -VIA_TEXT must describe the keyword campaign in a document linked in the optin_image_url parameter.
    -MOBILE_QR_CODE must include the QR code in a document linked in the optin_image_url parameter.
    The sample submitted in the opt-in_image_url parameter should match the opt-in type selection.

    volume stringRequired

    An estimate of the monthly volume of messages you will send from the toll-free number. One of the following exact values should be provided:

    • 1,000
    • 10,000
    • 100,000
    • 250,000
    • 500,000
    • 750,000
    • 1,000,000
    • 5,000,000
    • 10,000,000+

    If your monthly volumes are expected to increase, it is advisable to provide a value that accommodates the projected growth and remains suitable for the next six to eight months.

    additional_information string

    Any additional information related to your website, such as a link to the terms of service page or privacy policy that can clarify the verification request.

    Example: “Refer to our privacy policy page here: https://www.plivo.com/legal/privacy/. Under the section "privacy" we clearly explain how we collect, store, and process the customer's personal data including their phone number. Under the sub-section ‘Rights over your personal data’, we also explain in detail the rights a customer has over the collected data and how they can exercise those rights.”
    Max character limit = 500.

    extra_data string

    Any additional information that you would like to pass for your internal references.

    Example: Internal ticket reference number - 121111
    Max character limit = 100.

    number stringRequired

    The toll-free number in e.164 format for which verification is being initiated. Only US and Canadian toll-free numbers will be accepted.

    Only one toll-free number can be provided.

    callback_urlstring

    A valid URL where verification-related callbacks will be sent.

    Response

    HTTP Response code - 201
    
    {
       "api_id": "ffe33a14-81fc-11ee-b92a-0242ac110005",
       "message": "created",
       "uuid": "4a59de5e-204a-47e8-6973-e713f9a1e0ce"
    }
    

    Get details of a verification request

    Use this API to get details of a single toll-free number’s verification status.

    GET https://api.plivo.com/v1/Account/{auth_id}/TollfreeVerification/{uuid}/

    Response

    HTTP Response code - 200
    
    {
       "api_id": "aecbd496-81fd-11ee-b92a-0242ac110005",
       "uuid": "7f4b4d49-8d3f-422c-4f3d-5b0166223a4b",
       "profile_uuid": "bd781875-24f8-4f51-8472-85e697db24dX",
       "created": "2023-11-07T14:47:00.761439Z",
       "last_modified": "2023-11-07T14:47:00.761412Z",
       "message_sample": "Your Plivo verification code is xxxx.",
       "number": "18664892XXX",
       "optin_image_url": "https://abc.com/test1",
       "optin_type": "WEB_FORM",
       "status": "SUBMITTED",
       "usecase": "2FA",
       "usecase_summary": "We send 2FA codes to customers when they sign up.",
       "volume": "1,000",
       "additional_information": "Privacy policy: https://www.plivo.com/legal/privacy/",
       "extra_data": "Ticket 1",
       "callback_url": "https://abc.com/test2",
       "error_message": ""
    }
    

    Get details of all verification requests

    Use this API to get the statuses of all the toll-free number verification requests initiated from your Plivo account.

    GET https://api.plivo.com/v1/Account/{auth_id}/TollfreeVerification/

    Query parameters:

    ParamDescription
    number

    A single toll-free number.

    status

    A single toll-free verification status.

    profile_uuid

    A single profile_uuid

    created

    Filters records based on verification request creation date. The input is expected in YYYY-MM-DD format. This can be combined to create boundary search conditions based on date.

    created__gt: gt stands for greater than. Filters all records after the specified time.
    created__gte: gte stands for greater than or equal. Use this to get all records that were created after or exactly on the mentioned date/time.
    created__lt: lt stands for less than. Filters all records before the specified time.
    created__lte: lte stands for less than or equal. Use this to get all records that were created before or exactly on the mentioned date/time.

    The default search window is seven days.

    The maximum search window is 30 days.

    usecase

    One or more use-cases in comma-separated format. This is an exact search.

    If you enter one use case, Plivo returns the response where you have entered only one use case on the verification request.

    If you enter multiple use cases (comma separated), Plivo returns only those orders where this combination of use cases was entered to begin with.

    limit

    A limit on the number of responses to be returned. The limit can range between one and 20, and the default is 20.

    offset

    A pagination cursor to denote the number of objects by which the results should be offset.

    Response

    HTTP Status code - 200
    
    {
       "api_id": "c2b5a6ec-81ff-11ee-9447-0242ac110002",
       "meta": {
           "limit": 20,
           "next": null,
           "offset": 0,
           "previous": null,
           "total_count": 2
       },
       "objects": [
           {
               "additional_information": "Privacy policy: https://www.plivo.com/legal/privacy/",
               "callback_url": "https://abc.com/test3",
               "created": "2023-11-13T08:35:46.024584Z",
               "error_message": "",
               "extra_data": "",
               "last_modified": "2023-11-13T08:35:46.024543Z",
               "message_sample": "You have successfully updated the password for the Plivo account with email - xxxx@yyyy.com",
               "number": "18884353XXX",
               "optin_image_url": "https://abc.com/test4",
               "optin_type": "WEB_FORM",
               "profile_uuid": "bd781875-24f8-4f51-8472-85e697db24d8",
               "status": "SUBMITTED",
               "usecase": "ACCOUNT_NOTIFICATION",
               "usecase_summary": "We send account notifications to customers whenever they change the password for their account.",
               "uuid": "4bfde431-5317-43cc-644a-2b41e2af4e16",
               "volume": "10,000"
           },
           {
               "additional_information": "Privacy policy: https://www.plivo.com/legal/privacy/",
               "callback_url": "",
               "created": "2023-11-07T14:47:00.761439Z",
               "error_message": "",
               "extra_data": "Ticket 1",
               "last_modified": "2023-11-07T14:47:00.761412Z",
               "message_sample": "Your Plivo verification code is xxxx.",
               "number": "18664892XXX",
               "optin_image_url": "https://abc.com/test5",
               "optin_type": "WEB_FORM",
               "profile_uuid": "bd781875-24f8-4f51-8472-85e697db24d8",
               "status": "SUBMITTED",
               "usecase": "2FA",
               "usecase_summary": "We send 2FA codes to customers when they sign up.",
               "uuid": "7f4b4d49-8d3f-422c-4f3d-5b0166223a4b",
               "volume": "100"
           }
       ]
    }
    

    Update a verification request

    You can update an existing toll-free verification request if the status of the existing toll-free verification request is listed as SUBMITTED or UPDATE_REQUIRED.

    POST https://api.plivo.com/v1/Account/{auth_id}/TollfreeVerification/{uuid}/


    ParamDescription
    profile_uuid

    The unique identifier of an existing Plivo profile.

    usecase

    The messaging use case(s) for which the toll-free number will be used. This should be set as one or more of the following options:

    • 2FA
    • ACCOUNT_NOTIFICATION
    • CUSTOMER_CARE
    • DELIVERY_NOTIFICATION
    • FRAUD_ALERT
    • HIGHER_EDUCATION
    • MARKETING
    • POLLING_VOTING
    • PUBLIC_SERVICE_ANNOUNCEMENT
    • SECURITY_ALERT
    One use case is mandatory. Multiple use cases can be added in comma-separated format.

    usecase_summary

    The explanation of how messaging will be used on this toll-free phone number by your business. To enter multiple summaries, you can follow one of these best practices:

    Example 1 "1. We send 2FA codes to customers when they sign up. 2. Dear <customer name>, you have signed up on Plivo successfully."

    Example 2 "TWO_FACTOR_AUTHENTICATION - We send 2FA codes to customers when they sign up. ACCOUNT_NOTIFICATIONS - We send notifications to customers when they have signed up successfully."

    Max character limit = 500.

    message_sample

    Sample message(s) that you will send to the end-user/mobile device. To enter multiple samples, follow one of these best practices:

    Example 1 "1. Your Plivo verification code is xxxx. 2. Dear <customer name>, you have signed up on Plivo successfully."

    Example 2 "Sample1 - Your Plivo verification code is xxxx. Sample2 - Dear <customer name>, you have signed up on Plivo successfully."

    Max character limit = 1000.

    optin_image_url

    A valid URL where you submit images explaining details of the opt-in process for the end user.
    Multiple URLs are allowed, separated by commas.

    optin_type

    Describes how a user opts into text messages. Provide one of the following exact values:

    • VERBAL
    • WEB_FORM
    • PAPER_FORM
    • VIA_TEXT
    • MOBILE_QR_CODE
    -VERBAL must include the sample verbal consent collection and examples in a document linked in the optin_image_url parameter.
    -WEB_FORM must include the link to the form in the optin_image_url parameter.
    -PAPER_FORM must include a link to the form in the optin_image_url parameter. It can be a scanned image.
    -VIA_TEXT must describe the keyword campaign in a document linked in the optin_image_url parameter.
    -MOBILE_QR_CODE must include the QR code in a document linked in the optin_image_url parameter.


    The sample submitted in the opt-in_image_url parameter should match the opt-in type selection.

    volume

    An estimate of the monthly volume of messages you will send from the toll-free number. One of the following exact values should be provided:

    • 1,000
    • 10,000
    • 100,000
    • 250,000
    • 500,000
    • 750,000
    • 1,000,000
    • 5,000,000
    • 10,000,000+
    If your monthly volumes are expected to increase, it is advisable to provide a value that accommodates the projected growth and remains suitable for the next six to eight months.

    additional_information

    Any additional information related to your website, such as a link to the terms of service page of the website or privacy policy that can clarify the verification request.

    Max character limit = 500.

    extra_data

    Any extra information that you would like to include for your own internal reference.

    callback_url

    A valid URL where verification-related callbacks will be sent.

    Response

    HTTP Response code - 202
    
    {
       "api_id": "c74aa53a-8200-11ee-b92a-0242ac110005",
       "message": "Tollfree verification request for uuid 4bfde431-5317-43cc-644a-2b41e2af4e16 updated successfully."
    }
    
    

    Delete a verification request

    You can delete an existing verification request that’s listed under the status: SUBMITTED, PROCESSING, or UPDATE_REQUIRED.

    DELETE https://api.plivo.com/v1/Account/{auth_id}/TollfreeVerification/{uuid}/


    HTTP Response code - 204

    Toll-free verification statuses

    TF verification statusDescription
    SUBMITTED

    The carrier has accepted the submission and is reviewing the request.

    APPROVED

    TThe request has been verified by the carrier.

    REJECTED

    The carrier has rejected the toll-free verification request. The use case cannot be submitted for verification anymore.

    UPDATE_REQUIRED

    Verification submission has been put on hold and the carrier has requested additional data to validate the request.

    You need to provide this additional information via the Update API request.

    If you do not provide details within six days from when the status is posted, the open request will be closed and the toll-free verification status will change to REJECTED.

    Callbacks

    A callback with the status of the verification request is sent to the callback_url (if specified) whenever there is a change in status as follows:

    • toll-free verification status changes from SUBMITTED to APPROVED, REJECTED, or UPDATE_REQUIRED.
    • toll-free verification status changes from UPDATE_REQUIRED to APPROVED or REJECTED.

    Media

    Media APIs let you manage all the media in your account via an API request.

    API Endpoint

    BaseURI https://api.plivo.com/v1/Account/{auth_id}/Media/

    The Media Object

    The Media Object represents media in the system.

    Attributes

    content_type

    The content type of the media.

    Valid content types accepted: JPG, PNG, MP4, Gimp, PDF, text.

    file_name

    The name of the file that was uploaded to the system.

    media_id

    A unique identifier for the media for a given auth_id.

    media_url

    The location of the media resource on Plivo’s system.

    Unused media have a time to live (TTL) of 6 hours. Uploaded media will be deleted from our system if it remains unused for sending an MMS message 6 hours from the time of upload. Used media is persisted forever.

    media_size

    Size of the media in bytes.

    Media with size greater than 2MB are not accepted.

    upload_time

    Time at which the media was uploaded to Plivo’s system.

    Retrieve Media

    This API lets you retrieve a media file that was uploaded, sent, or received by a user.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Media/{media_id}/

    Arguments

    No arguments need to be passed.

    Returns

    This API call returns the details of the media files identified by the media_id specified in the request URL.

    Example Request

    1
    2
    3
    4
    
    import plivo
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.media.get('media_id')
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    begin
     response = api.media.get('media_id')
     puts response
     rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    let plivo = require('plivo');
    
    let client = new plivo.Client('<auth_id>', '<auth_token>');
    client.media.get("<media_id>").then(
      function (media) {
        console.log("\n============ response ===========\n", media)
      }
    ).catch(function (response) {
      console.log("\n============ Error :: ===========\n", response);
    });
    

    Was this code helpful

    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>");
    $client->client->setTimeout(40);
    
    
    // Get a paticular Media
    try {
        $response = $client->media->get('<media_id>');
         print_r($response);
     }
     catch (PlivoRestException $ex) {
         print_r($ex);
     }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    package com.plivo.api;
    import java.io.IOException;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.base.ListResponse;
    import com.plivo.api.models.media.Media;
    
    public class Test {
      public static void main(String[] args) {
        Plivo.init("<auth_id>", "<auth_token>");
        try {
          Media p = Media.getter("media_id").get();
          System.out.println(p);
        } catch (IOException e) {
          e.printStackTrace();
        } catch (PlivoRestException e) {
          e.printStackTrace();
        }
      }
    }
    

    Was this code helpful

    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 Plivo;
    using Plivo.Exception;
    
    namespace SdkTestDotnet
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Media.Get("media_id");
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user auth_id:auth_token \
      https://api.plivo.com/v1/Account/{auth_id}/Media/{media_id}/
    

    Was this code helpful

    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
    
    package main
    
    import (
    	"fmt"
    
    	plivo "github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    
    	// MAIN ACCOUNT
    	client, err := plivo.NewClient("<auth_id>",
    		"<auth_token>",
    		&plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    
    	// get a specific media
    	getResp, err := client.Media.Get("<media_id>")
    	if err != nil {
    		panic(err)
    	}
    	fmt.Printf("Response: %#v\n", getResp)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "api_id": "<api_id>",
        "content_type": "image/png",
        "file_name": "SampleFile.png",
        "media_id": "<media_id>",
        "size": 700670,
        "upload_time": "2020-02-17T07:53:36.643522Z",
        "media_url": "https://media.plivo.com/Account/<auth_id>/Media/<media_id>"
    }
    

    List Media

    This API lets you fetch a list of media associated with a given auth_id.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Media/

    Arguments

    limit integer

    Denotes the number of results per page. The maximum number of results that can be fetched is 20. Defaults to 20.

    offset integer

    Denotes the number of value items by which the results should be offset. Defaults to 0. Read more about offset-based pagination.

    Returns

    Returns a JSON response containing the list of media_files uploaded or associated with the given user.

    Example Request

    1
    2
    3
    4
    
    import plivo
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.media.list()
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    begin
     response = api.media.list()
     puts response
     rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    let plivo = require('plivo');
    
    let client = new plivo.Client('<auth_id>', '<auth_token>');
    client.media.list().then(
      function (media) {
        console.log("\n============ response ===========\n", media)
      }
    ).catch(function (response) {
      console.log("\n============ Error :: ===========\n", response);
    });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>","<auth_token>");
    $client->client->setTimeout(40);
    
    //List all media
    try {
        $response = $client->media->list();
         print_r($response);
     }
     catch (PlivoRestException $ex) {
         print_r($ex);
     }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    package com.plivo.api;
    import java.io.IOException;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.base.ListResponse;
    import com.plivo.api.models.media.Media;
    
    public class Test {
      public static void main(String[] args) {
        Plivo.init("<auth_id>", "<auth_token>");
        try {
          ListResponse<Media> p = Media.lister().list();
          System.out.println(p);
        } catch (IOException e) {
          e.printStackTrace();
        } catch (PlivoRestException e) {
          e.printStackTrace();
        }
      }
    }
    

    Was this code helpful

    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 Plivo;
    using Plivo.Exception;
    
    namespace SdkTestDotnet
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Media.List();
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    
    curl -i --user auth_id:auth_token \
      https://api.plivo.com/v1/Account/{auth_id}/Media/
    

    Was this code helpful

    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
    
    package main
    
    import (
    	"fmt"
    
    	plivo "github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    
    	// MAIN ACCOUNT
    	client, err := plivo.NewClient("<auth_id>",
    		"<auth_token>",
    		&plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    
    	// list all media in account
    	listResp, err := client.Media.List(plivo.MediaListParams{Limit: 20, Offset: 0})
    	if err != nil {
    		panic(err)
    	}
    	fmt.Printf("Response: %#v\n", listResp)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "api_id": "<api_id>",
        "meta": {
            "limit": 20,
            "next": "/v1/Account/<auth_id>/Media?offset=20&limit=20",
            "offset": 0,
            "previous": "/v1/Account/<auth_id>/Media?offset=0&limit=20"
            "total_count": 44
        },
        "objects": [
            {
                "content_type": "image/jpeg",
                "file_name": "sample2.jpg",
                "media_id": "<media_id>",
                "size": 113730,
                "upload_time": "2020-02-17T05:46:54.481186Z",
                "media_url": "https://media.plivo.com/Account/<auth_id>/Media/<media_id>"
            },
            .
            .
            .
            .
           {
                "content_type": "application/pdf",
                "file_name": "pdf_sample.pdf",
                "media_id": "<media_id>",
                "size": 309500,
                "upload_time": "2020-02-17T08:32:41.924866Z",
                "media_url": "https://media.plivo.com/Account/<auth_id>/Media/<media_id>"
            }
        ]
    }
    

    Upload Media

    This API lets you upload media files to be used in sending MMS messages. Plivo supports up to 10 attachments in an upload API/SDK call with a maximum of 2MB per attachment. 

    • Media uploaded and sent to customers through MMS is saved in the system for 1 year.
    • Unused media (media that is uploaded but not used for sending an MMS message) is deleted after 6 hours.

    API Endpoint

    POST https://api.plivo.com/v1/Account/{auth_id}/Media/

    Headers

    The content-type header should be set to multipart/form-data

    Arguments

    filetype(file)Required This argument allows you to attach one or more (max 10) files as attachments in the body of the request.

    Returns

    Returns a JSON response containing the list of media objects uploaded.

    Example Request

    1
    2
    3
    4
    5
    
    import plivo
    client = plivo.RestClient("<auth_id>", "<auth_token>")
    response = client.media.upload(['<video/image file path>',
    '<video/image file path>'])
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    begin
     response = api.media.upload(['file_to_upload1''])
     puts response
     rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    let plivo = require('plivo');
    
    let client = new plivo.Client('<auth_id>', '<auth_token>');
    client.media.upload(["/tmp/test.jpeg","/tmp/test2.jpeg"]).then(
      function (media) {
        console.log("\n============ response ===========\n", media)
      }
    ).catch(function (response) {
      console.log("\n============ Error :: ===========\n", response);
    });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>","<auth_token>");
    try {
      $response = $client->media->upload(['path or url','xxx.jpg']); #file path
      print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    package com.plivo.api;
    import java.io.IOException;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.media.Media;
    
    public class Test {
        public static void main(String[] args) {
          Plivo.init("<auth_id>", "<auth_token>");
          try {
            MediaResponse mediaResponse = Media.creator(new String[]{"upload_file1","upload_file2"}).create();
            System.out.println(mediaResponse);
          } catch (IOException e) {
            e.printStackTrace();
          } catch (PlivoRestException e) {
            e.printStackTrace();
          }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    using System;
    using Plivo;
    using Plivo.Exception;
    
    namespace SdkTestDotnet
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    string[] files = { "file_to_upload1", "file_to_upload2"};
                    var response = api.Media.Upload(files);
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    
    curl -i --user auth_id:auth_token \
      -H "Content-Type: multipart/form-data" \
      --form 'file=@local_path_of_image'\
      https://api.plivo.com/v1/Account/{auth_id}/Media/
    

    Was this code helpful

    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
    32
    33
    
    package main
    
    import (
    	"fmt"
    
    	plivo "github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    
    	// MAIN ACCOUNT
    	client, err := plivo.NewClient("<auth_id>",
    		"<auth_token>",
    		&plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    
    	//upload media
    	uploadResp, err := client.Media.Upload(plivo.MediaUpload{
    		UploadFiles: []plivo.Files{
    			plivo.Files{
    				FilePath:    "<file_path>",
    				ContentType: "<content_type>",
    			},
    		},
    	},
    	)
    	if err != nil {
    		panic(err)
    	}
    	fmt.Printf("Response: %#v\n", uploadResp)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "api_id": "<api_id>",
        "objects": [
            {
                "content_type": "image/jpeg",
                "file_name": "sample_file1.jpg",
                "media_id": "<media_id>",
                "size": 85277,
                "status": "success",
                "status_code": 201,
                "upload_time": "2021-02-17T07:16:09.153289Z",
                "media_url": "https://media.plivo.com/Account/<auth_id>/Media/<media_id>"
            },
            {
                "content_type": "image/png",
                "file_name": "sample_file2.png",
                "media_id": "<media_id>",
                "size": 16709,
                "status": "success",
                "status_code": 201,
                "upload_time": "2021-02-18T11:21:55.972100055Z",
                "media_url": "https://media.plivo.com/Account/<auth_id>/Media/<media_id>"
            }
        ]
    }
    

    Powerpack

    Powerpack APIs let you manage all of the Powerpacks and number pools in your account via an API request.

    API Endpoint

    BaseURI https://api.plivo.com/v1/Account/{auth_id}/Powerpack/

    Create a Powerpack

    This API lets you to create a Powerpack via Plivo’s SMS service.

    API Endpoint

    POST https://api.plivo.com/v1/Account/{auth_id}/Powerpack/

    Arguments

    namestringRequired Must be unique across all Powerpacks in customer’s account.
    sticky_senderBoolean

    Whether Sticky Sender should be enabled by default. Sticky Sender ensures messages to a particular destination number are always sent from the same source number.

    Defaults to true.

    local_connectBoolean

    Whether Local Connect should be enabled by default. Local Connect prioritizes local numbers matched on area code and state over other numbers in the pool.

    Defaults to true.

    application_typeString

    Conditional Must be specified if application_id is specified.

    Allowed values: xml, phlo

    application_idStringMust be set to a valid PHLO or XML App ID or "none" (String). If not specified (or set to "none") no application to be associated with phone numbers added to this Powerpack.

    Returns

    Returns a JSON response containing the Powerpack resource object.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    import plivo
    import json
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    number_priorities = [{'country_iso': 'US',
                         'priority': {'priority1': 'shortcode',
                         'priority2': 'longcode', 'priority3': 'tollfree'},
                         'service_type': 'SMS'}]
    powerpack = client.powerpacks.create(name="<new_powerpack_name>",sticky_sender=True, number_priority=number_priorities)
    print(powerpack)
    

    Was this code helpful

    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
    
    require 'rubygems'
    require 'plivo'
    require 'json'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    
    	# Define Priority
    	number_priority_json = Array[{"country_iso"=>"US", 
    		"priority"=>{"priority1"=>"tollfree", "priority2"=>"longcode", "priority3"=>"shortcode"}, 
    	"service_type"=>"SMS"}]
    
    	# Create a Powerpack
    	response = api.powerpacks.create('<new_powerpack_name>', 
    		sticky_sender: true, 
    		local_connect: false,
    	number_priority: number_priority_json)
    
    	puts response
    rescue PlivoRESTError => e
    	puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    let plivo = require('plivo');
    
    let client = new plivo.Client('<auth_id>', '<auth_token>');
    
    // Create Powerpack
    var params = {
        sticky_sender: true,
        local_connect: true,
        number_priority: [{
            service_type: "MMS",
            country_iso: "CA",
            priority: {
                priority1: "longcode",
                priority2: "shortcode",
                priority3: "tollfree"
            }
        }]
    };
    client.powerpacks.create("<new_powerpack_name>", params).then(function (result) {
        console.log(result)
    });
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    
    $client->client->setTimeout(120);
    $optionalArgs = array(
        "limit" => 2,
        "offset" => 0
    );
    
    // Create Priority Json
    $priority = array(
        "priority1" => "tollfree",
        "priority2" => "longcode",
        "priority3" => "shortcode"
    );
    
    // Create Number Priority Json
    $number_priority = array(
        "country_iso" => "US",
        "priority" => $priority,
        "service_type" => "SMS"
    );
    
    // Create a New Powerpack - Flexible Priority
    try
    {
        $response = $client
            ->powerpacks
            ->create('<new_powerpack_name>', ['sticky_sender' => true, 'local_connect' => true, 'number_priority' => array(
            $number_priority
        ) ]);
        print_r($response);
    }
    catch(PlivoRestException $ex)
    {
        print_r($ex);
    }
    

    Was this code helpful

    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
    
    package com.plivo.api;
    
    import com.plivo.api.models.base.ListResponse;
    import com.plivo.api.models.powerpack.Powerpack;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.powerpack.PowerpackResponse;
    import java.io.IOException;
    
    public class PowerpackTest {
        public static void main(String[] args) {
            Plivo.init("<auth_id>", "<auth_token>");
            // Create Powerpack
            NumberPriority[] numberPriorities = new NumberPriority[1];
            // Priority(""priority1"",""priority2"", ""priority3"")
            Priority priority = new Priority("shortcode", "tollfree", "longcode");
            // NumberPriority(""country_iso"", ""priority"", ""service_type"")
            NumberPriority numberPriority = new NumberPriority("US", priority, "SMS");
            numberPriorities[0] = numberPriority;
            try {
                PowerpackResponse response = Powerpack.creator("<new_powerpack_name>")
                    .number_priority(numberPriorities)
                    .create();
                System.out.println(response);
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    using Plivo.Resource.Powerpack;
    // using Plivo.Resource.Powerpack.NumberPriority;
    
    namespace dotnet_project {
      class Sms {
        public static void Main(string[] args) {
    
          var api = new PlivoApi("<auth_id>", "<auth_token>");
    
          // Define Priority
          Priority p1 = new Priority();
          p1.priority1 = "longcode";
          p1.priority2 = "shortcode";
          p1.priority3 = "tollfree";
    
          // Set Number Priority based on service_type & country
          NumberPriority numberPriority = new NumberPriority();
          numberPriority.service_type = "SMS";
          numberPriority.country_iso = "US";
          numberPriority.priority = p1;
    
          List < NumberPriority > list = new List < NumberPriority > () {numberPriority};
    
          // Create a Powerpack
          Console.WriteLine("Create a Powerpack");
          try {
            var response = api.Powerpacks.Create(
                name: "<powerpack_name>",
                sticky_sender: true,
                local_connect: false,
                number_priority: list);
            Console.WriteLine(response);
          } catch (PlivoRestException e) {
            Console.WriteLine("Exception:" + e.Message);
          }
    
        }
      }
    }
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    
    curl --location --request POST 'https://api.plivo.com/v1/Account/<auth_id>/Powerpack/' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic xxxxxxxxxxxxx' \
    --data-raw '{
            "name": "<new powerpack name>",
            "sticky_sender": false,
        "number_priority": [
            {
                "country_iso": "US",
                "priority": {
                    "priority1": "longcode",
                    "priority2": "shortcode",
                    "priority3": "tollfree"
                },
                "service_type": "MMS"
            },
            {
                "country_iso": "CA",
                "priority": {
                    "priority1": "longcode",
                    "priority2": "shortcode",
                    "priority3": "tollfree"
                },
                "service_type": "SMS"
            },
            {
                "country_iso": "US",
                "priority": {
                    "priority1": "longcode",
                    "priority2": "shortcode",
                    "priority3": "tollfree"
                },
                "service_type": "SMS"
            },
            {
                "country_iso": "CA",
                "priority": {
                    "priority1": "longcode",
                    "priority2": "shortcode",
                    "priority3": "tollfree"
                },
                "service_type": "MMS"
            }
        ],
        "local_connect": true
    }
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    
    package main
    
    import (
        "fmt"
        plivo "github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    
        client, err: = plivo.NewClient("<auth_id>", "<auth_token>", & plivo.ClientOptions {})
        if err != nil {
            panic(err)
        }
    
        // Define Priority
        priority: = plivo.Priority {
            Priority1: strPtr("shortcode"),
            Priority2: strPtr("tollfree"),
            Priority3: strPtr("longcode")
        }
    
        np_json: = plivo.NumberPriority {"SMS", "CA", priority}
        priority_array: = [] plivo.NumberPriority 
    	{
            np_json
        }
    
        // Create a Powerpack
        response, err: = client.Powerpack.Create(plivo.PowerackCreateParams {
            Name: "<new_powerpack_name>",
            StickySender: false,
            LocalConnect: true,
            NumberPriorities: priority_array,
        }, )
        if err != nil {
            panic(err)
        }
        fmt.Printf("Response: % #v\ n ", response)
    
    }
    
    func strPtr(s string) * string {
        return &s
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
       "api_id":"8b583f08-ae57-11eb-8840-0242ac110003",
       "application_id":"",
       "application_type":"",
       "created_on":"2020-09-23T09:31:25.924044Z",
       "local_connect":true,
       "name":"<powerpack_name>",
       "number_pool":"/v1/Account/<power_uuid>/NumberPool/<numberpool_id>/",
       "number_priority":[
          {
             "country_iso":"US",
             "priority":{
                "priority1":"shortcode",
                "priority2":"tollfree",
                "priority3":"longcode"
             },
             "service_type":"MMS"
          },
          {
             "country_iso":"CA",
             "priority":{
                "priority1":"shortcode",
                "priority2":"tollfree",
                "priority3":"longcode"
             },
             "service_type":"SMS"
          },
          {
             "country_iso":"US",
             "priority":{
                "priority1":"shortcode",
                "priority2":"longcode",
                "priority3":"tollfree"
             },
             "service_type":"SMS"
          },
          {
             "country_iso":"CA",
             "priority":{
                "priority1":"longcode",
                "priority2":"tollfree",
                "priority3":"shortcode"
             },
             "service_type":"MMS"
          }
       ],
       "sticky_sender":true,
       "uuid":"<powerpack_uuid>"
    }
    

    Update a Powerpack

    Change a Powerpack’s name, sticky_sender, local_connect, or the application connected to it.

    API Endpoint

    POST https://api.plivo.com/v1/Account/{auth_id}/Powerpack/{powerpack_uuid}/

    Arguments

    namestringMust be unique across all Powerpacks in customer’s account.
    sticky_senderBoolean

    Whether Sticky Sender should be enabled by default. Sticky Sender ensures messages to a particular destination number are always sent from the same source number.

    Defaults to true.

    local_connectBoolean

    Whether Local Connect should be enabled by default. Local Connect prioritizes local numbers matched on area code and state over other numbers in the pool.

    Defaults to true.

    application_typeBoolean

    Conditional Must be specified if application_id is specified and is not "none".

    Allowed values: xml, phlo

    application_idString

    Must be set to a valid PHLO or XML App ID or "none" (String). If not specified (or set to "none") no application to be associated with phone numbers added to this Powerpack.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    import plivo
    import json
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    params = {}
    number_priorities = [
        {'country_iso': 'US',
        'priority': {'priority1': 'longcode', 'priority2': 'tollfree', 'priority3': 'shortcode'},
        'service_type': 'SMS'
        }]
    params["name"] = "<update_powerpack_name>"
    params["number_priority"] = number_priorities
    
    response = powerpack.update(params)
    print(response)
    

    Was this code helpful

    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
    
    require 'rubygems'
    require 'plivo'
    require 'json'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    
    begin
    	powerpack = api.powerpacks.get("<Powerpack_Name>")
    
    	# Define Priority
    	number_priority_json = Array[{"country_iso"=>"US",
        "priority"=>{"priority1"=>"tollfree","priority2"=>"longcode","priority3"=>"shortcode"}, 
        "service_type"=>"SMS"}]
    
    	# Update Powerpack
    	response = powerpack.update(name: '<update_powerpack_name>', 
    		sticky_sender: true, 
    		local_connect: false,
    	number_priority: number_priority_json)
    
    	puts response
    rescue PlivoRESTError => e
    	puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    let plivo = require('plivo');
    
    let client = new plivo.Client('<auth_id>', '<auth_token>');
    
    // Update Powerpack
    var params = {
        number_priority: [{
            service_type: "MMS",
            country_iso: "CA",
            priority: {
                priority1: "tollfree",
                priority2: "shortcode",
                priority3: "longcode"
            }
        }]
    };
    client.powerpacks.update("<powerpack_uuid>", params).then(function (result) {
        console.log(result)
    });
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    
    $client->client->setTimeout(120);
    $optionalArgs = array(
        "limit" => 2,
        "offset" => 0
    );
    
    //  Create Priority Json
    $priority = array(
        "priority1" => "tollfree",
        "priority2" => "longcode",
        "priority3" => "shortcode"
    );
    
    //  Create Number Priority Json
    $number_priority = array(
        "country_iso" => "US",
        "priority" => $priority,
        "service_type" => "SMS"
    );
    
    // Update a Powerpack - Flexible Priority
    try
    {
        $powerpack = $client->powerpacks->get("<powerpack_uuid>");
        $response = $powerpack->update(["name" => "<powerpack_name>", "number_priority" => array($number_priority)]);
        print_r($response);
    }
    catch(PlivoRestException $ex)
    {
        print_r($ex);
    }
    

    Was this code helpful

    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
    
    package com.plivo.api;
    
    import com.plivo.api.models.powerpack.Powerpack;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.powerpack.PowerpackUpdateResponse;
    import java.io.IOException;
    
    public class PowerpackTest {
        public static void main(String[] args) {
            Plivo.init("<auth_id>", "<auth_token>");
            // Update Powerpack
            try {
                Powerpack powerpack = Powerpack.getter("powerpack_uuid").get();
                NumberPriority[] numberPriorities = new NumberPriority[1];
                // Priority(""priority1"",""priority2"", ""priority3"")
                Priority priority = new Priority("shortcode", "tollfree", "longcode");
                // NumberPriority(""country_iso"", ""priority"", ""service_type"")
                NumberPriority numberPriority = new NumberPriority("CA", priority, "MMS");
                numberPriorities[0] = numberPriority;
                PowerpackUpdateResponse response = powerpack.updater().number_priority(numberPriorities).update();
                System.out.println(response);
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    using Plivo.Resource.Powerpack;
    // using Plivo.Resource.Powerpack.NumberPriority;
    
    namespace dotnet_project
    {
        class Sms
        {
            public static void Main(string[] args)
            {
    
                var api = new PlivoApi("<auth_id>","<auth_token>");
    
                // Define Priority
                Priority p1 = new Priority();
                p1.priority1 = "longcode";
                p1.priority2 = "shortcode";
                p1.priority3 = "tollfree";
    
                // Set Number Priority based on service_type & country
                NumberPriority numberPriority = new NumberPriority();
                numberPriority.service_type = "SMS";
                numberPriority.country_iso = "US";
                numberPriority.priority = p1;
    
                List<NumberPriority> list = new List<NumberPriority>(){numberPriority};  
    
                // Update a Powerpack
                Console.WriteLine("Update a Powerpack");
                try
                {
                    var response = api.Powerpacks.Update(uuid: "<powerpack_uuid>",
                                                            name: "<powerpack_name>", 
                                                            sticky_sender: true,
                                                            local_connect: true,
                                                            number_priority: list);
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception:" + e.Message);
                }
    
            }
        }
    }"
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    
    curl --location --request POST 'https://api.plivo.com/v1/Account/<auth_id>/Powerpack/' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic xxxxxxxxxxxxx' \
    --data-raw '{
            "name": "<new powerpack name>",
            "sticky_sender": false,
        "number_priority": [
            {
                "country_iso": "US",
                "priority": {
                    "priority1": "longcode",
                    "priority2": "shortcode",
                    "priority3": "tollfree"
                },
                "service_type": "MMS"
            },
            {
                "country_iso": "CA",
                "priority": {
                    "priority1": "longcode",
                    "priority2": "shortcode",
                    "priority3": "tollfree"
                },
                "service_type": "SMS"
            },
            {
                "country_iso": "US",
                "priority": {
                    "priority1": "longcode",
                    "priority2": "shortcode",
                    "priority3": "tollfree"
                },
                "service_type": "SMS"
            },
            {
                "country_iso": "CA",
                "priority": {
                    "priority1": "longcode",
                    "priority2": "shortcode",
                    "priority3": "tollfree"
                },
                "service_type": "MMS"
            }
        ],
        "local_connect": true
    }
    

    Was this code helpful

    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
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    
    package main
    
    import (
        "fmt"
    
        plivo "github.com/plivo/plivo-go/v7"
    )
    
    func main() {
    
        client, err: = plivo.NewClient("<auth_id>", "<auth_token>", & plivo.ClientOptions {})
        if err != nil {
            panic(err)
        }
    
        // Define Priority
        priority: = plivo.Priority {
            Priority1: strPtr("shortcode"),
            Priority2: strPtr("tollfree"),
            Priority3: strPtr("longcode")
        }
    
        np_json: = plivo.NumberPriority {
            "SMS", "CA", priority
        }
        priority_array: = [] plivo.NumberPriority {
            np_json
        }
    
        // Create a Powerpack
        response, err: = client.Powerpack.Create(plivo.PowerackCreateParams {
            Name: "<new_powerpack_name>",
            StickySender: false,
            LocalConnect: true,
            NumberPriorities: priority_array,
        }, )
        if err != nil {
            panic(err)
        }
        fmt.Printf("Response: %#v\n", response)
    
    }
    
    func strPtr(s string) * string {
        return &s
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
       "api_id":"8b583f08-ae57-11eb-8840-0242ac110003",
       "application_id":"",
       "application_type":"",
       "created_on":"2020-09-23T09:31:25.924044Z",
       "local_connect":true,
       "name":"<powerpack_name>",
       "number_pool":"/v1/Account/<power_uuid>/NumberPool/<numberpool_id>/",
       "number_priority":[
          {
             "country_iso":"US",
             "priority":{
                "priority1":"shortcode",
                "priority2":"tollfree",
                "priority3":"longcode"
             },
             "service_type":"MMS"
          },
          {
             "country_iso":"CA",
             "priority":{
                "priority1":"shortcode",
                "priority2":"tollfree",
                "priority3":"longcode"
             },
             "service_type":"SMS"
          },
          {
             "country_iso":"US",
             "priority":{
                "priority1":"shortcode",
                "priority2":"longcode",
                "priority3":"tollfree"
             },
             "service_type":"SMS"
          },
          {
             "country_iso":"CA",
             "priority":{
                "priority1":"longcode",
                "priority2":"tollfree",
                "priority3":"shortcode"
             },
             "service_type":"MMS"
          }
       ],
       "sticky_sender":true,
       "uuid":"<powerpack_uuid>"
    }
    

    Retrieve a Powerpack

    Retrieves the details of a Powerpack resource.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Powerpack/{powerpack_uuid}/

    Arguments

    No arguments need to be passed.

    Returns

    This API call returns the details of the Powerpack resource identified by the powerpack_uuid specified in the request URL.

    Example Request

    1
    2
    3
    4
    5
    6
    
    import plivo
    import json
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    powerpack = client.powerpacks.get(uuid="<powerpack_uuid>")
    print str(powerpack)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
    require 'rubygems'
    require 'plivo'
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    begin
      response=api.powerpacks.get(uuid='<powerpack_uuid>')
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    var plivo = require('plivo');
    var client = new plivo.Client("<auth_id>","<auth_token>");
    
    client.powerpacks.get("<powerpack_uuid>")
    .then(function (result) {
       console.log(result)
    })
    .catch(function (response) {
       console.log(response);
    });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>","<auth_token>");
    $client->client->setTimeout(40);
    try {
        $powerpack = $client->powerpacks->get("<powerpack_uuid>");
        print_r($powerpack);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    package com.plivo.api;
    
    import com.plivo.api.models.powerpack.Powerpack;
    import com.plivo.api.exceptions.PlivoRestException;
    import java.io.IOException;
    
    public class PowerpackTest {
      public static void main(String[] args) {
        Plivo.init("<auth_id>", "<auth_token>");
        try {
          Powerpack powerpack = Powerpack.getter("<powerpack_uuid>").get();
          System.out.println(powerpack);
        }
        catch (  PlivoRestException | IOException e ) {
          e.printStackTrace();
        }
      }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    using System;
    using Plivo;
    using Plivo.Exception;
    using System.Collections.Generic;
    
    namespace test_apps
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Powerpacks.Create(name:"<powerpack_name>", sticky_sender:true);
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    
    curl -X GET -i --user auth_id:auth_token \
    -H "Content-Type: application/json" \
    https://api.plivo.com/v1/Account/{auth_id}/Powerpack/{powerpack_uuid}/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    package main
    
    import (
    	"fmt"
    
    	plivo "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.Powerpack.Get("<powerpack_uuid>")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
       "api_id":"8b583f08-ae57-11eb-8840-0242ac110003",
       "application_id":"",
       "application_type":"",
       "created_on":"2020-09-23T09:31:25.924044Z",
       "local_connect":true,
       "name":"<powerpack_name>",
       "number_pool":"/v1/Account/<power_uuid>/NumberPool/<numberpool_id>/",
       "number_priority":[
          {
             "country_iso":"US",
             "priority":{
                "priority1":"shortcode",
                "priority2":"tollfree",
                "priority3":"longcode"
             },
             "service_type":"MMS"
          },
          {
             "country_iso":"CA",
             "priority":{
                "priority1":"shortcode",
                "priority2":"tollfree",
                "priority3":"longcode"
             },
             "service_type":"SMS"
          },
          {
             "country_iso":"US",
             "priority":{
                "priority1":"shortcode",
                "priority2":"longcode",
                "priority3":"tollfree"
             },
             "service_type":"SMS"
          },
          {
             "country_iso":"CA",
             "priority":{
                "priority1":"longcode",
                "priority2":"tollfree",
                "priority3":"shortcode"
             },
             "service_type":"MMS"
          }
       ],
       "sticky_sender":true,
       "uuid":"<powerpack_uuid>"
    }
    

    List All Powerpacks

    Fetches a list of Powerpacks.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/Powerpack/

    Arguments

    limit integer

    Denotes the number of results per page. The maximum number of results that can be fetched is 20. Defaults to 20.

    offset integer

    Denotes the number of value items by which the results should be offset. Defaults to 0. Read more about offset-based pagination.

    Returns

    This API returns a list of Powerpack resources associated with the Account.

    The API response also contains a meta field with the following fields:

    • limit: the size of the page returned in the response
    • offset: the offset for the page returned in the response
    • total_count: the total number of records that match the specified filters
    • next: the URL that points to the next page of results
    • previous: the URL that points to the previous page of results

    Example Request

    1
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
    require 'rubygems'
    require 'plivo'
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    begin
      response = api.powerpacks.list(offset:0, limit:20)
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    var plivo = require('plivo');
    var client = new plivo.Client("<auth_id>","<auth_token>");
    
    client.powerpacks.list({'limit':'2', 'offset':'100'})
    .then(function (result) {
        console.log(result)})
    .catch(function (response) {
        console.log(response);
    });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>","<auth_token>");
    try {
        $response = $client->powerpacks->list();
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    package com.plivo.api;
    
    import com.plivo.api.models.base.ListResponse;
    import com.plivo.api.models.powerpack.Powerpack;
    import com.plivo.api.exceptions.PlivoRestException;
    import java.io.IOException;
    
    public class PowerpackTest {
      public static void main(String[] args) {
        Plivo.init("<auth_id>", "<auth_token>");
        try {
          ListResponse<Powerpack> powerpack = Powerpack.lister().list();
          System.out.println(powerpack);
        }
        catch (  PlivoRestException | IOException e ) {
          e.printStackTrace();
        }
      }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    using System;
    using Plivo;
    using Plivo.Exception;
    using System.Collections.Generic;
    
    namespace test_apps
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Powerpacks.List(offset:0,limit:2);
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    
    curl -X GET -i --user auth_id:auth_token \
    -H "Content-Type: application/json" \
    https://api.plivo.com/v1/Account/{auth_id}/Powerpack/
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    package main
    
    import (
    	"fmt"
    
    	plivo "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.Powerpack.List(plivo.PowerpackListParams{Limit: 1})
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "api_id": "e44c159e-0a02-11ea-b072-0242ac110007",
        "meta": {
            "limit": 20,
            "next": "/api/v1/account/MA2025RK4E639VJFZAGV/Powerpack?offset=20&limit=20",
            "offset": 0,
            "total_count": 53
        },
        "objects": [
            {
                "application_id": "",
                "application_type": "",
                "created_on": "2020-10-09T11:10:59.666461Z",
                "local_connect": true,
                "name": "test",
                "number_pool": "/v1/Account/MA2025RK4E639VJFZAGV/NumberPool/<number_pool_uuid>/",
                "sticky_sender": true,
                "uuid": "<powerpack_uuid>"
            },
            {
                "application_id": "",
                "application_type": "",
                "created_on": "2020-10-09T17:03:31.837944Z",
                "local_connect": false,
                "name": "p23",
                "number_pool": "/v1/Account/MA2025RK4E639VJFZAGV/NumberPool/<number_pool_uuid>/",
                "sticky_sender": false,
                "uuid": "<powerpack_uuid>"
            },
            {
                "application_id": "",
                "application_type": "",
                "created_on": "2020-10-09T16:54:34.0117Z",
                "local_connect": false,
                "name": "p22",
                "number_pool": "/v1/Account/MA2025RK4E639VJFZAGV/NumberPool/<number_pool_uuid>/",
                "sticky_sender": false,
                "uuid": "<powerpack_uuid>"
            }
    }
    

    Delete a Powerpack

    Deletes a single Powerpack. This operation cannot be undone.

    API Endpoint

    DELETE https://api.plivo.com/v1/Account/{auth_id}/Powerpack/{powerpack_uuid}/

    Attributes

    unrent_numbersThe number connected with the powerpack is unrented if set to true. Defaults to false

    Example Request

    1
    2
    3
    4
    5
    6
    
    import plivo
    import json
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    powerpack = client.powerpacks.get(uuid="powerpack_uuid")
    print str(powerpack.delete(False))
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    require 'rubygems'
    require 'plivo'
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    begin
      powerpack=api.powerpacks.get(uuid='your-powerpack-uuid')
      puts powerpack
      response = powerpack.delete(true)
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    var plivo = require('plivo');
    var client = new plivo.Client("<auth_id>","<auth_token>");
    
    client.powerpacks.get("powerpack_uuid").then(
       function (powerpack) {
         return powerpack.delete()
       })
     .then(function (result) {
       console.log(result)
     })
     .catch(function (response) {
       console.log(response);
     });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>","<auth_token>");
    $client->client->setTimeout(40);
    try {
        $powerpack = $client->powerpacks->get("your-powerpack-uuid");
        $response = $powerpack->delete(['unrent_numbers'=>true]);
        print_r($powerpack);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    package com.plivo.api;
    
    import com.plivo.api.models.powerpack.Powerpack;
    import com.plivo.api.exceptions.PlivoRestException;
    import java.io.IOException;
    
    public class PowerpackTest {
      public static void main(String[] args) {
        Plivo.init("<auth_id>", "<auth_token>");
        try {
          Powerpack powerpack = Powerpack.getter("powerpack_uuid").get();
          powerpack.deleter().unrent_numbers(true).delete();
        }
        catch (  PlivoRestException | IOException e ) {
          e.printStackTrace();
        }
      }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    using System;
    using Plivo;
    using Plivo.Exception;
    using System.Collections.Generic;
    
    namespace test_apps
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Powerpacks.Delete(uuid: "powerpack_uuid");
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    4
    
    curl -X DELETE -i --user auth_id:auth_token \
    -H "Content-Type: application/json" \
    -d '{"unrent_numbers": "False"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Powerpack/{powerpack_uuid}/
    

    Was this code helpful

    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
    
    package main
    
    import (
    	"fmt"
    
    	plivo "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
    	}
    	powerpack, err := client.Powerpack.Get("powerpack_uuid")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	response, err := powerpack.Delete(plivo.PowerpackDeleteParams{})
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200 OK

    Number pool resource

    An empty number pool resource is created automatically when a new Powerpack is created.

    Attributes

    uuidUnique identifier for the number pool.
    numbersSubresource URI
    shortcodesSubresource URI

    Example Object

    {
        "api_id": "d7e9a038-0a88-11ea-b072-0242ac110007",
        "numbers": "/v1/Account/{auth_id}/NumberPool/<number_pool_uuid>/Number/",
        "shortcodes": "/v1/Account/{auth_id}/NumberPool/<number_pool_uuid>/Shortcode/",
        "uuid": "<powerpack_uuid>"
    }
    

    Number pool numbers

    Attributes

    number_pool_uuid Unique identifier for the number pool.
    number String.
    type The type of number. One of: fixed, mobile, toll-free.
    service The service capability of number. One of: sms, mms.
    country_iso2 The ISO2 code of the country associated with the number.
    added_on Timestamp in ISO 8601 format.
    account_phone_number_resource Account phone number resource URI.

    Example Object

    {
        "account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
        "added_on": "2022-10-09T11:10:59.741978Z",
        "country_iso2": "US",
        "number": "{your_number}",
        "number_pool_uuid": "{number_pool_uuid}",
        "type": "fixed"
    }
    

    Add a number

    This API lets you add SMS- and MMS-enabled numbers to a number pool resource via Plivo’s SMS service.

    API Endpoint

    POST https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Number/{number}/

    Arguments

    service

    Set this parameter to sms for SMS-enabled numbers or mms for MMS-enabled numbers.

    Defaults to sms.

    Returns

    Returns a JSON response containing the added number resource detail.

    Example Request

    1
    2
    3
    4
    5
    6
    
    import plivo
    import json
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    powerpack = client.powerpacks.get(uuid="powerpack_uuid")
    print str(powerpack.add_number('your-number'))
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    require 'rubygems'
    require 'plivo'
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    begin
      powerpack = api.powerpacks.get(uuid='powerpack_uuid')
      puts powerpack
      response = powerpack.add_number(number='your_number')
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    var plivo = require('plivo');
    var client = new plivo.Client("<auth_id>","<auth_token>");
    
    client.powerpacks.get("powerpack_uuid")
        .then(function (powerpack) {
          return powerpack.add_number("<your_number>")
        })
        .then(function (result) {
            console.log(result)
        })
        .catch(function (response) {
            console.log(response);
        });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>","<auth_token>");
    $client->client->setTimeout(40);
    try {
        $powerpack = $client->powerpacks->get("your-powerpack-uuid");
        $response = $powerpack->add_number('your_number');
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    package com.plivo.api;
    
    import com.plivo.api.models.powerpack.Numbers;
    import com.plivo.api.models.powerpack.Powerpack;
    import com.plivo.api.exceptions.PlivoRestException;
    import java.io.IOException;
    
    public class PowerpackTest {
      public static void main(String[] args) {
        Plivo.init("<auth_id>", "<auth_token>");
        try {
          Powerpack powerpack = Powerpack.getter("powerpack_uuid").get();
          Numbers response = powerpack.add_number().number("<your_number>").get();
          System.out.println(response);
        }
        catch (  PlivoRestException | IOException e ) {
          e.printStackTrace();
        }
      }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    using System;
    using Plivo;
    using Plivo.Exception;
    using System.Collections.Generic;
    
    namespace test_apps
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Powerpacks.Get("powerpack_uuid");
                    Console.WriteLine(response.Add_Number("<your_number>"));
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    
    curl -X POST -i --user auth_id:auth_token \
    -H "Content-Type: application/json" \
    https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Number/{number}
    

    Was this code helpful

    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
    32
    33
    34
    35
    
    package main
    
    import (
    	"fmt"
    
    	plivo "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
    	}
    	powerpack, err := client.Powerpack.Get("powerpack_uuid")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	// Add SMS Number
    	sms_response, err := powerpack.Add_number("<sms_number>")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", sms_response)
    
    	// Add MMS Number
    	mms_response, err := powerpack.AddNumberWithOptions("<mms_number>", plivo.PowerpackAddNumberOptions{Service: "mms"})
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", mms_response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "account_phone_number_resource": "/v1/Account/<auth_id>/Number/<your_number>/",
        "added_on": "2022-10-09T11:24:35.085797Z",
        "api_id": "612982e8-0a87-11ea-b072-0242ac110007",
        "country_iso2": "CA",
        "number": "<your_number>",
        "number_pool_uuid": "<number_pool_uuid>",
        "service": "mms",
        "type": "fixed"
    }
    

    Retrieve a number

    Retrieves the details of the specified number from the specified number pool.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/{number}/

    Arguments

    No arguments need to be passed.

    Returns

    This API call returns the details for the number identified by the number specified in the request URL.

    Example Request

    1
    2
    3
    4
    5
    6
    
    import plivo
    import json
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    powerpack = client.powerpacks.get(uuid="powerpack_uuid")
    print str(powerpack.find_number('your-number'))
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    require 'rubygems'
    require 'plivo'
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    begin
      powerpack = api.powerpacks.get(uuid='powerpack_uuid')
      puts powerpack
      response = powerpack.find_number(number='your_number')
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    var plivo = require('plivo');
    var client = new plivo.Client("<auth_id>","<auth_token>");
    
    client.powerpacks.get("0166c910-1268-47c7-bf30-f5809ee843b9").then(
       function (powerpack) {
         return powerpack.find_number(
         "<your_number>"
         )
       })
     .then(function (result) {
       console.log(result)
     })
     .catch(function (response) {
       console.log(response);
     });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>","<auth_token>");
    $client->client->setTimeout(40);
    try {
        $powerpack = $client->powerpacks->get("your-powerpack-uuid");
        $response = $powerpack->find_number('your_number');
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    package com.plivo.api;
    
    import com.plivo.api.models.powerpack.Numbers;
    import com.plivo.api.models.powerpack.Powerpack;
    import com.plivo.api.exceptions.PlivoRestException;
    
    import java.io.IOException;
    
    public class PowerpackTest {
      public static void main(String[] args) {
        Plivo.init("<auth_id>", "<auth_token>");
        try {
          Powerpack powerpack = Powerpack.getter("powerpack_uuid").get();
          Numbers response = powerpack.find_number().number("<your_number>").get();
          System.out.println(response);
        }
        catch (  PlivoRestException | IOException e ) {
          e.printStackTrace();
        }
      }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    using System;
    using Plivo;
    using Plivo.Exception;
    using System.Collections.Generic;
    
    namespace test_apps
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Powerpacks.Get("powerpack_uuid");
                    Console.WriteLine(response.Find_Number("<your_number>"));
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    
    curl -X GET -i --user auth_id:auth_token \
    -H "Content-Type: application/json" \
    https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Number/{number}
    

    Was this code helpful

    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
    
    package main
    
    import (
    	"fmt"
    
    	plivo "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
    	}
    
    	// Get Powerpack
    	powerpack, err := client.Powerpack.Get("<powerpack_uuid>")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	// Retrieve a Number
    	response, err := powerpack.Find_numbers("<sms_or_mms_number>")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
        "added_on": "2022-10-09T11:24:35.085797Z",
        "api_id": "612982e8-0a87-11ea-b072-0242ac110007",
        "country_iso2": "CA",
        "number": "{your_number}",
        "number_pool_uuid": "{number_pool_uuid}",
        "type": "fixed"
    }
    

    List all numbers

    This API fetches a list of numbers from a number pool based on the number_pool_UUID specified in the resource URI.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Number/

    Arguments

    starts_with A comma-separated list of prefixes.
    Assume the values provided exclude the country code prefix.
    A max of 10 prefixes may be specified.
    Throws 400 Bad Request if more than 10 prefixes are specified.
    type fixed, toll-free, or mobile. Note that local and national numbers should be considered as ‘fixed’.
    service sms or mms. Use this argument to filter the numbers by capability.
    country_iso2Conditional ISO2 code of the phone number country.
    This attribute must be specified if the starts_with filter is specified.
    limit Used to display the number of results per page. The maximum number of results that can be fetched is 20. Defaults to 20.
    offset

    Denotes the number of value items by which the results should be offset. Defaults to 0. Read more about offset-based pagination.

     

    Returns

    This API returns the list of numbers from the number pool that match the filters specified in the request.

    The API response also contains a meta field with the following fields:

    • limit: The size of the page returned in the response.
    • next: The URL that points to the next page of results.
    • offset: The offset for the page returned in the response.
    • previous: The URL that points to the previous page of results.
    • total_count: The total number of records that match the specified filters.

    Example Request

    1
    2
    3
    4
    5
    6
    
    import plivo
    import json
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    powerpack = client.powerpacks.get(uuid="<powerpack_uuid>")
    print str(powerpack.list_numbers(starts_with=512, country_iso2='US'))
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    require 'rubygems'
    require 'plivo'
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    begin
      powerpack = api.powerpacks.get(uuid='<powerpack_uuid>')
      puts powerpack
      response = powerpack.list_numbers(limit: 2,offset: 0)
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    var plivo = require('plivo');
    var client = new plivo.Client("<auth_id>","<auth_token>");
    
    client.powerpacks
     .get("<powerpack_uuid>")
     .then(function (powerpack) {
       return powerpack.list_numbers({
         limit:'2',
         offset:'1'
       });
     })
     .then(function (result) {
       console.log(result);
     })
     .catch(function (response) {
       console.log(response);
     });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>","<auth_token>");
    
    try {
        $powerpack = $client->powerpacks->get("<powerpack_uuid>");
        $response = $powerpack->list_numbers(['starts_with'=>'441']);
    
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    package com.plivo.api;
    
    import com.plivo.api.models.base.ListResponse;
    import com.plivo.api.models.powerpack.Numbers;
    import com.plivo.api.models.powerpack.Powerpack;
    import com.plivo.api.exceptions.PlivoRestException;
    
    import java.io.IOException;
    
    public class PowerpackTest {
      public static void main(String[] args) {
        Plivo.init("<auth_id>", "<auth_token>");
        try {
          Powerpack powerpack = Powerpack.getter("<powerpack_uuid>").get();
          ListResponse<Numbers> response = powerpack.list_numbers().list();
          System.out.println(response);
        }
        catch (  PlivoRestException | IOException e ) {
          e.printStackTrace();
        }
      }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    using System;
    using Plivo;
    using Plivo.Exception;
    using System.Collections.Generic;
    
    namespace test_apps
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Powerpacks.List(offset:0,limit:2);
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    
    curl -X GET -i --user auth_id:auth_token \
    -H "Content-Type: application/json" \
    https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Number?starts_with=484&country_iso2=us’
    

    Was this code helpful

    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
    
    package main
    
    import (
    	"fmt"
    
    	plivo "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
    	}
    	powerpack, err := client.Powerpack.Get("<powerpack_uuid>")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	// List all Numbers - Use params to filter out mms or sms numbers
    	response, err := powerpack.List_numbers(plivo.PowerpackSearchParam{
    		Service: "mms",
    	})
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
      "api_id": "06c15d7c-7ed5-11ea-855f-0242ac110003",
      "meta": {
        "limit": 20,
        "next": "",
        "offset": 0,
        "previous": "",
        "total_count": 1
      },
      "objects": [
        {
          "account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
          "added_on": "2023-03-18T16:07:39.379739Z",
          "country_iso2": "US",
          "number": "{your_number}",
          "number_pool_uuid": "{number_pool_uuid}",
          "service": "mms",
          "type": "fixed"
        },
       {
          "account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
          "added_on": "2023-03-18T16:07:39.379739Z",
          "country_iso2": "US",
          "number": "{your_number}",
          "number_pool_uuid": "{number_pool_uuid}",
          "service": "sms",
          "type": "fixed"
        }
        {
          "account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_number}/",
          "added_on": "2022-10-09T11:24:35.085797Z",
          "country_iso2": "CA",
          "number": "{your_number}",
          "number_pool_uuid": "{number_pool_uuid}",
          "service": "sms",
          "type": "fixed"
        }
      ]
    }
    
    

    Remove a number

    Removes a number from a number pool.

    API Endpoint

    DELETE https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Number/{number}/

    Arguments

    unrentbooleanDefault is false if not specified.

    Returns

    This API call removes a number from a number pool identified by the number and number_pool_uuid specified in the request URL.

    Example Request

    1
    2
    3
    4
    5
    6
    
    import plivo
    import json
    
    client = plivo.RestClient('<auth_id>','<auth_token>')
    powerpack = client.powerpacks.get(uuid="powerpack_uuid")
    print str(powerpack.remove_number('your-number'))
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    require 'rubygems'
    require 'plivo'
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>","<auth_token>")
    begin
      powerpack = api.powerpacks.get(uuid='powerpack_uuid')
      puts powerpack
      response = powerpack.remove_number(number='your_number',unrent= true)
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    var plivo = require('plivo');
    var client = new plivo.Client("<auth_id>","<auth_token>");
    
    client.powerpacks.get("powerpack_uuid").then(
        function (powerpack) {
          return powerpack.remove_number(
           "<your_number>", true
          )
        })
      .then(function (result) {
        console.log(result)
      })
      .catch(function (response) {
        console.log(response);
      });
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>","<auth_token>");
    $client->client->setTimeout(40);
    try {
        $powerpack = $client->powerpacks->get("your-powerpack-uuid");
        $response = $powerpack->remove_number('your_number',['unrent'=>true]);
        print_r($response);
    }
    catch (PlivoRestException $ex) {
        print_r($ex);
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    package com.plivo.api;
    
    import com.plivo.api.models.powerpack.Numbers;
    import com.plivo.api.models.powerpack.Powerpack;
    import com.plivo.api.exceptions.PlivoRestException;
    
    import java.io.IOException;
    
    public class PowerpackTest {
      public static void main(String[] args) {
        Plivo.init("<auth_id>", "<auth_token>");
        try {
            Powerpack powerpack = Powerpack.getter("powerpack_uuid").get();
            powerpack.remove_number().number("<your_number>").delete();
        }
        catch (  PlivoRestException | IOException e ) {
            e.printStackTrace();
        }
      }
    }
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    using System;
    using Plivo;
    using Plivo.Exception;
    using System.Collections.Generic;
    
    namespace test_apps
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
                try
                {
                    var response = api.Powerpacks.Get("powerpack_uuid");
                    Console.WriteLine(response.Remove_Number("<your_number>"));
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    1
    2
    3
    
    curl -X DELETE -i --user auth_id:auth_token \
    -H "Content-Type: application/json" \
    https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Number/{number}
    

    Was this code helpful

    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
    
    package main
    
    import (
    	"fmt"
    
    	plivo "github.com/plivo/plivo-go/v7"
    )
    s
    func main() {
    
    	client, err := plivo.NewClient("<auth_id>","<auth_token>", &plivo.ClientOptions{})
    	if err != nil {
    			fmt.Print("Error", err.Error())
    			return
    		}
    	powerpack, err := client.Powerpack.Get("<powerpack_uuid>")
    	if err != nil {
    			fmt.Print("Error", err.Error())
    			return
    		}
    	// Remove a Number
    	response, err := powerpack.Remove_number("<your_number>", {
            Unrent: true,
    	})
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "api_id": "c378d44c-0a89-11ea-b072-0242ac110007",
        "response": "success"
    }
    

    Number pool short codes

    This API lists and finds short codes in your number pool.

    Attributes

    number_pool_uuid Unique identifier for the number pool.
    shortcode String.
    country_iso2 ISO2 code of the country associated with the short code.
    added_on Timestamp in ISO 8601 format.

    Example Object

    {
        "added_on": "2022-10-09T11:10:59.741978Z",
        "api_id": "b42933e8-0a88-11ea-b072-0242ac110007",
        "country_iso2": "US",
        "number_pool_uuid": "{number_pool_uuid}",
        "shortcode": "{your_short_code}"
    }
    

    Retrieve a short code

    Retrieves the details of the specified short code from the number pool.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Shortcode/{shortcode}/

    Arguments

    No arguments need to be passed.

    Returns

    This API call returns the details for the short code identified by the shortcode specified in the request URL.

    Response

    HTTP Status Code: 200

    {
        "added_on": "2022-10-09T11:10:59.741978Z",
        "api_id": "b42933e8-0a88-11ea-b072-0242ac110007",
        "country_iso2": "US",
        "number_pool_uuid": "{number_pool_uuid}",
        "shortcode": "{your_short_code}"
    }
    

    List all short codes

    This API can be used to fetch a list of short codes from the Number Pool based on number_pool_UUID specified in the resource URI.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Shortcode/

    Arguments

    No arguments need to be passed.

    Returns

    This API returns the list of short codes from the Number Pool matching the filters specified in the request.

    The API response also contains a meta field with the following fields:

    • limit: This the size of the page returned in the response.
    • next: The URL that points to the next page of results.
    • offset: The offset for the page returned in the response.
    • previous: The URL that points to the previous page of results.
    • total_count: The total number of records that match the specified filters.

    Response

    HTTP Status Code: 200

    {
        "api_id": "614b2776-0a88-11ea-b072-0242ac110007",
        "meta": {
            "limit": 20,
            "next": "",
            "offset": 0,
            "previous": "",
            "total_count": 1
        },
        "objects": [
            {
                "added_on": "2019-10-09T11:10:59.741978Z",
                "country_iso2": "US",
                "number_pool_uuid": "{number_pool_uuid}",
                "shortcode": "{your_short_code}"
            }
        ]
    }
    

    Remove a short code

    Removes the short code from the specified number pool resource. Note that the short code isn’t unrented, it’s only unlinked from the number pool.

    API Endpoint

    DELETE https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Shortcode/{shortcode}/

    Arguments

    No arguments need to be passed.

    Returns

    This API call removes the short code from the number pool resource identified by the shortcode and number_pool_uuid specified in the request URL.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    import plivo
    
    client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")
    
    # Unlink a short code from Powerpack
    powerpack = client.powerpacks.get(uuid='<powerpack_uuid>')
    # Version 1
    response = powerpack.remove_shortcode('<shortcode>')
    # Version 2
    response = powerpack.numberpool.shortcodes.remove('<shortcode>')
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    # Unlink a short code from Powerpack
    powerpack = api.powerpacks.get('<powerpack_uuid>')
    # Version 1
    response = powerpack.remove_shortcode('<shortcode>')
    # Version 2
    response = powerpack.numberpool.shortcodes.remove('<shortcode>')
    
    puts(response)
    rescue PlivoRESTError => e
    puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    let plivo = require('plivo');
    
    let client = new plivo.Client('<auth_id>', '<auth_token>');
    
    // Unlink a short code from Powerpack
    client.powerpacks.get("<powerpack_uuid>").then(
      function (powerpack) {
        return powerpack.remove_shortcode("<shortcode>")
        // return powerpack.number_pool.shortcodes.remove("<shortcode>")  V2
      })
    .then(function (result) {
      console.log(result)
    })
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client->client->setTimeout(40);
    
    // Unlink a short code from Powerpack
        try {
            $powerpack = $client->powerpacks->get("<powerpack_uuid>");
            // Version 1
            $response = $powerpack->remove_shortcode('<shortcode>');
            // Version 2
            $response = $powerpack->number_pool->shortcodes->remove('shortcode_uuid');
            print_r($response);
         }
         catch (PlivoRestException $ex) {
             print_r($ex);
         }
    

    Was this code helpful

    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
    
    package com.plivo.api;
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.powerpack.Powerpack;
    
    
    public class Test {
            
        public static void main(String[] args) {
            
            Plivo.init("<auth_id>", "<auth_token>");
    
            // Unlink a short code from Powerpack
            try {
                Powerpack powerpack = Powerpack.getter("<powerpack_uuid>").get();
                // Version 1
                powerpack.remove_shortcode().shortcode("<shortcode>").delete();
                // Version 2
                powerpack.numberpool.shortcodes.remove().shortcode("<shortcode>").delete();
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace PlivoExamples
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
    
                // Unlink a short code from Powerpack
                try
                {
                    var powerpack = api.Powerpacks.Get("<powerpack_uuid>");
                    // Version 1
                    var response = powerpack.Remove_Shortcode("<shortcode>");
                    // Version 2
                    var response = powerpack.numberpool.shortcodes.Remove("<shortcode>");
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    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"
    
    	plivo "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
    	}
    
    	// Unlink a short code from Powerpack
    	powerpack, err := client.Powerpack.Get("<powerpack_uuid>")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	response, err := powerpack.Remove_shortcode("<shortcode>")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "api_id": "c378d44c-0a89-11ea-b072-0242ac110007",
        "response": "success"
    }
    

    Add a toll-free number

    This API lets you add existing SMS- and MMS-enabled toll-free numbers to a number pool.

    API Endpoint

    POST https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Tollfree/{toll_free_number}/

    Arguments

    No arguments need to be passed.

    Returns

    Returns a JSON response containing the added toll-free number resource detail.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    import plivo
    
    client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")
    # Add Tollfree to a Powerpack
    powerpack = client.powerpacks.get(uuid='<powerpack_uuid>')
    # Version 1
    response = powerpack.add_tollfree('<tollfree_number>')
    # Version 2
    response = powerpack.numberpool.tollfree.add('<tollfree_number>')
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    # Add a Tollfree Number
    powerpack = api.powerpacks.get('<powerpack_uuid>')
    # Version 1
    response = powerpack.add_tollfree('<tollfree_number>')
    # Version 2
    response = powerpack.numberpool.tollfree.add('<tollfree_number>')
    
    puts(response)
    rescue PlivoRESTError => e
    puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    let plivo = require('plivo');
    
    let client = new plivo.Client('<auth_id>', '<auth_token>');
    
    // Add Tollfree to a Powerpack
    client.powerpacks.get("<powerpack_uuid>").then(
      function (powerpack) {
        return powerpack.add_tollfree("<tollfree>")
        //return powerpack.number_pool.tollfree.add("<tollfree>");  V2
      })
    .then(function (result) {
      console.log(result)
    })
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client->client->setTimeout(40);
    
     // Add a TollFree to Powerpack
        try {
        $powerpack = $client->powerpacks->get($powerpack_uuid);
        // Version 1
        $response = $powerpack->add_tollfree($tollfree_number);
        // Version 2 
        $response = $powerpack->number_pool->tollfree->add($tollfree_number);
        print_r($response);
        }
        catch (PlivoRestException $ex) {
            print_r($ex);
        }
    

    Was this code helpful

    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
    
    package com.plivo.api;
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.powerpack.Powerpack;
    import com.plivo.api.models.powerpack.Tollfree;
    
    public class Test {
        public static void main(String[] args) {
                
            Plivo.init("<auth_id>", "<auth_token>");
    
            // Add Tollfree to Powerpack
            try {
                Powerpack powerpack = Powerpack.getter("<powerpack_uuid>").get();
                // Version 1
                Tollfree response = powerpack.add_tollfree().tollfree("<tollfree>").get();
                //Version 2
                Tollfree response = powerpack.numberpool.tollfree.add().tollfree("<tollfree>").get();
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace PlivoExamples
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
    
                // Add Tollfree to Powerpack
                try
                {   
                    var powerpack = api.Powerpacks.Get("<powerpack_uuid>");
                    // Version 1
                    // var response = powerpack.Add_Tollfree("<tollfree_number>");
                    // Version 2
                    var response = powerpack.numberpool.tollfree.Add("<tollfree_number>");
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    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"
    
    	plivo "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
    	}
    
    	// Add Tollfree to Powerpack
    	powerpack, err := client.Powerpack.Get("<powerpack_uuid>")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	response, err := powerpack.Add_tollfree("<tollfree_number>")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "account_phone_number_resource": "/v1/Account/<auth_id>/Number/<your_toll_free_number>/",
        "added_on": "2021-04-15T04:49:51.228392Z",
        "api_id": "8a6bba9c-7ed4-11ea-b82e-0242ac110006",
        "country_iso2": "US",
        "number": "<your_toll_free_number>",
        "number_pool_uuid": "<number_pool_uuid>",
        "service": "mms",
        "type": "tollfree"
    }
    

    Retrieve a toll-free number

    Retrieves the details of the specified toll-free number from the specified number pool.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Tollfree/{toll_free_number}/

    Arguments

    No arguments need to be passed.

    Returns

    This API call returns the details for the toll-free number identified by the toll_free_number and number_pool_uuid specified in the request URL.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    import plivo
    
    client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")
    # Retrieve a Specific Tollfree Number
    powerpack = client.powerpacks.get(uuid='<powerpack_uuid>')
    # Version 1
    response = powerpack.find_tollfree('<tollfree_number>')
    # Version 2
    response = powerpack.numberpool.tollfree.find('<tollfree_number>')
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    # Retrieve a Specific Tollfree Number
    powerpack = api.powerpacks.get('<powerpack_uuid>')
    # Version 1
    response = powerpack.find_tollfree('<tollfree_number>') 
    # Version 2
    response = powerpack.numberpool.tollfree.find('<tollfree_number>')
    
    puts(response)
    rescue PlivoRESTError => e
    puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    let plivo = require('plivo');
    
    let client = new plivo.Client('<auth_id>', '<auth_token>');
    
    // Retrieve a Specific Tollfree Number
    client.powerpacks.get("<powerpack_uuid>").then(
      function (powerpack) {
        return powerpack.find_tollfree("<tollfree>")
        // return powerpack.number_pool.tollfree.find("<tollfree>"); V2
      })
    .then(function (result) {
      console.log(result)
    })
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client->client->setTimeout(40);
    
    // Retrieve a Specific Tollfree Number
        try {
        $powerpack = $client->powerpacks->get("<powerpack_uuid>");
        // Version 1
        $response = $powerpack->find_tollfree('<tollfree_number>');
        // Version 2
        $response = $powerpack->number_pool->tollfree->find('<tollfree_number>');
        print_r($response);
        } 
        catch (PlivoRestException $ex) {
            print_r($ex);
        }
    

    Was this code helpful

    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
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace PlivoExamples
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
    
                // Retrieve a Specific Tollfree Number
                try
                {   
                    var powerpack = api.Powerpacks.Get("<poerpack_uuid>");
                    // Version 1
                    var response = powerpack.Find_Tollfree("<tollfree_number>");
                    // Version 2
                    var response = powerpack.numberpool.tollfree.Find("<tollfree_number>");
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    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"
    
    	plivo "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
    	}
    
    	// Retrieve a Specific Tollfree Number
    	powerpack, err := client.Powerpack.Get("<powerpack_uuid>")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	response, err := powerpack.Find_tollfree("<tollfree_number>")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_toll_free_number}/",
        "added_on": "2023-03-18T16:07:39.379739Z",
        "api_id": "df0519d6-7ed4-11ea-b82e-0242ac110006",
        "country_iso2": "US",
        "number": "{your_toll_free_number}",
        "number_pool_uuid": "{number_pool_uuid}",
        "type": "tollfree"
    }
    

    List all toll-free numbers

    This API fetches a list of all toll-free numbers from a number pool based on the number pool UUID specified in the resource URI.

    API Endpoint

    GET https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Tollfree/

    Arguments

    No arguments need to be passed.

    Returns

    This API returns the list of toll-free numbers from the number pool.

    The API response contains a meta field with the following fields:

    • limit: The size of the page returned in the response.
    • next: The URL that points to the next page of results. (Currently this will be blank because only one toll-free can be present in a number pool.)
    • offset: The offset for the page returned in the response.
    • previous: The URL that points to the previous page of results. (Currently this will be blank because only one toll-free can be present in a number pool.)
    • total_count: The total number of records that match the specified filters. (Currently this is always 1.)

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    import plivo
    
    client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")
    # List all Tollfree in a Powerpack
    powerpack = client.powerpacks.get(uuid='<powerpack_uuid>')
    # Version 1
    response = powerpack.list_tollfree()
    # Version 2
    response = powerpack.numberpool.tollfree.list()
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    # List all tollfree numbers
    powerpack = api.powerpacks.get('<powerpack_uuid>')
    # Version 1
    response = powerpack.list_tollfree()  
    # Version 2
    response = response.numberpool.tollfree.list()
    
    puts(response)
    rescue PlivoRESTError => e
    puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    let plivo = require('plivo');
    
    let client = new plivo.Client('<auth_id>', '<auth_token>');
    
    // List all Tollfree in a Powerpack
    client.powerpacks.get("<powerpack_uuid>").then(
      function (powerpack) {
        return powerpack.list_tollfree()
        // return powerpack.number_pool.tollfree.list()  V2
      })
    .then(function (result) {
      console.log(result)
    })
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client->client->setTimeout(40);
    
    // List all Tollfree in a Powerpack
        try {
        $powerpack = $client->powerpacks->get("<powerpack_uuid>");
        // Version 1
        $response = $powerpack->list_tollfree();
        // Version 2
        $response = $powerpack->number_pool->tollfree->list();
        print_r($response);
        } 
        catch (PlivoRestException $ex) {
            print_r($ex);
        }
    

    Was this code helpful

    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
    
    package com.plivo.api;
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.powerpack.Powerpack;
    import com.plivo.api.models.powerpack.Tollfree;
    import com.plivo.api.models.base.ListResponse;
    
    
    public class Test {
            
    public static void main(String[] args) {
            
        Plivo.init("<auth_id>", "<auth_token>");
    
            // List all Tollfree in a Powerpack
            try {
                Powerpack powerpack = Powerpack.getter("<powerpack_uuid>").get();
                // Version 1
                ListResponse<Tollfree> response = powerpack.list_tollfree().list();
                //Version 2
                ListResponse<Tollfree> response = powerpack.numberpool.tollfree.list().list();
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace PlivoExamples
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
    
                // List all Tollfree in a Powerpack
                try
                {
                    var powerpack = api.Powerpacks.Get("<powerpack_uuid>");
                    // Version 1
                    var response = powerpack.List_Tollfree();
                    // Version 2
                    var response = powerpack.numberpool.tollfree.List();
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    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"
    
    	plivo "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
    	}
    
    	// List all Tollfree in a Powerpack
    	powerpack, err := client.Powerpack.Get("<powerpack_uuid>")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	response, err := powerpack.List_tollfree()
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
      "api_id": "06c15d7c-7ed5-11ea-855f-0242ac110003",
      "meta": {
        "limit": 20,
        "next": "",
        "offset": 0,
        "previous": "",
        "total_count": 1
      },
      "objects": [
        {
          "account_phone_number_resource": "/v1/Account/{auth_id}/Number/{your_tollfree_number}/",
          "added_on": "2022-10-09T11:24:35.085797Z",
          "country_iso2": "US",
          "number": "{your_tollfree_number}",
          "number_pool_uuid": "{number_pool_uuid}",
          "service": "mms",
          "type": "tollfree"
        }
      ]
    }
    
    

    Remove a toll-free number

    Removes the toll-free number from the number pool.

    API Endpoint

    DELETE https://api.plivo.com/v1/Account/{auth_id}/NumberPool/{number_pool_uuid}/Tollfree/{tollfree_number}/

    Arguments

    unrentbooleanDefault is false if not specified.

    Returns

    This API call removes the toll-free number from the number pool resource identified by the number and number_pool_uuid specified in the request URL.

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    import plivo
    
    client = plivo.RestClient(auth_id="<auth_id>", auth_token="<auth_token>")
    # Remove a specific tollfree number from Powerpack - Unlink & Unrent
    powerpack = client.powerpacks.get(uuid='<powerpack_uuid>')
    # To Un-Rent while removing a number from powepack - Set flag to "True"
    # Version 1
    response = powerpack.remove_tollfree('<tollfree_number>', True)
    # Version 2
    response = powerpack.numberpool.tollfree.remove('<tollfree_number>', True)
    print(response)
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    include Plivo::Exceptions
    
    api = RestClient.new("<auth_id>", "<auth_token>")
    
    begin
    # Remove a specific tollfree number from Powerpack - Unlink & Unrent
    powerpack = api.powerpacks.get('<powerpack_uuid>')
    # To Un-Rent while removing a number from powepack - Set flag to "true"
    # Version 1
    response = powerpack.remove_tollfree('<tollfree_number>', true)
    # Version 2
    response = powerpack.numberpool.tollfree.remove('<tollfree_number>', true)
    
    puts(response)
    rescue PlivoRESTError => e
    puts 'Exception: ' + e.message
    end
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    let plivo = require('plivo');
    
    let client = new plivo.Client('<auth_id>', '<auth_token>');
    
    // Remove a specific tollfree number from Powerpack - Unlink & Unrent
    client.powerpacks.get("<powerpack_uuid>").then(
      // To Un-Rent while removing a number from powepack - Set flag to "true"
      function (powerpack) {
        return powerpack.remove_number("<tollfree>", true)
        // return powerpack.number_pool.tollfree.remove("<tollfree>", true)  V2
      })
    .then(function (result) {
      console.log(result)
    })
    

    Was this code helpful

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    <?php
    require 'vendor/autoload.php';
    use Plivo\RestClient;
    
    $client = new RestClient("<auth_id>", "<auth_token>");
    $client->client->setTimeout(40);
    
    // Remove a specific tollfree number from Powerpack - Unlink & Unrent
        try {
            $powerpack = $client->powerpacks->get("<powerpack_uuid>");
            // To Un-Rent while removing a number from powepack - Set flag to "true"
            // Version 1
            $response = $powerpack->remove_tollfree('<tollfree_number>',array("unrent=true"));
            // Version 2
            $response = $powerpack->number_pool->tollfree->remove('<tollfree_number>', array("unrent=true"));
            print_r($response);
         }
         catch (PlivoRestException $ex) {
             print_r($ex);
         }
    

    Was this code helpful

    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
    
    package com.plivo.api;
    
    import java.io.IOException;
    import com.plivo.api.Plivo;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.powerpack.Powerpack;
    
    
    public class Test {
            
        public static void main(String[] args) {
            
            Plivo.init("<auth_id>", "<auth_token>");
    
            // Remove a specific tollfree number from Powerpack - Unlink & Unrent
            try {
                Powerpack powerpack = Powerpack.getter("<powerpack_uuid>").get();
                // To Un-Rent while removing a number from powepack - Set flag to "true"
                // Version 1
                powerpack.remove_tollfree().tollfree("<tollfree>").unrent(true).delete();
                //Version 2
                powerpack.numberpool.tollfree.remove().tollfree("<tollfree>").unrent(true).delete();
            } catch (PlivoRestException | IOException e) {
                e.printStackTrace();
            }
        }
    }
    

    Was this code helpful

    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
    
    using System;
    using System.Collections.Generic;
    using Plivo;
    using Plivo.Exception;
    
    namespace PlivoExamples
    {
        class Program
        {
            static void Main(string[] args)
            {
                var api = new PlivoApi("<auth_id>","<auth_token>");
    
                // Remove a specific tollfree number from Powerpack - Unlink & Unrent
                try
                {
                    // To Un-Rent while removing a number from powepack - Set flag to "true"
                    var powerpack = api.Powerpacks.Get("<powerpack_uuid>");
                    // Version 1
                    var response = powerpack.Remove_Tollfree("<tollfree_number>", true);
                    // Version 2
                    var response = powerpack.numberpool.tollfree.Remove("<tollfree_number>", true);
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    

    Was this code helpful

    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
    
    package main
    
    import (
    	"fmt"
    
    	plivo "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
    	}
    
    	// Remove a specific tollfree number from Powerpack - Unlink & Unrent
    	powerpack, err := client.Powerpack.Get("<powerpack_uuid>")
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	// To Un-Rent while removing a number from powepack - Set flag to "true"
    	response, err := powerpack.Remove_tollfree("<tollfree_number>", plivo.NumberRemoveParams{Unrent: true})
    	if err != nil {
    		fmt.Print("Error", err.Error())
    		return
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Was this code helpful

    Response

    HTTP Status Code: 200

    {
        "api_id": "57936fb0-7ed5-11ea-aa79-0242ac110003",
        "response": "success"
    }