How To Import Bandwidth Numbers To Your Account

Follow

Daniel Tolbert

Updated

TABLE OF CONTENTS

PRE-REQS

STEP 1: IMPORT NUMBER USING THE BANDWIDTH VOICE & MESSAGING API

STEP 2: SEND MESSAGE USING THE BANDWIDTH COMMUNICATION API

STEP 3: INCOMING MESSAGES - USING THE BANDWIDTH COMMUNICATION API

PRE-REQS

 

Description

accountId

This ID is associated with your Bandwidth Dashboard account. Note: If you don’t know your Provider Account ID, please open a ticket with our support group.

userName

This is your user name used to log into the Bandwidth Dashboard.

password

This is your password used to log into the Bandwidth Dashboard.

userId

This is the user id associated with your application platform account

token

This is the api token associated with your application platform account

secret

This is the api secret associated with your application platform account

applicationId

This is the application platform applicationId to assign the imported numbers.

 

STEP 1: IMPORT NUMBER USING THE BANDWIDTH VOICE & MESSAGING API

Import numbers with the applicationId

Parameter

Description

Mandatory

Number

Dashboard Phone Number being imported. E.164 format.

Yes

applicationId

HTTP Application you want the phone number to be registered to for inbound messages.

Yes

providerName

Always use this provider “bandwidth-dashboard”

Yes

accountId

This ID is associated with your Bandwidth Dashboard account. Note: If you don’t know your Provider Account ID, please open a ticket with our support group.

Yes

userName

This is your user name used to log into the Bandwidth Dashboard.

Yes

password

This is your password used to log into the Bandwidth Dashboard.

Yes

 

Example: Import Numbers (One at a time)

You'll need to repeat this process for EVERY number that'll be imported to the application platform from the Bandwidth Dashboard.

POST to https://api.catapult.inetwork.com/v1/users/{{UserId}}/phoneNumbers

POST https://api.catapult.inetwork.com/v1/users/{{UserId}}/phoneNumbers HTTP/1.1
Content-Type: application/json; charset=utf-8
Authorization: {apiToken:apiSecret}

{
  "number"        : "+14352154439",
  "applicationId" : "{{applicationId}}",
  "name"          : "text messaging TN",
  "provider"      : {
    "providerName" : "bandwidth-dashboard",
    "properties"   : {
      "accountId" : "9999999",
      "userName"  : "wileCoyote",
      "password"  : "catchThatBird"
    }
  }
}

 

Example Response: 201 - Created

The numberId is returned in the Location Header.

Status: 201 Created
Location: https://api.catapult.inetwork.com/v1/users/{{UserId}}/phoneNumbers/n-id3x6rblp4jrkih2u7zxjdy

 

STEP 2: SEND MESSAGE USING THE BANDWIDTH COMMUNICATION API

To send a message with your imported number, use the /messaging capabilities as normal.

 

Example: Send New Message

POST to https://api.catapult.inetwork.com/v1/users/{userId}/messages

POST https://api.catapult.inetwork.com/v1/users/{userId}/messages HTTP/1.1
Content-Type: application/json; charset=utf-8
Authorization: {apiToken:apiSecret}
{
    "from" : "14352154439",
    "to"   : "{toNumber}",
    "text" : "Good morning, this is a test message"
}

 

Example Response: 201 - Created

The messageId is returned in the Location Header.

Status: 201 Created
Location: https://api.catapult.inetwork.com/v1/users/{{UserId}}/messages/m-id3x6rblp4jrkih2u7zxjdy

 

STEP 3: INCOMING MESSAGES - USING THE BANDWIDTH COMMUNICATION API

Bandwidth will send you either a  GET or POST HTTP Callback based on your application configuration in Step 3.

 

Example GET Callback

All the relevant fields are passed as query parameters

GET http://[External server URL]

/{callbackUrl}?
  messageId=m-asdf&
  from=%2B19191231111&
  eventType=sms&
  text=test&
  time=2016-12-01T16:04:49Z&
  to=%2B14352154439&
  state=received&
  applicationId=a-yr3jpxasdfh5xh5e35saoi&
  direction=in&
  messageUri=https%3A%2F%2Fapi.catapult.inetwork.com%2Fv1%2Fusers%2Fu-123%2Fmessages%2Fm-asdf

 

Example POST Callback

POST http://[External server URL]

POST http://your-url-for-callbacks.com HTTP/1.1
Content-Type: application/json; charset=utf-8

{
   "eventType"     : "sms",
   "direction"     : "in",
   "messageId"     : "{messageId}",
   "messageUri"    : "https://api.catapult.inetwork.com/v1/users/{userId}/messages/{messageId}",
   "from"          : "+13233326955",
   "to"            : "+14352154439",
   "text"          : "Example",
   "applicationId" : "{appId}",
   "time"          : "2012-11-14T16:13:06.076Z",
   "state"         : "received"
}

Article is closed for comments.