About Callback Services

About Connectivity Management API Callback Services

Contents

Overview

The ThingSpace Connectivity Management API uses callback services (also called webhooks) to send messages to your application. There are three broad categories of callback messages:

  • Asynchronous API Responses - Messages that contain the status or requested information from API requests that take time to process, such as activating devices.
  • ThingSpace Notifications - Messages sent to notify your application about a change that was made outside of the API interface, such as a manual change made through a Verizon portal, the expiration of a promotional code for a device, or an upcoming date when a suspended device will automatically be returned to active status.
  • Device Messages - SMS messages sent by devices through ThingSpace to your application.

Subscribing to Callback Services

To receive callback messages, you will need to create and deploy a web service that can validate and process REST messages that conform to the Callback JSON schema. You then need to register the URL of your web service through the Connectivity Management API so that it knows where to send the callback messages.

You can run multiple callback listening services on a single server, but your application will be more robust if you use a separate port for each type of callback message that you plan to receive.

You only need to register once for each type of callback message that you want to receive. You do not need to subscribe to all messages – only to those that are applicable to your needs.

NOTE: You will have to provide a way through your firewalls for the callback messages, such as by whitelisting the IP addresses used by the Verizon ThingSpace servers. The IP addresses are:

  • 137.117.33.109
  • 168.62.173.153

NOTE: To test your callback listening services in a non-production environment, you must have an external URL for the computer or server that is hosting the web services. The ThingSpace Platform cannot send callback messages to a system that does not have a URL.

Callback Security

When you register to receive any type of callback messages, you can specify a username and/or password that you want ThingSpace to include in each message. It will include the username and password as plain text in the callback messages. ThingSpace will not interact with any sort of authentication system. It will include the username and password as plain text in the callback message, like this:

  "password": "string",
  "username": "string"

To increase security when receiving callback messages from ThingSpace, you can implement these protocols:

  • Enable white-listing on your firewall or front-end server and add the ThingSpace IP addresses (137.117.33.109 168.62.173.153) to the white list. This will allow your servers to reject requests from other IP addresses.
  • Install a one-way certificate and enable HTTPS. You must use a certificate from a third-party certificate service; a self-signed certificate will not work. ThingSpace will check the validity of the certificate at the start of every session.

Callback Reliability

Your callback listener web service must acknowledge receipt of a callback message by sending back a 2xx status code. Callback messages that are not acknowledged by your application will be resent by ThingSpace three more times at 5 minute intervals, for a total of 4 attempts to send the message. Failed (unacknowledged) callback messages are archived for 30 days. During the 30 day period, you can contact support with the Request ID of failed callbacks and ask for them to be resent.

Receiving Asynchronous API Callbacks

For API service requests that require significant processing time, such as provisioning service for a device or changing a service plan, the Connectivity Management API replies first with a synchronous response that simply acknowledges the request and allows your application to continue processing. Later, the API sends an asynchronous callback message, reporting the results of the request.

assets/request-response-callback.png

The synchronous response contains a unique Request ID. The callback message will contain the same Request ID so that you can associate the callback with the original API request.

Below are the callback services that return asynchronous API responses:

Callback Service Description
CarrierService Asynchronous responses from all requests that change device states and metadata: activate, suspend, restore, deactivate, move, change cost center, change service plan, etc.
DevicePRLInformation Callback messages containing current device PRL values, in response to POST /devices/prl/actions/list requests.
DeviceProfileService Asynchronous responses for all requests that change a device’s profile status, including download, enable, disable, and delete.
DeviceService Callback messages about devices from POST /devices/actions/upload requests.
DeviceSuspensionStatus Callback messages containing information about the suspended status of devices, in response to POST /devices/suspension/status requests.
DeviceUsage Callback messages about device usage from POST /devices/usage/actions/list/aggregate requests.
EnhancedConnectivityService Callback messages from POST /sms to let you know when your messages have been sent to devices. (This callback service is also used to receive SMS messages sent from devices to your application.)
SMSDeliveryConfirmation Indicates that an SMS Message sent through POST /sms was received and acknowledged by the device.
StateService Asynchronous responses from PUT /devices/actions/gotostate requests.

Receiving ThingSpace Notification Callbacks

You can subscribe to these services to receive notifications about device changes that were not initiated through ThingSpace APIs. You can use these messages to keep any information that your application stores in sync with the actual status.

The table below lists the callback services that provide notifications about external changes:

