Latest Legacy

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.

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

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

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