Cal.com webhooks: verify inbound deliveries and manage subscriptions.
Cal.com signs each delivery with X-Cal-Signature-256: the hex
HMAC-SHA256 of the raw request body, keyed with the webhook's
secret. A webhook created without a secret sends the literal
no-secret-provided, which never verifies here. Cal.com signs no
timestamp, so there is no replay window to enforce; deduplicate on
the payload's triggerEvent and booking uid if retries matter.
Webhooks live at two levels: user-level (/webhooks, every event
type the user owns) and per event type
(/event-types/{id}/webhooks). Both take subscriberUrl,
triggers (e.g. BOOKING_CREATED, BOOKING_CANCELLED,
BOOKING_RESCHEDULED, BOOKING_REQUESTED, BOOKING_REJECTED,
BOOKING_NO_SHOW_UPDATED, MEETING_ENDED), active, secret and
payloadTemplate.
Context Vars
cal-com.api.keycal-com.webhook.secret
Functions
build-webhook-body
fn (subscriber-url: Str, triggers: Vec, options: Map): Map
Build a create body: subscriberUrl, triggers, active (default
true), plus options (secret, payloadTemplate, version). Unset
options are omitted. Exposed for testing.
Example
body ::cal-com::webhooks/build-webhook-body("https://example.com/cal/webhook", ["BOOKING_CREATED"], {payloadTemplate: null})
body.active // true
body.triggers // ["BOOKING_CREATED"]
create-event-type-webhook
fn (event-type-id: Any, subscriber-url: Str, triggers: Vec): Any
fn (event-type-id: Any, subscriber-url: Str, triggers: Vec, options: Map): Any
fn (event-type-id: Any, subscriber-url: Str, triggers: Vec, options: Map, opts: Map): Any
POST /event-types/{id}/webhooks - Subscribe a URL to one event type's
events. Same options as create-webhook.
Example
hook ::cal-com::webhooks/create-event-type-webhook(123, "https://example.com/cal/webhook", ["BOOKING_CREATED"], {secret: ::hot::ctx/get("cal-com.webhook.secret")})
hook.id
create-webhook
fn (subscriber-url: Str, triggers: Vec): Any
fn (subscriber-url: Str, triggers: Vec, options: Map): Any
fn (subscriber-url: Str, triggers: Vec, options: Map, opts: Map): Any
POST /webhooks - Subscribe a URL to the user's booking events. Pass
a secret so deliveries can be verified with verify-request.
Example
hook ::cal-com::webhooks/create-webhook(
"https://example.com/cal/webhook",
["BOOKING_CREATED", "BOOKING_CANCELLED", "BOOKING_RESCHEDULED"],
{secret: ::hot::ctx/get("cal-com.webhook.secret")}
)
delete-event-type-webhook
fn (event-type-id: Any, webhook-id: Str): Any
fn (event-type-id: Any, webhook-id: Str, opts: Map): Any
DELETE /event-types/{id}/webhooks/{webhookId} - Delete one event-type webhook.
Example
::cal-com::webhooks/delete-event-type-webhook(123, "wh_abc123")
delete-webhook
fn (webhook-id: Str): Any
fn (webhook-id: Str, opts: Map): Any
DELETE /webhooks/{id} - Delete a user-level webhook.
Example
::cal-com::webhooks/delete-webhook("wh_abc123")
get-event-type-webhook
fn (event-type-id: Any, webhook-id: Str): Any
fn (event-type-id: Any, webhook-id: Str, opts: Map): Any
GET /event-types/{id}/webhooks/{webhookId} - One event-type webhook.
Example
hook ::cal-com::webhooks/get-event-type-webhook(123, "wh_abc123")
hook.active
get-webhook
fn (webhook-id: Str): Any
fn (webhook-id: Str, opts: Map): Any
GET /webhooks/{id} - One user-level webhook.
Example
hook ::cal-com::webhooks/get-webhook("wh_abc123")
hook.triggers
list-event-type-webhooks
fn (event-type-id: Any): Any
fn (event-type-id: Any, options: Map): Any
fn (event-type-id: Any, options: Map, opts: Map): Any
GET /event-types/{id}/webhooks - Webhooks scoped to one event type
(Vec). options: take, skip.
Example
hooks ::cal-com::webhooks/list-event-type-webhooks(123, {take: 50})
map(hooks, %.subscriberUrl)
list-webhooks
fn (): Any
fn (options: Map): Any
fn (options: Map, opts: Map): Any
GET /webhooks - The user's webhooks (Vec). options: take (default
250) and skip.
Example
hooks ::cal-com::webhooks/list-webhooks({take: 50})
map(hooks, %.subscriberUrl)
mark-webhook-secret
fn (fields: Map): Map
Mask a secret set in webhook fields in call records. Returns fields
unchanged. Exposed for testing.
Example
fields ::cal-com::webhooks/mark-webhook-secret({active: true, secret: ::hot::ctx/get("cal-com.webhook.secret")})
fields.active
update-event-type-webhook
fn (event-type-id: Any, webhook-id: Str, changes: Map): Any
fn (event-type-id: Any, webhook-id: Str, changes: Map, opts: Map): Any
PATCH /event-types/{id}/webhooks/{webhookId} - Update an event-type webhook. Unset fields are omitted.
Example
::cal-com::webhooks/update-event-type-webhook(123, "wh_abc123", {triggers: ["BOOKING_CREATED", "MEETING_ENDED"]})
update-webhook
fn (webhook-id: Str, changes: Map): Any
fn (webhook-id: Str, changes: Map, opts: Map): Any
PATCH /webhooks/{id} - Update subscriberUrl, triggers, active,
secret or payloadTemplate. Unset fields are omitted.
Example
::cal-com::webhooks/update-webhook("wh_abc123", {active: false})
verify-request
fn (request: Map): Bool
fn (request: Map, secret: Str): Bool
Verify a Cal.com webhook request: the x-cal-signature-256 header
must be the hex HMAC-SHA256 of the raw body under the webhook
secret, compared in constant time. Uses the cal-com.webhook.secret
context variable by default (failing when it is unset), or accepts
an explicit secret. An empty explicit secret never verifies.
Example
cal-webhook
meta {webhook: {service: "cal-com", path: "/cal/webhook"}}
fn (request) {
if(not(::cal-com::webhooks/verify-request(request)),
::hot::http/HttpResponse({status: 401, body: "invalid signature"}),
::hot::http/HttpResponse({status: 200, body: "ok"}))
}
cal-com.webhook.secret