Callback Service Description
AlertService Callback messages sent when trigger conditions are met.
ExternalProvisioningChanges Non-API-initiated provisioning transactions. For example, ThingSpace would send a message if a Verizon business portal user made any of the following changes:
  • Activate
  • Deactivate
  • Suspend
  • Restore
  • Change ESN
  • Change MEID
  • Change MDN
ResumeTrackingNotification Messages to notify you about suspended devices that will automatically return to active status. ThingSpace will send a callback message 7 days before a suspended device will auto-resume.

Receiving Device Message Callbacks

Sophisticated IoT applications often need to process information sent from devices so that appropriate actions can be taken. You can use the callback service listed below to receive messages that are originated by devices.

Callback Service Description
EnhancedConnectivityService This callback service provides two types of messages:
  • The contents of SMS messages sent by your devices to 750075007500 or to 900060005010.
  • Notification of when POST /sms messages are sent to devices.

Callback Examples

CarrierService

Activate

{
  "username":"",
  "password":"",
  "requestId":"2c90bd28-ece4-42ef-9f02-7e3bd4fbff33",
  "deviceIds":[
    {
      "id":"352452060026934",
      "kind":"IMEI"
    }
  ],
  "deviceResponse":{
    "activateResponse":{
      "deviceIds":[
        {
          "id":"5096306081",
          "kind":"mdn"
        },
        {
          "id":"311480104434320",
          "kind":"imsi"
        },
        {
          "id":"89148000001024124378",
          "kind":"iccId"
        },
        {
          "id":"13122379508",
          "kind":"msisdn"
        },
        {
          "id":"2345958183",
          "kind":"min"
        }
      ],
      "ipAddress":"10.224.48.88",
      "state":"Active",
      "servicePlan":"84638",
      "featureCodes":[

      ],
      "deviceCredential":{
        "username":"5096306081@vzw3g.com",
        "password":"5096306081"
      }
    }
  },
  "status":"Success",
  "callbackCount":1,
  "maxCallbackThreshold":4
}

Suspend

{
  "username":"",
  "password":"",
  "requestId":"5b645698-162f-4897-889d-c61275ab1afc",
  "deviceIds":[
    {
      "id":"A100001F702731",
      "kind":"MEID"
    },
    {
      "id":"9083074681",
      "kind":"MDN"
    }
  ],
  "deviceResponse":{
    "suspendResponse":{
      "expectedResumeDate":"05/25/2018",
      "maxSuspendDaysAllowed":180,
      "numDaysSuspendedLast12Months":93,
      "numDaysSuspendAllowedCurrent12Months":87
    }
  },
  "comment":"Device Suspended - Applicable Charges Will Continue",
  "status":"Success",
  "callbackCount":1,
  "maxCallbackThreshold":4
}

Restore

{  
  "username":"",
  "password":"",
  "requestId":"52288eff-c306-44f0-9e73-0c3143ea9e7b",
  "deviceIds":[  
    {  
      "id":"990003420535573",
      "kind":"imei"
    },
    {  
      "id":"89148000000800784259",
      "kind":"iccid"
    }
  ],
  "deviceResponse":{  
    "restoreResponse":{  
       "restored":true
    }
  },
  "status":"Success",
  "callbackCount":1,
  "maxCallbackThreshold":4
}

Deactivate

{  
  "username":"",
  "password":"",
  "requestId":"eb3406b0-15fc-4473-8e84-b92cfb67f22d",
  "deviceIds":[  
    {  
      "id":"990003420535573",
      "kind":"imei"
    },
    {  
      "id":"89148000000800784259",
      "kind":"iccid"
    }
  ],
  "deviceResponse":{  
    "deactivateResponse":{  
      "deactivated":true
    }
  },
  "status":"Success",
  "callbackCount":1,
  "maxCallbackThreshold":4
}

Change Device Contact Info

{
  "username":"",
  "password":"",
  "requestId":"24da9f9a-d110-4a54-86b4-93fb76aab83c",
  "deviceIds":[
    {  
      "kind":"ESN",
      "id":"19110173057"
    },
    {
      "kind":"ESN",
      "id":"19110173057"
    }
  ],
  "deviceResponse":{
    "contactInfoResponse":{
      "accountName":"0212345678-00001"
    }
  },
  "status":"Success",
  "callbackCount":1,
  "maxCallbackThreshold":4
}

Change Device Cost Center

