API and integrations

Sending alerts to a webhook and testing it

How alert events reach your own system as webhook calls: the address set once by the administrator, the webhook channel on an alert rule, a test through the rule, what your endpoint must answer and how to read the delivery log.

Ashish Srivastava4 min read

An integration engineer with headphones around his neck sits in a bright morning office, a small brass desk bell beside his laptop

A GPS tracking webhook posts each alert to your own system as JSON, as it happens. It takes two parts: the webhook address, which is one per installation and set by its administrator, and the webhook channel on an alert rule. Once both are in place, every event the rule matches is sent to the address as one POST, and a test through the rule shows whether your endpoint accepts it.

Key takeaways

  • The address is set once for the whole installation; you cannot enter your own in the app.
  • Add webhook to a rule's channels through the API (or tick it in the rule, where the portal offers it).
  • Test the rule: the result says per channel whether it was sent or refused, and with which status.
  • Answer with a 2xx status within the timeout; a failed call is not sent again.

1. The administrator sets the address

There is one webhook address for the installation, and every rule that uses the channel posts to it. It is set by the administrator in the server's configuration, not in a user's settings. Ask for an https address: full payloads are only ever sent to one. Administrators see whether the channel is on under Settings → Notification channels, where the webhook reads "Nothing: one address for the whole company" as what each person needs.

The Notification channels settings listing each channel, with the webhook row showing that it is on and needs one address for the whole company
Administrators see under Settings → Notification channels whether the webhook is switched on.

2. Add the webhook channel to a rule

A rule names an event type and the channels that carry it. Through the API, put webhook in the rule's notificators, next to the channels it already has:

curl -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  -d '{"type": "geofenceExit", "notificators": "web,webhook", "always": true}' \
  https://YOUR_HOST/api/notifications

To add the channel to an existing rule, read it with GET /api/notifications/{id}, add webhook to notificators and send the whole object back with PUT. Read GET /api/notifications/notificators first: if webhook is not in the list, the address is not set and the rule cannot use it.

Where the server offers the channel, the rule editor in the portal lists it under Tell people by as well, as "The server’s webhook, one address for everyone". The rule still needs devices: "always": true covers every device its recipients can see, or link chosen devices and groups. The API reference has both.

3. Send a test through the channel

Testing a rule sends its own wording, with "[Test]" in front, to you alone, through each of its channels. The webhook receives it with "test": true.

  • In the portal: open the rule under Alerts, choose Test these channels, pick the Device the test is about if you like, and select Send the test. The test runs on the saved rule, so save your changes first.
  • Through the API: POST /api/notifications/{id}/test, optionally with deviceId.
An alert rule open in the editor with the Test these channels dialog, a device picker and the Send the test button
Test these channels sends the saved rule to you alone, through each of its channels, the webhook included.

The answer lists each channel with its result: sent, or failed with the reason (gatewayRejected with the status your endpoint returned, gatewayUnreachable, timeout) and gatewayStatus. Tests are not written to the delivery log, so read the result here.

What your endpoint must answer, and in what time

Each matching event arrives as one POST with a JSON body per event and recipient:

{
  "event":   { "id": 1234, "type": "geofenceExit", "eventTime": "…", "deviceId": 12 },
  "device":  { "id": 12, "name": "…", "uniqueId": "…" },
  "userId":  7,
  "message": "…: geofence exit. Open the app for details."
}

By default the payload is short and carries no position; webhooks for developers lists every field.

  • Answer with a 2xx status. Any other status is recorded as refused, with that status.
  • Answer within the timeout, 10 seconds unless the administrator changed it. Store the body, answer, then do the slow work.
  • A call is made once. A failed one is not sent again, so read the delivery log after an outage.
  • A rule that reaches three people posts three times, each with its own userId. Use event.id if you want to act once per event.
  • Quiet hours hold back email, text messages, Telegram and push, never the webhook.

Read the delivery log

Every delivery of a real event writes one row per recipient and channel. Read the rows of one event, or of a device over a period:

curl -H "Authorization: Bearer $TOKEN" \
  "https://YOUR_HOST/api/notifications/deliveries?eventId=1234"

Each row has the channel, the status (sent, failed or skipped), the reason and the gatewayStatus. In the portal, opening an event shows the same under Sent to, for example "Webhook · sent" or "Webhook · gateway refused (500)". Rows are kept for 90 days by default, and reading them needs access to the device's events. The alerts feature explains the rules and channels behind it.

Frequently asked questions

Can each customer have their own webhook address?

No. There is one address per installation. Route by device or userId in your own endpoint.

Does the test count as an event?

No. It has no event id and leaves no row in the delivery log.

API and integrations

Downloading reports through the API

How to run the same reports as the portal from a script and receive JSON, CSV or Excel, with devices, groups and the period as parameters, the time zone and units of the token’s user, and long periods split into pieces.

Ashish Srivastava4 min read

Put your first device on the map today

Book a demo if you would rather see it with your own use case first. Choose a package in the portal; you see the first invoice before you confirm.

Chat with us