Webhooks
A webhook is an address of your system that WorkBooth sends events to as they happen: a booking was created, someone entered a cabin, a cabin went offline. No need to poll the API.
Setup
Addresses are set up by a company administrator: Profile → API & webhooks, the Webhooks block.
- Add webhook — the
https://…address of your system, a description and the events you need. - After saving, copy the signing secret — it is shown once. With the secret you verify that a request came from WorkBooth.
- Send test — send a
pingtest event and see your server's answer at once.
| Action | What it does |
|---|---|
| Deliveries | the last 50 deliveries: time, event, status, attempts, response code, duration, error |
| Edit | address, description, events |
| Pause / Resume | stop and resume sending |
| New secret | issue a new secret; signatures made with the old one stop matching at once |
| Delete | delete the address |
Address requirements: https, a public internet address. A company can have up to 10 addresses.
The request
WorkBooth sends a POST with JSON:
POST /hooks/workbooth HTTP/1.1
Content-Type: application/json
User-Agent: WorkBooth-Webhooks/1
X-WorkBooth-Event: booking.created
X-WorkBooth-Delivery: 7d1b9b4e-2f0c-4c43-9f41-0d3a6a1b8c55
X-WorkBooth-Signature: t=1789462811,v1=5f2b…c9
{
"id": "7d1b9b4e-2f0c-4c43-9f41-0d3a6a1b8c55",
"event": "booking.created",
"created_at": "2026-09-15T07:20:11Z",
"company_id": 4,
"data": { "booking": { … } }
}| Field | What it is |
|---|---|
id | the event identifier — the same in every delivery retry |
event | the event type |
created_at | when the event happened, UTC |
company_id | your company |
data | event data — see Events |
Verifying the signature
The header X-WorkBooth-Signature: t=<time>,v1=<signature>:
t— sending time, Unix seconds;v1— HMAC-SHA256 of the string<t>.<request body>with the address secret, in hex.
Verify the signature against the raw request body — before parsing JSON — and reject requests whose t differs from the current time by more than 5 minutes.
Python
import hashlib, hmac, time
def verify(secret: str, body: bytes, header: str, tolerance: int = 300) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
t, sig = parts.get("t", ""), parts.get("v1", "")
if not t.isdigit() or abs(time.time() - int(t)) > tolerance:
return False
expected = hmac.new(secret.encode(), f"{t}.".encode() + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, sig)Node.js
import crypto from "node:crypto";
export function verify(secret, rawBody, header, toleranceSec = 300) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2)));
const t = Number(parts.t);
if (!Number.isFinite(t) || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false;
const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
const a = Buffer.from(expected), b = Buffer.from(parts.v1 ?? "");
return a.length === b.length && crypto.timingSafeEqual(a, b);
}PHP
function verify(string $secret, string $body, string $header, int $tolerance = 300): bool
{
if (! preg_match('/^t=(\d+),v1=([0-9a-f]{64})$/', $header, $m) || abs(time() - (int) $m[1]) > $tolerance) {
return false;
}
return hash_equals(hash_hmac('sha256', $m[1].'.'.$body, $secret), $m[2]);
}Response and retries
- Answer with
2xxwithin 10 seconds — the delivery counts. Do long processing after answering. - Any other code, a timeout or a connection error — a retry after 30 seconds, 2 minutes, 10 minutes, 30 minutes and an hour: 6 attempts in total. After the last one the delivery gets the
failedstatus in the log. - Redirects (
3xx) are not followed and count as a failure. - An event may arrive more than once — drop duplicates by
id. - The delivery order of different events is not guaranteed — rely on
created_atand the status in the data.
Events
| Event | When |
|---|---|
booking.created | a booking was created — in the interface, through the API, from a calendar, or someone sat down without a booking (walk-in) |
booking.updated | the booking time or subject changed |
booking.started | someone entered the cabin — the booking became active |
booking.completed | the meeting took place and ended |
booking.no_show | nobody came |
booking.cancelled | the booking was cancelled |
cabin.occupied | someone entered the cabin |
cabin.vacated | the cabin became free |
visit.recorded | a visit was recorded: entry time, exit time and duration |
cabin.online | the cabin came online |
cabin.offline | the cabin went offline |
alert.raised | an alert appeared |
alert.cleared | an alert cleared |
ping | the test event of the Send test button |
Bookings
data.booking — the booking in the same form as in the API:
{
"event": "booking.no_show",
"data": {
"booking": {
"id": 3051,
"cabin": { "id": 12, "serial": "555", "name": "Meeting room 3" },
"starts_at": "2026-09-15T11:00:00Z",
"ends_at": "2026-09-15T11:30:00Z",
"status": "no_show",
"source": "api",
"subject": "Client call",
"organizer_email": "anna@example.com",
"external_id": "crm-7781",
"created_at": "2026-09-15T07:20:11Z"
}
}
}Occupancy and connection
{
"event": "cabin.occupied",
"data": {
"cabin": { "id": 12, "serial": "555", "name": "Meeting room 3" },
"at": "2026-09-15T11:02:40Z"
}
}cabin.vacated, cabin.online and cabin.offline arrive in the same form. cabin.offline is sent when the server stops receiving the cabin's messages (usually 15–75 seconds after the link is lost).
Visit
{
"event": "visit.recorded",
"data": {
"cabin": { "id": 12, "serial": "555", "name": "Meeting room 3" },
"visit": {
"entry_at": "2026-09-15T11:02:40Z",
"exit_at": "2026-09-15T11:29:05Z",
"duration_sec": 1585,
"time_corrected": false
},
"at": "2026-09-15T11:29:06Z"
}
}time_corrected: true — the cabin had no exact time, and the server pinned the visit to the moment it arrived; the duration is still correct. If the cabin was offline, the visit arrives when the link returns.
Alerts
{
"event": "alert.raised",
"data": {
"cabin": { "id": 12, "serial": "555", "name": "Meeting room 3" },
"alert": { "kind": "scale_fault", "message": "отказ датчика веса (маска 2: bit0 — датчик 0, bit1 — датчик 1)" },
"at": "2026-09-15T11:40:00Z"
}
}alert.kind | Meaning | Cleared |
|---|---|---|
offline | the cabin has been offline for more than 5 minutes | yes, when the cabin is back |
scale_fault | a load cell failure | yes |
nvs | the board cannot write data to its memory | yes |
ota_rollback | a firmware update was not confirmed, the cabin went back to the previous version | yes |
safe_mode | the cabin is in safe mode | yes |
telemetry | the cabin's telemetry snapshots arrive unreadable (metrics are not stored) | yes, with the first readable snapshot |
reboot | the cabin restarted because of a failure | no, a one-off event |
commission | cabin commissioning finished: alert.raised — with errors, alert.cleared — successfully | — |
alert.message is the alert text in Russian, as in notifications.
Python receiver example
import os
from flask import Flask, abort, request
from verify import verify # the function from "Verifying the signature"
app = Flask(__name__)
SECRET = os.environ["WORKBOOTH_WEBHOOK_SECRET"]
seen = set() # in production — a database or Redis
@app.post("/hooks/workbooth")
def workbooth():
if not verify(SECRET, request.get_data(), request.headers.get("X-WorkBooth-Signature", "")):
abort(401)
event = request.get_json()
if event["id"] in seen:
return "", 200 # a retry of an event already handled
seen.add(event["id"])
if event["event"] == "booking.no_show":
booking = event["data"]["booking"]
print("no-show:", booking["external_id"], booking["cabin"]["name"])
return "", 200