Webhooks
LMS posts signed events to your HTTPS endpoint as they happen, with retries and replay.
Set up an endpoint
In Settings → Integrations → Webhooks, add an endpoint: an HTTPS URL, the event types to receive and, optionally, the processes or campaigns to limit it to. Copy the signing secret (whsec_…); it is shown once. Use Send test event to try your endpoint; test events carry "test": true.
Each request is a POST with a JSON event in the body: the event catalogue lists every type and its fields. URLs must use HTTPS on a public address; private and internal addresses are refused, and redirects are not followed.
Verify the signature
Webhooks are signed with Standard Webhooks: an HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{body}, keyed with the base64-decoded part of your secret after whsec_. Any Standard Webhooks library works; the code below has no dependencies. Always verify the raw body: parsing and re-serialising JSON changes the bytes.
| Header | Meaning | Opens |
|---|---|---|
webhook-id | The event ID. Identical across retries and replays: de-duplicate on it. | |
webhook-timestamp | Unix seconds when this attempt was signed. Reject anything older than 5 minutes. | |
webhook-signature | Space-separated v1,<signature> values. Two are sent while a secret is rotated. |
webhook-idThe event ID. Identical across retries and replays: de-duplicate on it.webhook-timestampUnix seconds when this attempt was signed. Reject anything older than 5 minutes.webhook-signatureSpace-separatedv1,<signature>values. Two are sent while a secret is rotated.
import { createHmac, timingSafeEqual } from "node:crypto";const TOLERANCE_SECONDS = 5 * 60;/** * Verifies an LMS webhook and returns the parsed event. `body` must * be the raw request body exactly as received (a string or Buffer). */export function verifyWebhook(secret, headers, body, now) { now ??= Date.now() / 1000; const id = headers["webhook-id"]; const timestamp = headers["webhook-timestamp"]; const signatures = headers["webhook-signature"]; if (!id || !timestamp || !signatures) throw new Error("Missing webhook headers"); if (Math.abs(now - Number(timestamp)) > TOLERANCE_SECONDS) throw new Error("Webhook timestamp is too old or in the future"); const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64"); const expected = createHmac("sha256", key) .update(`${id}.${timestamp}.${body}`) .digest(); // Two signatures arrive while a secret rotates; one match is enough. const valid = signatures.split(" ").some((entry) => { const [version, signature] = entry.split(","); if (version !== "v1" || !signature) return false; const received = Buffer.from(signature, "base64"); return ( received.length === expected.length && timingSafeEqual(received, expected) ); }); if (!valid) throw new Error("Invalid webhook signature"); return JSON.parse(body);}Use the verifier in your handler
Both handlers read the signing secret from the LMS_WEBHOOK_SECRET environment variable and import the verifier above from a file beside them. The Node.js one needs Express 4.17 or later (for express.raw); the Python one needs Flask 2 or later.
import express from "express";import { verifyWebhook } from "./verify-webhook.js";const app = express();const secret = process.env.LMS_WEBHOOK_SECRET;// Keep the raw body: re-serialised JSON would not match the signature.const raw = express.raw({ type: "application/json" });app.post("/webhooks/lms", raw, async (req, res) => { let event; try { const body = req.body.toString("utf8"); event = verifyWebhook(secret, req.headers, body); } catch { return res.status(400).send("Invalid signature"); } try { // Your code: store the event durably (a queue or table keyed on // event.id, so a redelivery is a no-op), then process it later. await enqueueOnce(event.id, event); } catch { // Not stored: answer 5xx so LMS retries. Never acknowledge an // event you did not keep. return res.sendStatus(503); } res.sendStatus(204); // only after the event is safely stored});Send a local signed fixture
Send test event in LMS posts a real, signed event (with "test": true) from LMS to your public URL. Before your endpoint is reachable, sign an event yourself and post it to a local server instead. You need bash, openssl and base64, the endpoint's secret in SECRET, and an event body in event.json, for example from the Event catalogue.
# Needs bash, openssl and base64. event.json holds any event, for# example the lead.created sample from the Event catalogue.SECRET="whsec_..." # the endpoint's signing secretID="msg_$(date +%s)"TS="$(date +%s)"BODY="$(cat event.json)"KEY_HEX="$(printf '%s' "${SECRET#whsec_}" | base64 -d \ | od -An -tx1 | tr -d ' \n')"SIGNATURE="$(printf '%s' "$ID.$TS.$BODY" \ | openssl dgst -sha256 -mac HMAC -macopt "hexkey:$KEY_HEX" \ -binary | base64)"curl -X POST "https://your-app.example/webhooks/lms" \ -H "Content-Type: application/json" \ -H "webhook-id: $ID" \ -H "webhook-timestamp: $TS" \ -H "webhook-signature: v1,$SIGNATURE" \ -d "$BODY"Respond quickly
Store the event durably (a queue or a table keyed on webhook-id), return any 2xx within 15 seconds, then process it in the background. If you cannot store it, return a 5xx so LMS tries again: never acknowledge an event you did not keep.
Events can arrive more than once and out of order: de-duplicate on webhook-id, and use the event timestamp or a fresh read of the resource when order matters. Contact details are left out when the endpoint is set not to receive them.
Retries and disabling
| Your response | What LMS does | Opens |
|---|---|---|
Any 2xx within 15 seconds | Delivered. LMS records the attempt and sends nothing more for this event. | |
410 Gone | LMS disables the endpoint at once and stops sending to it. | |
| Any other status, a timeout or a redirect | Failed attempt: retried up to 12 attempts over 7 to 15 hours, honouring Retry-After up to 6 hours. |
- Any
2xxwithin 15 secondsDelivered. LMS records the attempt and sends nothing more for this event. 410 GoneLMS disables the endpoint at once and stops sending to it.- Any other status, a timeout or a redirectFailed attempt: retried up to 12 attempts over 7 to 15 hours, honouring
Retry-Afterup to 6 hours.
Delay before each retry (after the previous attempt)
- Attempt 215–30 s
- Attempt 330–60 s
- Attempt 41–2 min
- Attempt 52–4 min
- Attempt 64–8 min
- Attempt 78–16 min
- Attempt 816–32 min
- Attempt 932–64 min
- Attempt 101–2 h
- Attempt 112–4 h
- Attempt 123–6 h
After the 12th attempt the delivery is marked failed. An endpoint that fails 20 times in a row with no success for 24 hours is disabled, and workspace administrators are alerted.
Replay
Once you have fixed a disabled endpoint, re-enable it in Settings → Integrations → Webhooks and use Replay for one delivery or a time range (optionally only failed ones). Replays reuse the original body and webhook-id, so your de-duplication keeps working. Every attempt is in the endpoint's delivery log for 30 days. You can also catch up from the change feed.