Provisioning Telephone Numbers for SMS

Overview

All phone numbers on the IntelePeer network can be used to send and receive SMS messages. You can enable SMS over your phone number by:

 

  • Configuring a number through the IntelePeer Customer Portal
  • Configuring a number through the Atmosphere® API

 

This page discusses SMS enablement via API for long codes only. Enablement allows you to send SMS messages using a phone number (long code) using the SMS send API, and also makes the webhook API available for use on the long code to receive SMS messages.

 

Short codes can be ordered by contacting IntelePeer directly.  Learn more about number enablement through the IntelePeer Customer Portal in the Quick Start Guide.

 

Configuring Numbers via API

Configuring a phone number through the Atmosphere® API requires two steps:

 

  1. Explicitly enable SMS for the phone number
  2. Create and set the webhook for processing of inbound SMS messages

 

Checking Number Configuration via API

You can check the current configuration of a number through the Atmosphere® API:

 

  • Get the SMS enablement status of a phone number
  • Get the current webhook for a phone number


Enabling SMS for a single Phone Number via API

 
URI

POST to https://api.intelepeer.com/_rest/v4/my/did/sms/provision

 
Parameters

This API method requires an Authorization Token. Learn more about the Authorization token in Atmosphere® API Authentication.

 

ParameterData TypeRequiredDescription
endpointslist of stringsrequiredA list of E.164 format of the long codes (TNs) you wish to provision.  Only a single E.164 can be submitted to this list.

 
Request Example

{
    "endpoints": [ "+13031112222" ]
}

 
Response Example

{
"code": 202,
"provisioning": {
"state": "requested"
}
}

 

Response CodeDescription
202

The provisioning request has been accepted and is pending completion.

 

400

The reason for the error is contained within the response.

 

401

The reason for the error is contained within the response.

 

409Provisioning (or deprovisioning) of the number is in progress.

 
Behavior

Enabling of numbers for SMS typically happens within minutes, however there are some cases where a number may take longer to enable:

 

  • Toll free numbers for which IntelePeer is not the resporg
  • DIDs and Toll Free Numbers that are already being used for SMS within another service

import requests ############################################################################### ### update these accordingly ### ############################################################################### authtoken = ‘INSERT_AUTH_TOKEN_HERE’ tn = ‘INSERT_TELEPHONENUMBER_HERE_IN_E.164_FORMAT’ ############################################################################### ### leave these alone ### ############################################################################### url = “https://api.intelepeer.com/_rest/v4/my/did/sms/provision” hdrs = { ‘Content-Type’: “application/json”, ‘Authorization’: {}’.format(authtoken) } request = {
“endpoints”: [ tn ]
} ############################################################################### ### execute the task and parse results ### ############################################################################### response = requests.post(url, json=request, headers=hdrs) print u'{}: {}’.format(‘OK’ if response else ‘ERROR’, response.text )


Checking the SMS enablement status of a phone number

 
URI

GET to https://api.intelepeer.com/_rest/v4/my/did/sms/provision?endpoint=%2B{tn}

  • “%2B” is the URL-encoded ‘+’ component of E.164 format.
  • {tn} is the phone number being queried, including the leading country-code

For example, you would configure the webhook for +17208675309 by GET-ing from the URL:

https://api.intelepeer.com/_rest/v4/my/did/sms/provision?endpoint=%2B17208675309

Multiple endpoints can be provided by adding additional endpoint parameters in the URL, separated with an ampersand.

 
Parameters

None, however this API method requires an Authorization token. Learn more about the Authorization token in Atmosphere® API Authentication.

 
Response Example

{
"code": 200, "provisioning": { "state": "requested" } }

If multiple endpoints are provided, the response code will change to 207 (multi-status) and a list of responses matching the above format will be returned, in the same order of the query parameters provided.

Response Variable Values

Variable Available Values

code

matches the http response code
provisioning.state

requested
provisioning
provisioned
derequested
deprovisioning
error

 

Response Code Description

200

Status returned in the response.

400

The telephone number is not in the proper E.164 format.

404 The telephone number is not available for use by the customer.

import requests
from urllib import quote
###############################################################################
### update these accordingly ###
###############################################################################
authtoken = 'INSERT_AUTH_TOKEN_HERE'
tn = 'INSERT_TELEPHONENUMBER_HERE_IN_E.164_FORMAT'

###############################################################################
### leave these alone ###
###############################################################################

url = "https://api.intelepeer.com/_rest/v4/my/did/sms/provision?endpoint={}".format(quote(tn))
hdrs = {
'Content-Type': "application/json",
'Authorization': {}'.format(authtoken)
}

###############################################################################
### execute the task and parse results ###
###############################################################################
response = requests.get(url, json={}, headers=hdrs)
print u'{}: {}'.format('OK' if response else 'ERROR', response.text )



Disabling a number for SMS via API

 
URI

DELETE to https://api.intelepeer.com/_rest/v4/my/did/sms/provision

 
Parameters

This API method requires an Authorization Token. Learn more about the Authorization token in Atmosphere® API Authentication.

{
    "endpoints": [ "+13031112222" ]
}

 
Response Example

{
"code": 202,
"provisioning": {
"state": "derequested"
}
}

 

Response Code Description

202

The deprovisioning request has been accepted and is pending completion.

400

The reason for the error is contained within the response.

401

The reason for the error is contained within the response.

409 Provisioning (or deprovisioning) of the number is in progress.

 
Behavior

Deprovisioning can only be requested when a number is in the provisioned state.

import requests

###############################################################################
### update these accordingly                                                ###
###############################################################################
authtoken = 'INSERT_AUTH_TOKEN_HERE'
tn        = 'INSERT_TELEPHONENUMBER_HERE_IN_E.164_FORMAT'

###############################################################################
### leave these alone                                                       ###
###############################################################################
url = "https://api.intelepeer.com/_rest/my/did/sms/provision
hdrs = {
    'Content-Type': "application/json",
    'Authorization':  {}'.format(authtoken)
}
request = { "endpoints": [ tn ] }

###############################################################################
### execute the task and parse results                                      ###
###############################################################################
response = requests.delete(url, json=request, headers=hdrs)
print u'{}: {}'.format('OK' if response else 'ERROR', response.text )