{
  "username": "",
  "password": "",
  "requestId": "3e4a42ca-6dfa-460e-9803-f677b069a694",
  "deviceIds": [
    {
      "id": "AFF241F30CDAE1",
      "kind": "Meid"
    }
  ],
  "deviceResponse": {
    "deviceCostCenterResponse": {
      "costCenterCode": "VZW103",
      "primaryPlaceOfUse": {
        "address": {
          "addressLine1": "9808",
          "addressLine2": "Scranton Road",
          "city": "San Diego",
          "state": "CA",
          "country": "US",
          "zip": "92121",
          "zip4": "01234",
          "phone": "1234567890",
          "phoneType": "M",
          "emailAddress": "zaffod@theinternet.com"
        },
        "customerName": {
          "firstName": "Zaffod",
          "lastName": "Beeblebrox",
          "middleName": "Q",
          "title": "President",
          "suffix": "I"
        }
      }
    }
  },
  "status":"Success",
  "callbackCount":1,
  "maxCallbackThreshold":4
}

Change Device Custom Fields

{  
  "username":"",
  "password":"",
  "requestId":"c8de7c1d-59b9-4cf3-b969-db76cb2ce509",
  "deviceIds":[  
    {  
      "id":"8586928930",
      "kind":"mdn"
    }
  ],
  "deviceResponse":{  
  },
  "comment":"Success",
  "status":"Success",
  "callbackCount":1,
  "maxCallbackThreshold":4
}

Change Device Identifier

{  
  "username":"",
  "password":"",
  "requestId":"a28892ea-6503-4aa7-bfa2-4cd45d42f61b",
  "deviceIds":[  
    {  
      "id":"22211315718",
      "kind":"ESN"
    }
  ],
  "deviceResponse":{  
    "changeIdentifierResponse":{  
      "deviceIds":[  
        {  
          "id":"A1000001999990",
          "kind":"iccid"
        }
      ],
      "servicePlan":"M2M_4G"
    }
  },
  "status":"Success",
  "callbackCount":1,
  "maxCallbackThreshold":4
}

Change Device Service Plan

{
  "username":"",
  "password":"",
  "requestId":"c8de7c1d-59b9-4cf3-b969-db76cb2ce509",
  "deviceIds":[
    {
      "id":"8586928930",
      "kind":"mdn"
    }
  ],
  "deviceResponse":{
    "deviceChangeServicePlanResponse":{
      "servicePlan":"M2M5GB",
      "effectiveDate":"12/25/2017 12:00:00 AM"
    }
  },
  "status":"Success",
  "callbackCount":1,
  "maxCallbackThreshold":4
}

Move Device

{
  "username":"",
  "password":"",
  "requestId":"ec682a8b-e288-4806-934d-24e7a59ed889",
  "deviceIds":[
    {
      "id":"19110173057",
      "kind":"Esn"
    }
  ],
  "deviceResponse":{
    "usageResponse":[ ],
    "moveDeviceResponse":{
      "deviceIds":[
        {
          "id":"19110173057",
          "kind":"Esn"
        }
      ],
      "accountName":"0212345678-00001"
    }
  },
  "status":"Success",
  "callbackCount":1,
  "maxCallbackThreshold":4
}

DeviceService

Check Device Availability

{
  "username":"",
  "password":"",
  "requestId":"595f5c44-c31c-4552-8670-020a1545a84d",
  "deviceResponse":{
    "checkDeviceAvailabilityResponse":{
      "deviceInfo":[
        {
          "device":[
            {
              "id":"990005350342573",
              "kind":"IMEI",
              "deviceSku":"VZW090000450004",
              "productType":"Modem",
              "deviceFound":true
            },
            {
              "id":"82458000000984190032",
              "kind":"ICCID",
              "deviceFound":true
            }
          ],
          "associatedWithMTN":true,
          "deviceSimPair":true
        },
      ],
      "accountName":"0212345678-00001"
    }
  },
  "status":"Success",
  "callbackCount":1,
  "maxCallbackThreshold":4
}

DevicePRLInformation

{
  "username":"",
  "password":"",
  "requestId":"5b645698-162f-4897-889d-c61275ab1afc",
  "deviceIds":[
    {
      "id":"A100001F702731",
      "kind":"MEID"
    },
    {
      "id":"9083074681",
      "kind":"MDN"
    }
  ],
  "deviceResponse":{
    "prlInformationResponse": {
      "prlVersion": "523310"
    },
  },
  "status":"Success",
  "callbackCount":1,
  "maxCallbackThreshold":4
}

DeviceSuspensionStatus

