Guides
Webhooks
Gbàlejò tells your systems what happens as it happens: each event is sent to your endpoint as a signed HTTPS POST, retried when your endpoint does not answer, and kept in a delivery log you can replay from.
Events
| Event | When |
|---|---|
visit.created | A visit is made, however it was made (the app, the API, a list, a walk-in): one for each visitor and day. |
visit.checked_in | A visitor checks in, at a kiosk or the desk (after approval, when their type needs it). |
visit.checked_out | A visitor checks out, or is checked out at the site’s end of day (status AUTO_CHECKED_OUT). |
visit.cancelled | A visit is cancelled (one event for each visit of a series). |
visit.denied | A visitor is refused at check-in: approval refused, or blocked by the watchlist. |
watchlist.matched | A visitor matches a watchlist entry when screened at check-in (one event for each entry). |
evacuation.started | An evacuation starts at a site. |
evacuation.ended | An evacuation ends, with its counts. |
Owners and organisation admins add endpoints in Settings → Webhooks: an https address (not on a private network) and the events it wants. Webhooks are part of the Business and Enterprise plans.
What we send
A JSON body with the event’s id, type, when it happened (createdAt) and its data. Events are thin: ids, statuses and times, never a visitor’s details. Read those with the API, with a key that may.
{
"id": "0c5e8f2a-6b1d-4e3a-9f7c-2a4d8b6e1c57",
"type": "visit.checked_in",
"createdAt": "2027-01-14T09:04:12.000Z",
"data": {
"visit": {
"id": "8b0e7c1a-4f2d-4b9e-a6c3-2d1f5e9a7b40",
"status": "CHECKED_IN",
"from": "EXPECTED",
"at": "2027-01-14T09:04:12.000Z"
}
}
}- Gbalejo-Event
- The event’s type, as in the body.
- Gbalejo-Delivery
- This delivery’s id: the same on each retry, new for a replay.
- Gbalejo-Signature
t=<unix seconds>,v1=<signature>: see below.- User-Agent
Gbalejo-Webhooks/1.
The event’s id is the same on every endpoint told of it and on a replay: use it to act on each event once. Events may arrive out of order; compare times when it matters.
Each event’s data
{
"visit": {
"id": "8b0e7c1a-4f2d-4b9e-a6c3-2d1f5e9a7b40",
"status": "INVITED",
"source": "INVITE",
"siteId": "1c4f6a3e-9d2b-4e7a-8f1c-5a3b7d9e2c61",
"visitorTypeId": "5a2d8e1f-3c7b-4a9d-b6e2-9c4f1a7d3e53",
"hostId": "9e7b3f2a-1d5c-4e8b-a4f7-3b6d2c9e1a74",
"expectedStart": "2027-01-14T09:00:00.000Z",
"expectedEnd": "2027-01-14T11:00:00.000Z"
}
}{
"visit": {
"id": "8b0e7c1a-4f2d-4b9e-a6c3-2d1f5e9a7b40",
"status": "CHECKED_OUT",
"from": "CHECKED_IN",
"at": "2027-01-14T10:52:40.000Z"
}
}{
"match": {
"id": "d21a4c7e-3f8b-4a2d-9e6c-1b5f7a3d8c42",
"entryId": "77c3b9e1-2d4f-4c8a-a1e7-6f3b9d2c5a18",
"visitId": "8b0e7c1a-4f2d-4b9e-a6c3-2d1f5e9a7b40",
"siteId": "1c4f6a3e-9d2b-4e7a-8f1c-5a3b7d9e2c61",
"matchedOn": [
"NAME",
"PHONE"
],
"action": "BLOCK",
"outcome": "BLOCKED"
}
}{
"evacuation": {
"id": "4f9a2c6e-8b1d-4e7a-b3f5-7d2a9c4e1b63",
"siteId": "1c4f6a3e-9d2b-4e7a-8f1c-5a3b7d9e2c61",
"startedAt": "2027-01-14T11:30:00.000Z",
"onSite": 12
}
}
{
"evacuation": {
"id": "4f9a2c6e-8b1d-4e7a-b3f5-7d2a9c4e1b63",
"siteId": "1c4f6a3e-9d2b-4e7a-8f1c-5a3b7d9e2c61",
"endedAt": "2027-01-14T12:05:00.000Z",
"total": 14,
"safe": 11,
"missing": 1,
"left": 2
}
}fromis the status before the change;atis when it happened (for a kiosk that was offline, when the visitor did it).matchedOnlists what matched:NAME,PHONEorEMAIL.actionis the entry’s (ALERT,REQUIRE_APPROVALorBLOCK);outcomeis what happened at check-in.visitIdis null for a walk-in screened before their visit was made.onSiteis how many visitors were on the roll at the start; at the endsafewere marked safe,leftchecked out after it started, andmissingis the rest.
Check the signature
Each endpoint has its own signing secret (whsec_…), shown in Settings → Webhooks when you ask for it. The Gbalejo-Signature header holds the time it was sent and an HMAC-SHA256 of that time and the body, made with the secret:
- Split the header at the commas:
tis the time in Unix seconds,v1the signature in hex. - Compute the HMAC-SHA256 of
<t>.<body>with your secret, over the body exactly as it arrived. - Compare the two in constant time, and refuse a time more than five minutes from now (a replayed request).
import { createHmac, timingSafeEqual } from 'node:crypto';
/** True when Gbàlejò signed this exact body with your endpoint's secret, less than five minutes ago. */
export function verifyGbalejoSignature(header, rawBody, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(header.split(',').map((part) => part.split('=', 2)));
const sentAt = Number(parts.t);
if (!Number.isInteger(sentAt) || !/^[0-9a-f]{64}$/.test(parts.v1 ?? '')) return false;
if (Math.abs(Date.now() / 1000 - sentAt) > toleranceSeconds) return false;
const expected = createHmac('sha256', secret).update(`${sentAt}.${rawBody}`).digest();
return timingSafeEqual(expected, Buffer.from(parts.v1, 'hex'));
}Use the raw body. Parsing the JSON and writing it out again changes spaces and order, and the signature no longer matches. Check the bytes you received, then parse them.
import express from 'express';
import { verifyGbalejoSignature } from './verify-gbalejo-signature.js';
const app = express();
app.post('/webhooks/gbalejo', express.raw({ type: 'application/json' }), (req, res) => {
const signed = verifyGbalejoSignature(
req.get('Gbalejo-Signature') ?? '',
req.body.toString('utf8'),
process.env.GBALEJO_WEBHOOK_SECRET,
);
if (!signed) return res.sendStatus(400);
const event = JSON.parse(req.body);
res.sendStatus(204); // Answer first: anything slow happens after.
// Act on event.type once per event.id (a replay carries the same id).
});Answers and retries
Answer with any 2xx status within 10 seconds; do the work after answering if it takes longer. Anything else is a failure: another status, no answer in time, or a redirect (redirects are not followed). A failed delivery is tried again after:
- 1 minute
- 5 minutes
- 30 minutes
- 2 hours
- 6 hours
- 12 hours
That is 7 tries in about a day. A test sent from Settings → Webhooks is a ping event, sent to the endpoint whatever events it chose.
An endpoint that has not answered with a 2xx for 3 days is switched off. The organisation’s owners and admins are told. Switch it back on in Settings → Webhooks once it works.
The delivery log
Settings → Webhooks lists each endpoint’s deliveries for 30 days: what was sent, when, the status it answered with, the first 2 kB of the answer and how long it took. Replay sends a delivery again as a new delivery of the same event, with the same id.