Using Alert Preset Endpoints

Creating Alert Presets

To Create an Alert Preset you will need to provide a name, at least one alert trigger, and when you would like triggers to send notifications at the very minimum. The remaining fields outlined below may be filled out if desired. Refer to the trigger documentation to learn more about trigger types, their data structures, and how they can be customized to trigger on different segments of your shipment.

{
    "name": "My Example Alert Preset",
    "description": "Public API alert preset example",
	  "notifyWhenActive": true,
    "notifyAllCollaborators": true,
    "assignees": ["USER_GUID"],
    "temperatureTriggers": [
        {
            //Immediately alert when the temperature is greater than 0C
            "triggerValue": 0,
            "triggerUnit": "C",
            "interval": 0,
            "intervalUnit": "",
            "type": "TemperatureMax",
            "isActiveAtOrigin": false,
          	"isActiveInTransit": true,
            "isActiveAtDestination": false
        }
    ]
}

Retrieving Alert Presets

A Single Alert Preset

Use the Retrieve an Alert Preset endpoint to get a single Alert Preset object by its alertPresetId:

GET public/v3/alertpresets/123456

Listing Alert Preset

Use the List Alert Presets endpoint to list all Alert Presets in your account You will have the ability to filter down the results by the alert preset name or by the type of trigger within an alert preset.

When filtering by name, results only need to contain the name specified and will be case insensitive. For example, setting name to Tive would return results such as My tive alert preset, TIVE Alert Preset, or Tive.

{
    "totalRecords": 1,
    "pageNumber": 1,
    "pageSize": 50,
    "data": [
        {
            "id": 62706,
            "name": "My tive alert preset",
            "description": "Public API alert preset example",
            "notifyWhenActive": true,
            "notifyAllCollaborators": true,
            "assignees": [
                "USER_GUID"
            ],
            "temperatureTriggers": [
                {
                    "triggerValue": 0,
                    "triggerUnit": "C",
                    "intervalDelay": 0,
                    "intervalDelayUnit": "hours",
                    "type": "TemperatureMax",
                    "isActiveAtOrigin": false,
                    "isActiveInTransit": true,
                    "isActiveAtDestination": true
                }
            ],
            "percentTriggers": [
                {
                    "triggerValue": 25,
                    "triggerUnit": "%",
                    "type": "BatteryPowerMin",
                    "isActiveAtOrigin": true,
                    "isActiveInTransit": true,
                    "isActiveAtDestination": true
                }
            ],
            "arriveDepartTriggers": [
                {
                    "alertOn": "Arrival",
                    "type": "ShipmentArriveDepart",
                    "isActiveAtOrigin": false,
                    "isActiveInTransit": false,
                    "isActiveAtDestination": true
                }
            ],
            "intervalTriggers": [
                {
                    "type": "ShipmentStopped",
                    "intervalDelay": 2,
                    "intervalDelayUnit": "hours",
                    "isActiveAtOrigin": false,
                    "isActiveInTransit": true,
                    "isActiveAtDestination": false
                }
            ],
            "shockLightTriggers": [
                {
                    "type": "LightChanges",
                    "isActiveAtOrigin": false,
                    "isActiveInTransit": true,
                    "isActiveAtDestination": false
                }
            ]
        }
    ]
}

Updating an Alert Preset

Use the Update an Alert Preset endpoint to update an Alert Preset.

For example, if you wanted to add an assignee to the alert preset, you could submit the following request:

{
    "name": "My Example Alert Preset",
    "description": "Public API alert preset example",
  	"notifyWhenActive": true,
    "notifyAllCollaborators": true,
    "assignees": [
        "USER_GUID",
        "USER_2_GUID"
    ],
    "temperatureTriggers": [
        {
            "triggerValue": 0,
            "triggerUnit": "C",
            "interval": 0,
            "intervalUnit": "",
            "type": "TemperatureMax",
            "isActiveAtOrigin": false,
            "isActiveInTransit": true,
            "isActiveAtDestination": false
        }
    ]
}
}