{
  "username": "",
  "password": "",
  "requestId": "904dcdc6-a590-45e4-ac76-403306f6d883",
  "deviceResponse": {
    "deviceSuspensionStatusResponse": [
      {
        "deviceIds": [
          {
            "id": "502209576627731",
            "kind": "imei"
          }
        ],
        "state": "suspend",
        "suspendDate": "2017-12-21 00:00:00",
        "expectedResumeDate": "2018-03-20",
        "daysRemainingAutoResume": "90",
        "maxSuspendDaysAllowed": "180",
        "numDaysSuspendedLast12Months": "0",
        "numDaysSuspendAllowedCurrent12Months": "91",
        "timesSuspendedLast12Months": "1"
      },
      {
        "deviceIds": [
          {
            "id": "50220957662773100000",
            "kind": "iccid"
          }
        ],
        "state": "suspend",
        "suspendDate": "2017-12-21 00:00:00",
        "expectedResumeDate": "2018-03-20",
        "daysRemainingAutoResume": "90",
        "maxSuspendDaysAllowed": "180",
        "numDaysSuspendedLast12Months": "0",
        "numDaysSuspendAllowedCurrent12Months": "91",
        "timesSuspendedLast12Months": "1"
      }
    ]
  },
  "status":"Success",
  "callbackCount":1,
  "maxCallbackThreshold":4
}

DeviceUsage

{
  "username":"",
  "password":"",
  "requestId":"24da9f9a-d110-4a54-86b4-93fb76aab83c",
  "deviceResponse":{
    "prlInformationResponse":{},
    "smsDeliveryResponse":{},
    "usageResponse":[
      {},
      {
        "deviceIds":[
          {
            "id":"9083074681",
            "kind":"Mdn"
          },
          {
            "id":"A100001F702731",
            "kind":"Meid"
          }
        ],
        "dataUsage":"0",
        "smsUsage":"0",
        "startDate":"2014-02-02T00:00:00.0000000",
        "endDate":"2014-02-25T00:00:00.0000000"
      }
    ]
  },
  "comment":"Request Completed Processing",
  "summary":{
    "devicesRequested":0
  },
  "status" : "Success",
  "callbackCount" : 1,
  "maxCallbackThreshold" : 4
}

UploadDevices

{
   "username":"",
   "password":"",
   "requestId":"595f5c44-c31c-4552-8670-020a1545a84d",
   "deviceResponse":{
      "deviceUploadResponse":{
         "devices":[
            {
               "deviceIds":[
                  {
                     "id":"89141390780800784259",
                     "kind":"Iccid"
                  },
                  {
                     "id":"990013907835573",
                     "kind":"Imei"
                  }
               ],
               "lineStatus":"Device upload successful."
            },
            {
               "deviceIds":[
                  {
                     "id":"42598914139078080078",
                     "kind":"Iccid"
                  },
                  {
                     "id":"990013907833575",
                     "kind":"Imei"
                  }
               ],
               "lineStatus":"Device upload successful"
            },
            {
               "deviceIds":[
                  {
                     "id":"780889141390780800",
                     "kind":"Iccid"
                  },
                  {
                     "id":"990013907837353",
                     "kind":"Imei"
                  }
               ],
               "lineStatus":"SIM Id is invalid"
            }
         ],
         "accountName":"1223334444-00001",
         "deviceSku":"VZW123456",
         "totalLineCount":"3",
         "failedLineCount":"1",
         "successLineCount":"2"
      }
   },
   "status":"Success",
   "callbackCount":1,
   "maxCallbackThreshold":4
}

EnhancedConnectivityService

SendSMSMessage

Per-Device Message

{  
  "username":"",
  "password":"",
  "requestId":"2c90bd28-ece4-42ef-9f02-7e3bd4fbff33",
  "deviceIds":[  
    {  
      "id":"89148000001134816189",
      "kind":"Iccid"
    },
    {  
      "id":"5096307971",
      "kind":"Mdn"
    },
    {  
      "id":"990000475989473",
      "kind":"Imei"
    },
    {  
      "id":"15096307971",
      "kind":"Msisdn"
    }
  ],
  "comment":"SendSmsMessage,Performed action on device.",
  "status":"Success",
  "callbackCount":1,
  "maxCallbackThreshold":4
}

Request Complete Message

{  
  "username":"",
  "password":"",
  "requestId":"2c90bd28-ece4-42ef-9f02-7e3bd4fbff33",
  "comment":"SendSmsMessage,Request Completed Processing."
  "summary": { 
    "devicesRequested": 2
  },
  "callbackCount": 1,
  "maxCallbackThreshold": 4
}

SmsDeliveryConfirmation Callback Messages

Success after device acknowledgement

