Advanced Configuration

Cancel an Alert

Alerts will be repeated every 30 seconds on all devices that have not yet acknowledged the alert. However, you can explicitly cancel an alert on these devices through an API DELETE request.

The DELETE request should take the following form:

DELETE /subscribers/{id}/api/v1/alerts/{task_id}
Authorization: RelayApiKey {apikey}

The following curl command deletes the alert we created above.

$ export subscriber_id=yourcustomersID
$ export apikey=myapikey123
$ curl -H "authorization: RelayApiKey $apikey" "https://api.relaypro.com/subscribers/$subscriber_id/api/v1/alerts/P9CThKfTsEbJx23trAArHCD" -X DELETE

Notice that we add a task_id to the end of the path. This ID matches the returned task_id value from the response of the curl command that started the alert above, canceling that alert on all remaining devices.

Analytics

An analytic event is created each time an alert has been acknowledged or has timed out. These events are logged on your account, and can be retrieved via the Relay CLI command relay analytics.

For example, the following analytic event would be logged if the alert above has been acknowledged by a device named Mary:

  => Showing up to 20 events  
  Workflow ID                                           Type   Category Instance ID                Timestamp                   User ID Content  
  ───────────────────────────────────────────────────── ────── ──────── ────────────────────────── ─────────────────────────── ─────── ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
  ...  
  wf_y9CSxgI2V4goVt2Q9AemmEKA_YXcZ4rRCQxfS8QmpNUx9AYA   user   tasks    GzpGAKVPGlhfHt4H3kuWXA     2023-12-18T15:01:12.262552Z         {"device":"Mary","task":{"id":"P9CThKfTsEbJx23trAArHCD","name":"alerts","task_type":{"major":1,"minor":1,"name":"alerts","namespace":"system"}},"type":"acknowledged"}  
  ...

However, if the alert timed out before any acknowledgement, the following analytic event would be logged:

=> Showing up to 20 events  
  Workflow ID                                           Type   Category Instance ID                Timestamp                   User ID Content  
  ───────────────────────────────────────────────────── ────── ──────── ────────────────────────── ─────────────────────────── ─────── ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
  ...  
  wf_k6WtQtSdgU2vS1uIT9CED9CD_R8isRGD5R0da55PB7pgY4C    user   tasks    GzpGAKVPGlhfHt4H3kuWXA     2023-12-18T15:03:00.000345Z         {"task":{"id":"P9CThKfTsEbJx23trAArHCD","name":"alerts","task_type":{"major":1,"minor":1,"name":"alerts","namespace":"system"}},"type":"timed_out"}  
  ...

The workflow analytics command will show the 20 most recent events in the last 7 days by default. To view more events (up to 7 days), use the --limit=100 option to increase the number of events displayed.

Last updated