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

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.

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