Sign in for interactive examples and your API keys.
Get free API keysDocsWebhooks
Webhooks
Receive booking lifecycle events via signed POST requests to your endpoint.
Overview
BookRails sends HMAC-SHA256 signed POST requests to your endpoint on every booking lifecycle event. Events are retried with exponential backoff for up to 72 hours.
Verify & handle
javascript
import { verifySignature } from "@bookrails/sdk";
app.post("/hooks/bookrails", express.raw({ type: "application/json" }), (req, res) => {
const sig = req.headers["bookrails-signature"];
let event;
try {
event = verifySignature(req.body, sig, process.env.BOOKRAILS_WEBHOOK_SECRET);
} catch (err) {
return res.status(400).send("Invalid signature");
}
switch (event.type) {
case "booking.created":
await handleNewBooking(event.data);
break;
case "booking.no_show":
await notifyAgent(event.data.agentId);
break;
}
res.sendStatus(200);
});Event types
| Event | When |
|---|---|
| booking.created | A new booking is made by an agent |
| booking.confirmed | Business confirms (auto or manual) |
| booking.cancelled | Booking is cancelled by any party |
| booking.no_show | Business marks customer as no-show |
| booking.completed | Service completed; outcome recorded |
| booking.rescheduled | Slot changed by agent or business |
On this page