Developers and integrations
Sending tracking alerts to your own system with webhooks
How a GPS tracking webhook sends geofence, overspeed and SOS alerts into your ERP, helpdesk or chat tool: one address per installation, the channel on a rule, the payload, looking up details by event id, missed deliveries and tests.
Ashish Srivastava5 min read

A GPS tracking webhook sends alert events, such as a vehicle leaving a geofence, an overspeed or an SOS, straight into your ERP, helpdesk or chat tool as JSON. In Alongpin the webhook is a notification channel: the administrator of your installation sets one webhook address, you add the webhook channel to the alert rules that should reach it, and each matching event is posted once. The payload is short by default, so your receiver answers quickly and looks up the details through the API with the event id. This guide covers each step, the payload, delivery failures and testing.
Key takeaways
- There is one webhook address per installation, set by its administrator. You cannot enter your own endpoint in the app.
- Add
webhookto a rule's channels through the API; the rule decides which events and devices it covers.- The payload holds the event, the device, the user and a short message. The position is included only when an administrator sets the webhook detail to full and the address is https.
- Each event is posted once. Answer with a 2xx within the timeout (10 seconds by default), and read the delivery log after downtime.
- Testing a rule posts to the webhook too, marked
"test": true.
Before you begin
You need three things:
- The webhook address set up. Ask the administrator of your installation to set it to your receiver's https address. Administrators see which channels are on, and the webhook's payload, under the notification channels settings.
- A user and token for your integration, with a role that can read the devices and events it will look up, and write alert rules if it will create them.
- A receiver that accepts a JSON
POSTand answers fast.

Step 1: Agree the webhook address with the administrator
The webhook address belongs to the installation, not to a user, and every rule with the webhook channel posts there. That has two consequences for your design:
- One receiver for everything. If several systems need events, your receiver routes them on by device, group or event type.
- Use https. The platform sends the full payload only to an https address. A plain-http address always gets the minimal one.
The platform sends no credentials of its own with the request. Treat each delivery as a notice: before acting on it, confirm the event through the API with your own token (step 4). Ask the administrator how the address is protected on your side, for example by keeping it unguessable and accepting requests only from the platform's network.
Step 2: Add the webhook channel to an alert rule through the API
An alert rule names an event type and the channels that carry it. Add webhook next to the channels the rule 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
always: true applies the rule to every device the user can see. To limit it, leave always out and link the rule to devices or groups with /api/permissions. Read GET /api/notifications/types and GET /api/notifications/notificators first: they answer the event types and channels your installation offers.
Any event a rule can name, the webhook can carry: geofence enter and exit, overspeed, alarms such as SOS, low battery, a device going offline, maintenance due. Alerts explains how rules, schedules and recipients work.
Step 3: Read the payload

Each delivery is one POST with a JSON body, per event and recipient:
{
"event": { "id": 75, "type": "geofenceExit", "eventTime": "…", "deviceId": 17 },
"device": { "id": 17, "name": "Eicher Pro", "uniqueId": "…" },
"userId": 12,
"message": "Eicher Pro: geofence exit. Open the app for details."
}
| Field | What it holds |
|---|---|
event |
What happened and when: id, type, event time and device id |
device |
Which device: id, name and unique id |
userId |
The user the alert is for |
message |
The short text the other channels send, without a place |
position |
Only in a full payload: where the device was |
test |
true on a delivery made by testing a rule |
Why no position by default? Email, text messages and webhooks leave the platform, so they carry no location unless an administrator changes the message detail. Why the webhook payload has no location explains the setting. Because one event can reach several recipients, you may receive the same event.id more than once: deduplicate on it.
Step 4: Look up the details through the API with the event id
The event id is the key to everything else. With your token:
curl -H "Authorization: Bearer $TOKEN" https://YOUR_HOST/api/events/75
The answer includes the position id, the geofence or maintenance plan involved, and the event's attributes. Fetch the position with GET /api/positions?id=<positionId>. Each call is checked against your token's rights, so the details reach only systems that are allowed to see them.
Step 5: Answer in time, and read the delivery log after downtime
Delivery is simple, and that makes it predictable:
- One attempt per event. A failed delivery is not sent again.
- A timeout, 10 seconds by default; the administrator can change it. A slower answer counts as failed.
- 2xx means delivered. Any other status is recorded as rejected, with the status your endpoint returned.
So answer first and work afterwards: write the body to a queue, return 200, then process it. If your receiver was down, nothing is lost for good. Read the notification delivery log for the period with GET /api/notifications/deliveries?deviceId=17&from=…&to=…: each row shows the event id, the channel and whether it was sent or failed, with the reason (rejected, unreachable, timeout). Or simply ask /api/events for the events of that period and process the ones you have not seen. Quiet hours never hold back the webhook; they apply to email, text messages, Telegram and push.
Step 6: Send a test delivery
Before you rely on a rule, test it:
curl -X POST -H "Authorization: Bearer $TOKEN" https://YOUR_HOST/api/notifications/7/test
The test sends the rule's message through each of its channels to you alone, and the webhook receives it with "test": true at the top level. In the portal, Test these channels on the rule does the same. Make your receiver recognise the flag and route test deliveries away from production tickets. A test is not a real event: no alarm is raised and nothing is written to the delivery log.
If tests arrive but real events do not, webhook not receiving events lists what to check, and building a webhook endpoint walks through a receiver. The webhooks page and the API reference have the full reference.
Common mistakes to avoid
- Doing the work before answering. A slow ticket system turns every delivery into a timeout.
- Expecting retries. There are none; plan for the delivery log instead.
- Trusting the body alone. Confirm with the event id through the API before you act on an SOS.
- Expecting a per-customer URL. One address serves the whole installation; route on your side.
How Alongpin helps
Alongpin (alongpin.com) is a GPS tracking platform you open in a browser or on your phone. Everything the portal shows is in its REST API, with live positions over a WebSocket, webhooks for alerts, and integrations including an MCP server for AI assistants. Start in the developer overview, or sign up and create an API token in your account.


