Sending attendance to payroll through a webhook
Updated · Author: Hadirly team
Attendance records from Hadirly can flow into a payroll system through a webhook. Each saved attendance record is sent as a signed message to the address you choose. The receiver checks the signature, matches data.user_id with the employee code in payroll, and stores the records by local_day. The account owner creates the endpoint in the webhook settings, without waiting for the Hadirly team. Hadirly does not calculate salaries, and it does not claim a built-in integration with any specific payroll product.
Message format
The message uses the standard envelope. The example below follows the shape of the data sent by the attendance event serializer in the backend. All values are examples.
{
"id": "evt_0190f3c2-6a1e-7d4b-9a3f-2b1c0d9e8f70",
"type": "attendance.recorded",
"created_at": "2026-11-20T07:01:03.410Z",
"org_id": "0190f3c2-6a1e-7d4b-9a3f-2b1c0d9e8f71",
"data": {
"id": "0190f3c2-6a1e-7d4b-9a3f-2b1c0d9e8f72",
"org_id": "0190f3c2-6a1e-7d4b-9a3f-2b1c0d9e8f71",
"user_id": "0190f3c2-6a1e-7d4b-9a3f-2b1c0d9e8f73",
"direction": "in",
"occurred_at": "2026-11-20T07:01:02.123Z",
"received_at": "2026-11-20T07:01:03.410Z",
"source": "mobile",
"method": "biometric_gps",
"kiosk_id": null,
"site_id": "0190f3c2-6a1e-7d4b-9a3f-2b1c0d9e8f74",
"device_id": "0190f3c2-6a1e-7d4b-9a3f-2b1c0d9e8f75",
"score": null,
"liveness": null,
"template_id": null,
"model_id": null,
"skew_ms": null,
"mode_applied": null,
"location": {
"lat": -6.2,
"lng": 106.816,
"accuracy_m": 12.0,
"is_mock": false,
"distance_m": 35.5
},
"status": "accepted",
"flags": [],
"reason": null,
"note": null,
"review": null,
"local_day": "2026-11-20",
"created_at": "2026-11-20T07:01:03.410Z"
}
}The id in the envelope becomes webhook-id. data.id is the attendance record ID, and it stays the same on every redelivery. The flat format puts the contents of data at the top level and turns the location object and flags into JSON text.
Checking the signature
The steps are the same as for the generic webhook. Read webhook-id, webhook-timestamp, and webhook-signature. Reject the message if the timestamp differs by more than 5 minutes. Compute the HMAC-SHA256 of {id}.{timestamp}.{raw body} with the key made from the base64 bytes of the secret after the whsec_ prefix, then compare the v1 value using a constant-time comparison. Run this check before the data touches the payroll system. The Hadirly integration guide includes code for Node.js, Python, PHP, and Go.
Field mapping
| Field | Meaning | Note for payroll |
|---|---|---|
data.user_id |
Hadirly user ID | Map it to the employee code on your side |
data.direction |
in or out |
Pair each in with the next out on the receiver side |
data.occurred_at |
Time of the check in or check out, in UTC | Used for ordering |
data.local_day |
Date in the site’s time zone | Used for daily grouping |
data.status |
accepted or flagged |
Review flagged records before counting them |
data.flags |
List of flags, for example outside_geofence |
Keep for the audit trail |
data.location |
Latitude, longitude, accuracy, is_mock, distance |
For audit, not for calculation |
Retries and delivery log
- After a failure, Hadirly tries again after 1 minute, 5 minutes, 30 minutes, 2 hours, and 12 hours. There are six attempts in total. If all of them fail, the delivery is marked
dead. - Each delivery has the status
pending,failed,delivered, ordead, along with the last HTTP status code and error message. - An endpoint is disabled automatically when its last five deliveries have the status
dead. A silent receiver must not be taken to mean that there were no attendance records. - Delivery logs for
deliveredordeaditems are deleted after 30 days. Keep your own copy if you need a longer trail.
Idempotency and order
Delivery is at least once. The same message can arrive more than once, and retries carry the same webhook-id. The safe deduplication key is data.id, because it stays the same for one attendance record. Arrival order is not guaranteed, because a retry can arrive after a newer message, so sort by data.occurred_at.
Flagged attendance also triggers attendance.recorded and attendance.flagged separately. Both carry the same data.id. With a subscription to attendance.recorded alone, each attendance record comes in through one event type. Deduplicate by data.id to handle retries.
What is not sent
- Manager review decisions are not sent as separate events. The record is sent before it is reviewed.
- Attendance events do not carry the payroll employee code. The mapping from
user_idto that code is kept on your side. - Attendance rejected by the server is never sent. Only recorded attendance reaches the webhook, including flagged records.
CSV export as a backup
The export from /v1/attendance/export.csv includes the ID, time, local day, direction, status, flags, user and site identity, distance, accuracy, is_mock, and time zone. Times are printed in the site’s time zone with an offset, and a timezone column names the zone. Use this export for daily reconciliation, or to fill a gap if the endpoint was down. Text cells that start with =, +, -, or @ get a leading ' so they are not read as formulas.
Limits
- Hadirly does not provide a built-in connection to any payroll product. The account owner builds or chooses the webhook receiver.
- Hadirly does not calculate working hours inside the webhook. Pairing check ins and check outs happens on the receiver side.
- Delivery logs are kept for only 30 days for completed deliveries.
Checklist
- The endpoint subscribes only to
attendance.recorded. - The signature is checked before data reaches payroll.
- The mapping from
user_idto employee code has been tested with one employee. - Deduplication uses
data.id. - The daily CSV export is compared with the number of records received.
- A disabled endpoint is reviewed before it is turned on again.
Sources
- Standard Webhooks, specification (GitHub, standard-webhooks).