Docs
Webhooks
Outbound: events sent to you
Add an endpoint in Settings → Webhooks (or POST /v1/webhooks) and choose the events it receives, or * for all. The signing secret (whsec_…) is shown once. Endpoints must use https and a public address.
Events: run.finished, approval.needed, connection.created, connection.failed.
Each delivery is a POST with a JSON body, signed per Standard Webhooks:
webhook-id: the event's id (use it to drop duplicates);webhook-timestamp: seconds since 1970;webhook-signature:v1,and the base64 HMAC-SHA256 ofid.timestamp.body, keyed with the secret afterwhsec_. During the 24 hours after you rotate the secret, both secrets sign, separated by a space.
import { createHmac, timingSafeEqual } from "node:crypto";
// body: the raw request body, as a string, before any JSON parsing.
function verify(secret, headers, body) {
const id = headers["webhook-id"], ts = headers["webhook-timestamp"], sigs = headers["webhook-signature"];
if (!id || !ts || !sigs) return false;
const t = Number(ts);
if (!Number.isFinite(t) || Math.abs(Date.now() / 1000 - t) > 300) return false; // more than five minutes off
const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
const want = createHmac("sha256", key).update(`${id}.${ts}.${body}`).digest();
return sigs.split(" ").some((sig) => {
const got = Buffer.from(sig.replace(/^v1,/, ""), "base64");
return got.length === want.length && timingSafeEqual(got, want);
});
}Answer with any 2xx within 15 seconds. A failed delivery is tried again after 5 seconds, 5 minutes, 30 minutes, 2 hours, 5 hours, 10 hours, 10 hours (7 more attempts), then marked failed. Deliveries are kept for 30 days (GET /v1/webhooks/{id}/deliveries) and can be sent again (POST /v1/webhook-deliveries/{id}/resend). Pause an endpoint with enabled: false.