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

    nameRequiredstringMust be unique across all Powerpacks in customer's account
    sticky_senderOptionalBooleanSticky sender should be enabled by default. Default value is True. Sticky Sender ensures messages to a particular destination number are always sent from the same source number
    local_connectOptionalBooleanLocal connect should be enabled by default. Default value is True. Local connect prioritizes local numbers matched on area code and State over other numbers in the pool
    application_typeConditionalStringMust be specified if application_id is specified
    application_idOptionalStringMust 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.

    Response

    HTTP Status Code: 200

    {
        "api_id": "4b2c83c4-09ff-11ea-b072-0242ac110007",
        "application_id": "20342783288007824",
        "application_type": "XML",
        "created_on": "2019-10-09T11:10:59.666461Z",
        "local_connect": true,
        "name": "test",
        "number_pool": "/v1/Account/{auth_id}/NumberPool/<number_pool_uuid>/",
        "sticky_sender": true,
        "uuid": "<powerpack_uuid>"
    }
    

    Example Request

    1
    2
    3
    4
    5
    6
    
    import plivo
    import json
    
    client = plivo.RestClient("auth_id", "auth_token")
    powerpack = client.powerpacks.create(name=your_poerpack, sticky_sender=True)
    print str(powerpack)
    
    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.create('your_powerpak_name', sticky_sender: true, local_connect: false, application_id: 'your_application_id', application_type: 'xml')
      puts response
    rescue PlivoRESTError => e
      puts 'Exception: ' + e.message
    end
    
    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.create("your_powerpack_name", {
      'sticky_sender': 'false'
    }).then(function (result) {
      console.log(result)})
    .catch(function (response) {
        console.log(response);
    });
    
    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 {
        $response = $client->powerpacks->create('your powerpack name',['sticky_sender'=>true]);
        print_r($powerpack);
    }
    catch (PlivoRestException $ex) {
        print_r(ex);
    }
    ?>
    
    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.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");
        try {
          PowerpackResponse response = Powerpack.creator("powerpack_name").create();
          System.out.println(response);
        }
        catch (  PlivoRestException | IOException e ) {
          e.printStackTrace();
        }
      }
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    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.Update(uuid: "powerpack_uuid",name: "your_powerpack_name", sticky_sender: false,local_connect: false);
                    Console.WriteLine(response);
                }
                catch (PlivoRestException e)
                {
                    Console.WriteLine("Exception: " + e.Message);
                }
            }
        }
    }
    
    1
    2
    3
    4
    
    curl -X POST -i --user auth_id:auth_token \
    -H "Content-Type: application/json" \
    -d '{"name": "your_powerpack_name","sticky_sender": "True","local_connect": "True"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Powerpack/
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    package main
    
    import (
    	"fmt"
    
    	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.Powerpack.Create(
    		plivo.PowerackCreateParams{
    			Name:         "your_powerpack_name",
    			StickySender: "true",
    		},
    	)
    	if err != nil {
    		panic(err)
    	}
    	fmt.Printf("Response: %#v\n", response)
    }