Webhooks
With a webhook you do not have to ask whether something changed: Ledenboek calls an address of yours as soon as it happens.
Setting up
An administrator adds an endpoint under Settings → Webhooks: a name, an https address and the events you want to receive. Ledenboek then shows the endpoint's secret (whsec_...), which you need to verify messages. The Send test message button sends a ping right away; the result appears in the endpoint's log.
Events
Every message has a type. The names are in English, like the objects in the API.
| Type | When | Object in data.object |
|---|---|---|
member.created | A member was created, for example through a registration. | member |
member.updated | A member's details changed (name, address, email, status and so on). | member |
member.cancelled | A member cancelled, stopped or died. The status in the object says which. | member |
invoice.created | An invoice was created, drafts included. | invoice |
invoice.paid | An invoice was paid in full. | invoice |
invoice.overdue | An open invoice is still unpaid after its due date. Once per invoice, the day after the due date. | invoice |
ping | The test message from the button in the app. | ping |
The message
A message is a JSON object shaped like the API under /v2. A member's date of birth and bank details are never included, even if a key has the scope for them. Custom fields (custom_fields) are included; a change to those alone does not produce member.updated.
{
"id": "evt_3f9a1c7e5b2d4a60c8e1f",
"object": "event",
"type": "member.created",
"created_at": "2026-11-27T10:15:00+01:00",
"data": {
"object": {
"object": "member",
"id": 1234,
"membership_number": "L042",
"first_name": "Anna",
"last_name": "de Vries",
"email": "anna@example.com",
"status": "active",
"member_since": "2026-11-27",
"created_at": "2026-11-27T10:15:00+01:00",
"updated_at": "2026-11-27T10:15:00+01:00"
}
}
}Headers
Every request is a POST with Content-Type: application/json and these headers:
Ledenboek-Event | The type, such as member.created. |
Ledenboek-Delivery | The message id (evt_...). It stays the same on a retry, so you can use it to spot duplicates. |
Ledenboek-Signature | The signature, in the form t=1767225600,v1=5257a8.... |
Verifying the signature
Always verify the signature: otherwise anyone who knows your address can post a message to it. The signature is an HMAC-SHA256 over t, a dot and the unmodified body, keyed with the endpoint's secret, as hexadecimal text. So compute it over the raw body, not over JSON you have already parsed and rebuilt.
- Take
tandv1from the header. - Compute the HMAC-SHA256 of
<t>.<body>with your secret. - Compare it with
v1in constant time. - Reject messages where
tis more than five minutes off, to stop a captured message from being replayed.
# Recompute the signature of a stored request body (body.json)
# with the timestamp from the Ledenboek-Signature header
printf '%s.%s' "$T" "$(cat body.json)" \
| openssl dgst -sha256 -hmac "$WEBHOOK_SECRET"import crypto from "node:crypto";
// rawBody must be the unparsed request body (a Buffer or string)
function verify(rawBody, header, secret, tolerance = 300) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > tolerance) return false;
const expected = crypto
.createHmac("sha256", secret)
.update(`${parts.t}.${rawBody}`)
.digest("hex");
const a = Buffer.from(expected);
const b = Buffer.from(parts.v1 ?? "");
return a.length === b.length && crypto.timingSafeEqual(a, b);
}<?php
$rawBody = file_get_contents("php://input");
$header = $_SERVER["HTTP_LEDENBOEK_SIGNATURE"] ?? "";
parse_str(str_replace(",", "&", $header), $parts);
$expected = hash_hmac("sha256", $parts["t"] . "." . $rawBody, getenv("WEBHOOK_SECRET"));
$valid = abs(time() - (int) $parts["t"]) <= 300
&& hash_equals($expected, $parts["v1"] ?? "");
if (!$valid) {
http_response_code(400);
exit;
}
$event = json_decode($rawBody, true);
http_response_code(204);import hashlib
import hmac
import time
def verify(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
if abs(time.time() - int(parts["t"])) > tolerance:
return False
signed = parts["t"].encode() + b"." + raw_body
expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts.get("v1", ""))Responses and retries
Respond within 10 seconds with a 2xx. Anything else (another status, a timeout, a connection error, a redirect too) counts as failed. Ledenboek then tries four more times: after 1 minute, 5 minutes, 30 minutes and 2 hours. A message can therefore arrive more than once and not always in order; use Ledenboek-Delivery and updated_at to deal with that. The endpoint's log in the app shows the latest deliveries with their status code and is kept for 30 days.
What the address must meet
https only. Addresses that point to localhost or to an internal or private network (such as 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16 and ::1) are refused, even if the name only resolves there at delivery time. Redirects are not followed.
Sample associations
A sample association sends no webhooks, just as it sends no email and no payment requests.