Skip to main content

Webhooks

Create webhooks under Settings > API & Webhooks. URLs must use HTTPS unless a developer explicitly enables the insecure-URL filter for a controlled environment.

Events​

  • reservation.created
  • reservation.updated
  • reservation.rescheduled
  • reservation.status_changed
  • reservation.cancelled
  • reservation.deleted
  • payment.registered
  • payment.refunded
  • customer.created
  • customer.updated
  • customer.deleted
  • service.created
  • service.updated
  • service.deleted
  • promotion.created
  • promotion.updated
  • promotion.deleted

Test an endpoint​

In Settings > API & Webhooks, select Test on a webhook to send it a webhook.test event, signed like every other event, with this data:

{"message": "Webhook endpoint verification"}

Use it to check the URL and your signature verification before real events arrive. You can't subscribe a webhook to webhook.test: it is sent only by Test.

Each webhook in the list shows its last delivery: the date, and the HTTP status of the response or the connection error, or No deliveries yet. A test counts as a delivery. The switch of the webhook pauses or resumes its deliveries.

Payload​

{
"id": "evt_xxx",
"event": "reservation.created",
"created": 1779190000,
"site": {
"url": "https://example.com",
"timezone": "Europe/Rome",
"pluginVersion": "4.2.0"
},
"actor": {
"type": "api",
"id": "abc123...wxyz"
},
"data": {}
}

Actor​

actor says who caused the event:

typeidWhen
userThe WordPress user IDSomeone worked in the WordPress admin, or a customer in the booking widget.
apiA preview of the API token, for example abc123...wxyzAn integration used the public API.
systemnullTheBooking acted by itself, for example a scheduled task.

A reservation cancelled because its event was deleted in Google Calendar (see Cancellation from Google Calendar) sends reservation.cancelled with the system actor, and two more top-level fields: origin, set to google_reverse, and operationId. Its id stays the same if the delivery is repeated, so deduplicate it like any other event.

Data​

Eventsdata
reservation.*reservation: the reservation with its data properties (price, tickets, booking-form answers, internalNote) and bookedFor. reservation.status_changed adds status; reservation.updated adds change, what changed; reservation.rescheduled adds old and new, each with start, end, and providerId. reservation.deleted sends only reservationId.
payment.registeredreservationIds, gatewayId, amount, and details.
payment.refundedreservation, gatewayId, and refund.
customer.*customer, without the access token that signs the customer's reservation links. customer.deleted sends only customerId.
service.*service. service.deleted sends only serviceId.
promotion.*promotion, as stored. promotion.deleted sends only promotionId.

internalNote is the staff's internal note: customers never see it in TheBooking, but every webhook that receives reservation events gets it.

A promotion with a list of single-use codes does not send the codes: each one goes to one customer and must stay secret, and a list can hold thousands. data.couponCount says how many codes the list has. A coupon with a shared code sends it, because its code is the promotion name, which is made to be given out.

Headers​

  • X-TBK-Event
  • X-TBK-Delivery
  • X-TBK-Timestamp
  • X-TBK-Site
  • X-TBK-Signature: sha256=<hex digest>

The signed bytes are:

<X-TBK-Timestamp>.<raw request body>

Always verify the raw body before parsing JSON and use a timing-safe comparison.

Verify in PHP​

$timestamp = $_SERVER['HTTP_X_TBK_TIMESTAMP'] ?? '';
$provided = $_SERVER['HTTP_X_TBK_SIGNATURE'] ?? '';
$rawBody = file_get_contents('php://input');
$expected = 'sha256=' . hash_hmac('sha256', $timestamp . '.' . $rawBody, $secret);

if (!hash_equals($expected, $provided)) {
http_response_code(401);
exit;
}

Verify in Node.js​

import crypto from 'node:crypto';

function verifyWebhook({timestamp, rawBody, signature, secret}) {
const expected = `sha256=${crypto
.createHmac('sha256', secret)
.update(`${timestamp}.${rawBody}`)
.digest('hex')}`;

const left = Buffer.from(expected);
const right = Buffer.from(signature);
return left.length === right.length && crypto.timingSafeEqual(left, right);
}

Delivery behavior​

Delivery is synchronous with a default timeout of five seconds. A failure does not roll back the original booking command. The webhook record stores delivery and failure counters plus the latest status.

Version 4 does not include an asynchronous retry queue. Respond with a 2xx quickly, deduplicate by X-TBK-Delivery, and run reconciliation for critical integrations.