{  
  "username":"",
  "password":"",
  "requestId":"2c90bd28-ece4-42ef-9f02-7e3bd4fbff33",
  "deviceIds":[  
    {  
      "id":"5096307971",
      "kind":"Mdn"
    }
  ],
  "deviceResponse":{  
    "smsDeliveryResponse":{  
      "confirmation":"Delivered"
    }
  }
}

SMS Message from Device

{
  {
    "messages": [
      {
        "deviceIds": [
          {
            "id": "09623489171",
            "kind": "esn"
          }
        ],
        "message": "testmessage1",
        "timestamp": "2016-01-01T12:29:49-08:00"
      },
      {
        "deviceIds": [
          {
            "id": "09623489171",
            "kind": "esn"
          }
        ],
        "message": "testmessage2",
        "timestamp": "2016-01-01T12:31:02-08:00"
      }
    ]
  },
  "hasMoreData": false
}

ExternalProvisioningChanges

This is an example of an ExternalProvisioningChanges callback message sent when a system other than the Wireless Network Services API or ThingSpace Connectivity Management API activates a line of service for a device.

{
  "username":"",
  "password":"",
  "requestId":"24da9f9a-d110-4a54-86b4-93fb76aab83c",
  "deviceIds":[
    {
      "id":"666456789014008",
      "kind":"Imei"
    }
  ],
  "deviceResponse":{
    "externalProvisioningChangeResponse":{
      "change":"Activate",
      "deviceInfo":{
        "accountName":"1223334444-00001",
        "billingCycleEndDate":"2017-11-30T00:00:00.0000000Z",
        "carrierInformations":[
          {
            "carrierName":"Verizon Wireless",
            "servicePlan":"M2M5GB",
            "state":"active"
          }
        ],
        "connected":true,
        "createdAt":"2017-11-27T14:03:21.0000000Z",
        "deviceIds":[
          {
            "id":"5860699580",
            "kind":"mdn"
          },
          {
            "id":"311480100485450",
            "kind":"imsi"
          },
          {
            "id":"100120021847961",
            "kind":"imei"
          },
          {
            "id":"65432165432268479362",
            "kind":"iccId"
          },
          {
            "id":"15860699580",
            "kind":"msisdn"
          },
          {
            "id":"5860699580",
            "kind":"min"
          }
        ],
        "groupNames":[
          "Default: West coast trucks"
        ],
        "ipAddress":"1.1.29.169",
        "lastActivationBy":"User Verizon",
        "lastActivationDate":"2017-11-27T14:13:37.0000000Z"
      }
    }
  },
  "status" : "Success",
  "callbackCount" : 1,
  "maxCallbackThreshold" : 4
}

GoToState

{
 "username":"",
  "password":"",
  "requestId":"595f5c44-c31c-4552-8670-020a1545a84d",
  "deviceIds":[
    {
      "id":"99412344682328800000",
      "kind":"Iccid"
    },
    {
      "id":"994123446823288",
      "kind":"Imei"
    }
  ],
  "deviceResponse":{
    "usageResponse":[],
    "goToStateResponse":{
      "deviceIds":[
        {
          "id":"99412344682328800000",
          "kind":"Iccid"
        },
        {
          "id":"994123446823288",
          "kind":"Imei"
        }
      ],
      "serviceName":"WAM",
      "stateName":"WAM Activate"
    }
  },
  "status" : "Success",
  "callbackCount" : 1,
  "maxCallbackThreshold" : 4
}

PromoChanges

ThingSpace sends messages when there are changes to the promotional codes for a line of service, such as when a promotional code expires. ThingSpace sends a PromoChange callback message shortly after the end of a device’s billing cycle if a promotional package was removed during the billing cycle.

NOTE: You can use the POST /devices/actions/list to see all active promotional codes for a device and the scheduled end date for each one.

{
  "username":"",
  "password":"",
  "requestId":"90682b54-66ad-4c1f-a0f2-f3bb77ea298b",
  "deviceIds":[
    {
      "id":"458928305141706",
      "kind":"IMEI"
    }
  ],
  "deviceResponse":{
    "promoChangeResponse":{
      "change":"PromoCode Dropped.",
      "changeDate":"12/15/2017 12:00:00 AM"
    }
  }
}

ResumeTrackingNotification

{
  "username":"",
  "password":"",
  "requestId":"24da9f9a-d110-4a54-86b4-93fb76aab83c",
  "deviceResponse":{
    "deviceIds":[
      {
        "id":"8695542182",
        "kind":"Mdn"
      },
      {
        "id":"DAD20141201440",
        "kind":"Meid"
      }
    ],
    "comment":"Device will be auto resumed on - 12/15/2018 12:00:00 AM"
  }
}