Skip to content

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.

  1. Add webhook — the https://… address of your system, a description and the events you need.
  2. After saving, copy the signing secret — it is shown once. With the secret you verify that a request came from WorkBooth.
  3. Send test — send a ping test event and see your server's answer at once.
ActionWhat it does
Deliveriesthe last 50 deliveries: time, event, status, attempts, response code, duration, error
Editaddress, description, events
Pause / Resumestop and resume sending
New secretissue a new secret; signatures made with the old one stop matching at once
Deletedelete 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:

http
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": { … } }
}
FieldWhat it is
idthe event identifier — the same in every delivery retry
eventthe event type
created_atwhen the event happened, UTC
company_idyour company
dataevent 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

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

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

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 2xx within 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 failed status 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_at and the status in the data.

Events ​

EventWhen
booking.createda booking was created — in the interface, through the API, from a calendar, or someone sat down without a booking (walk-in)
booking.updatedthe booking time or subject changed
booking.startedsomeone entered the cabin — the booking became active
booking.completedthe meeting took place and ended
booking.no_shownobody came
booking.cancelledthe booking was cancelled
cabin.occupiedsomeone entered the cabin
cabin.vacatedthe cabin became free
visit.recordeda visit was recorded: entry time, exit time and duration
cabin.onlinethe cabin came online
cabin.offlinethe cabin went offline
alert.raisedan alert appeared
alert.clearedan alert cleared
pingthe test event of the Send test button

Bookings ​

data.booking — the booking in the same form as in the API:

json
{
  "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 ​

json
{
  "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 ​

json
{
  "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 ​

json
{
  "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.kindMeaningCleared
offlinethe cabin has been offline for more than 5 minutesyes, when the cabin is back
scale_faulta load cell failureyes
nvsthe board cannot write data to its memoryyes
ota_rollbacka firmware update was not confirmed, the cabin went back to the previous versionyes
safe_modethe cabin is in safe modeyes
telemetrythe cabin's telemetry snapshots arrive unreadable (metrics are not stored)yes, with the first readable snapshot
rebootthe cabin restarted because of a failureno, a one-off event
commissioncabin commissioning finished: alert.raised — with errors, alert.cleared — successfully—

alert.message is the alert text in Russian, as in notifications.

Python receiver example ​

python
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

© Modular Acoustic Solutions · WorkBooth