Know the moment a chapter goes live. WebBooks sends a signed HTTPS request to your endpoint when something happens in the workspace: a book is published, a reader subscribes, credits are added.
Set Up an Endpoint
Open Settings › Developers › Webhooks. Workspace admins on the Professional plan and up can add endpoints (or use
POST /webhooks).Add the URL and pick events. A public
https://address on the default port (443). Pick the events you want, or all of them. Optionally limit it to some books.Copy the signing secret. It starts with
whsec_and is shown once. Use it to check every request really comes from WebBooks.Send a test. Press Send Test. Your endpoint gets a
webhook.testevent and the delivery log shows your response.
Events
Event | Sent when |
|---|---|
| A book was created. |
| A book went live for readers. |
| A book was taken offline. |
| A new version of a published book went live. |
| A chapter was added to a book. |
| A chapter went live for readers. |
| Someone subscribed to a book. |
| Someone unsubscribed from a book. |
| Credits were added to the workspace. |
| A paid plan started. |
| The plan changed. |
| The paid plan was canceled. |
| An AI agent asked for approval in the Inbox. |
| A test sent from Settings › Developers or the API. |
Subscribe to * to get every event, including ones added later. https://api.webbooks.ai/v1/events lists them with a sample of each (no key needed).
Payload
A JSON body, the same shape for every event. data holds what the event is about.
{
"id": "evt_5f0c1d2e3a4b4c5d9e8f7a6b5c4d3e2f",
"type": "chapter.published",
"created_at": "2026-11-27T18:41:00.512Z",
"workspace_id": "44444444-4444-4444-4444-444444444444",
"data": {
"book_id": "8b1f2c3d-4e5f-4a6b-9c7d-0e1f2a3b4c5d",
"chapter_id": "c4a2e9b1-7d3f-4e2a-8b6c-1d0e9f8a7b6c",
"title": "Your First One-on-One",
"first_publish": true,
"book": {
"id": "8b1f2c3d-4e5f-4a6b-9c7d-0e1f2a3b4c5d",
"title": "The First-Time Manager's Field Guide",
"slug": "first-time-managers-field-guide",
"is_published": true
}
}
}Subscriber events carry
data.subscriber:{ id, email, status }.Billing events carry what changed, for example
data.creditsoncredits.purchased.The same event can arrive twice (after a timeout, for example). Use
idto skip ones you have already handled.
Verify the Signature
WebBooks follows the open Standard Webhooks format, so any of its libraries can verify requests. Every request has three headers:
Header | Value |
|---|---|
| The event ID (the same on every retry). |
| When this attempt was sent, in Unix seconds. |
| One or more |
The signature is base64(HMAC-SHA256(key, "{id}.{timestamp}.{body}")), where the key is the part of the secret after whsec_, base64-decoded, and the body is the raw request body exactly as received. Reject requests whose timestamp is more than 5 minutes old.
Warning: Use the raw body. Verify before parsing. Parsing JSON and serializing it again changes the bytes, and the signature won't match.
Node.js
With the standardwebhooks package
// npm install standardwebhooks
import { Webhook } from "standardwebhooks";
const wh = new Webhook(process.env.WEBBOOKS_WEBHOOK_SECRET); // "whsec_…"
app.post("/webbooks", express.raw({ type: "application/json" }), (req, res) => {
let event;
try {
event = wh.verify(req.body.toString(), req.headers); // throws if invalid or stale
} catch {
return res.sendStatus(400);
}
if (event.type === "chapter.published") {
// …
}
res.sendStatus(200);
});With node:crypto
import crypto from "node:crypto";
// Express: use express.raw({ type: "application/json" }) so the body stays as sent.
export function verifyWebBooks(rawBody, headers, secret) {
const id = headers["webhook-id"];
const timestamp = headers["webhook-timestamp"];
const signatures = headers["webhook-signature"]; // "v1,<base64> v1,<base64>"
// Reject anything older than 5 minutes (replays).
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
const expected = crypto
.createHmac("sha256", key)
.update(`${id}.${timestamp}.${rawBody}`)
.digest("base64");
return signatures.split(" ").some((part) => {
const [version, signature] = part.split(",");
return version === "v1" && signature.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
});
}Python
With the standardwebhooks package
# pip install standardwebhooks
from standardwebhooks.webhooks import Webhook
wh = Webhook(os.environ["WEBBOOKS_WEBHOOK_SECRET"]) # "whsec_…"
@app.post("/webbooks")
def webbooks(request):
try:
event = wh.verify(request.body, dict(request.headers)) # raises if invalid or stale
except Exception:
return Response(status=400)
if event["type"] == "subscriber.created":
...
return Response(status=200)With hmac
import base64, hashlib, hmac, time
def verify_webbooks(raw_body: bytes, headers, secret: str) -> bool:
msg_id = headers["webhook-id"]
timestamp = headers["webhook-timestamp"]
signatures = headers["webhook-signature"] # "v1,<base64> v1,<base64>"
if abs(time.time() - int(timestamp)) > 300: # older than 5 minutes
return False
key = base64.b64decode(secret.removeprefix("whsec_"))
signed = f"{msg_id}.{timestamp}.".encode() + raw_body
expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
return any(
version == "v1" and hmac.compare_digest(sig, expected)
for version, _, sig in (part.partition(",") for part in signatures.split())
)Responding and Retries
Answer with any
2xxwithin 10 seconds. Do slow work after responding.Anything else (or no answer) is retried: after 1 minute, 5 minutes, 30 minutes, 2 hours, 5 hours, 10 hours, 14 hours and 20 hours. That is 8 tries over about two days.
An endpoint that has failed for 3 days with no success is switched off. Admins get a notification, and the endpoint shows why. Fix it, then switch it back on.
Redirects are not followed. The URL must be https on port 443 and a public host; private and local addresses are refused.
Delivery Log
Each endpoint keeps 30 days of deliveries: the event, status, tries, your response code, the first 1 KB of your response and how long it took. Press Resend on any delivery to send it again, or call POST /webhooks/{id}/deliveries/{delivery_id}/retry.
Tip: Test events are safe.
webhook.testis tried once and never counts toward switching an endpoint off.POST /webhooks/{id}/testanswers202with thedelivery_id; the result shows in the delivery log.
Managing endpoints from code (create, update, test, list deliveries) is in the REST API Reference chapter.