Standard APIsConnectivity ManagementGuidesUses and Requirements

Create a Trigger for Usage Notifications

Create a Trigger for Usage Notifications

When a trigger’s condition is met, an alert notification will be sent as a callback message. The account must be registered for the AlertService callbacks to receive these notifications.

Other conditions and limitations:

  • You can set the trigger for the entire account; it is not device specific.
  • The API monitors for other IMEI changes like SIM swaps, which can be used to detect SIM use in a device.
  • The callback response includes both the previous IMEI and the updated IMEI.
  • The API will not create triggers for a device if the preIMEI is different than the postIMEI after OTA is complete.
  • Alerts are sent at 1am UTC (01:00Z) time

Request Components

HTTP Request

POST https://thingspace.verizon.com/api/v1/triggers

Header Parameters

The request header must contain a current ThingSpace authorization bearer token and a valid VZ-M2M session token, and must set the content-type to JSON.

Parameter NameData TypeDescription
Authorization (required)stringHTTP Authorization bearer token.
VZ-M2M-Token (required)stringA valid session token returned by POST /session/login.
Content-Type (required)stringMust be application/json.

Request Body

The information about the trigger that you want to create.

Parameter NameData TypeDescription
name (required)stringA unique name for this trigger.
accountName (required)stringThe Verizon billing account that the trigger will belong to. An account name is numeric and must include any leading zeros.
groupName (required)stringThe name of a device group, if you want this trigger to only be active for devices in that group. If you do not specify a device group, the trigger will be active for all devices in the account.
triggerCategory (required)stringThe type of usage that the trigger responds to. Valid values are:
AggregateDeviceUsage - The sum of all data usage for all devices on an account.
DeviceIMEIChange - The device IMEI change.
DeviceSMSUsage - The number of SMS (text) messages sent by and/or to a device.
DeviceDataUsage - The amount of data sent by a device.
DeviceSessionTime - The duration of session connections.
triggerCycle (required)stringThe accumulation cycle of the trigger, Daily, Weekly, or Monthly. Not needed for deviceSessionTime triggers. Weekly cycles start on Monday and monthly cycles are based on the account billing cycle.
smsTriggerRequest (required when triggerCategory = DeviceSMSUsage)stringThe details of the DeviceSMSUsage trigger.
smsType (required for smsTriggerRequest)stringThe type of SMS messages that count toward the trigger criteria:
MO = Mobile-Originated (SMS messages sent by devices)
MT = Mobile-Terminated (SMS messages sent to devices)
MOMT = SMS messages sent by devices and to devices
threshold (required for smsTriggerRequest)stringThe number of smsType messages required to activate the trigger, based on the comparator.
comparator (required for smsTriggerRequest)stringThe type of comparison to be made between the number of smsType messages and threshold:
gt (greater than)
lt(less than)
dataTriggerRequest (required when triggerCategory = deviceDataUsage)stringThe details of the deviceDataUsage trigger.
threshold (required for smsTriggerRequest)stringThe amount of ThresholdUnit data required to activate the trigger, based on the comparator.
thresholdUnit (required for dataTriggerRequest)stringUnits to be used for counting data usage:
KB = Kilobytes
MB = Megabytes
GB = Gigabytes
comparator (required for dataTriggerRequest)stringThe type of comparison to be made between actual data usage and threshold:
gt (greater than)
lt (less than)
sessionTriggerRequest (required when triggerCategory = deviceSessionTime)stringThe details of the deviceSessionTime trigger.
threshold (required for sessionTriggerRequest)stringThe number of seconds of session time required to activate the trigger, based on the comparator.
comparator (required for sessionTriggerRequest)stringThe type of comparison to be made between actual session duration and threshold:
lt (less than)
gt (greater than)

Example Request Body

A trigger for devices in the “NV trucks” device group that send more than 100 SMS messages in a week.

{
    "name": "SMS sent by trucks",
    "accountName": "0000123456-00001",
    "groupName": "NV trucks",
    "triggerCategory": "DeviceSMSUsage",
    "triggerCycle": "weekly",
    "smsTriggerRequest": {
        "smsType": "MO",
        "threshold": "100",
        "comparator": "gt"
    }
}

A request body for a trigger for DeviceIMEI change.

{
    "name": "IMEI Change Alert",
    "accountName": "0000123456-00001",
    "triggerCategory": "DeviceIMEIChange",
    "triggerCycle": "Daily"
}

Success Responses

Status 200

Parameter NameData TypeDescription
triggerIdstringA unique identifier (UUID) for the new trigger. You must use this ID when making changes or deleting the trigger. All callbacks sent by this trigger will contain this triggerId.

Example Success Response

{
    "triggerId": "595f5c44-eeee-ffff-gggg-020a1545a84d",
}

Example Callback Messages

This notification identifies the trigger that sent the notification, the definition of the trigger, the device that met the criteria, and the time stamp of when the criteria was met.

{
    "username": "",
    "password": "",
    "requestId": "595f5c44-eeee-ffff-gggg-020a1545a84d",
    "deviceResponse": {
        "alertServiceResponse": {
            "triggerId": "595f5c44-eeee-ffff-gggg-020a1545a84d",
            "triggerName": "Weekly SMS MOMT Usage",
            "deviceIds": [
                {
                    "id": "10-digit phone number",
                    "kind": "Mdn"
                }
            ],
            "triggerDateTime": "3/7/2018 3:38:32 AM",
            "triggerValue": "26",
            "triggerCycle": "WEEKLY",
            "smsType": "MOMT",
            "threshold": "25"
        }
    },
    "callbackCount": 1,
    "maxCallbackThreshold": 4
}

This notification is for the DeviceIMEI change trigger, which includes pre- and postIMEI:

{
    "preImei": "15-digit IMEI",
    "postImei": "15-digit IMEI"
}

Example callback response after a SIM was moved from device_A to device_B:

{
    "requestId": "595f5c44-eeee-ffff-gggg-020a1545a84d",
    "deviceResponse": {
        "alertServiceResponse": {
            "triggerId": "595f5c44-eeee-ffff-gggg-020a1545a84d",
            "triggerName": "IMEI Change Alert",
            "deviceIds": [
                {
                    "id": "1+ 10-digit phone number",
                    "kind": "Msisdn"
                }
            ],
            "triggerDateTime": "6/30/2020 7:04:11 PM",
            "triggerValue": "0",
            "threshold": "0",
            "message": "IMEI Change Notification. MSISDN: {1+ 10-digit phone number}. IMEI change from {15-digit IMEI} to {15-digit IMEI}"
        }
    },
    "callbackCount": 1,
    "maxCallbackThreshold": 4
}

On this page