Zendesk webhook verification. Zendesk sends X-Zendesk-Webhook-Signature, the base64 HMAC-SHA256 of the X-Zendesk-Webhook-Signature-Timestamp value followed by the raw body, keyed with the webhook's signing secret (Admin Center → Webhooks → the webhook → Reveal secret, or GET /webhooks/{id}/signing_secret). Because the timestamp is signed, verify-request also rejects deliveries older than a replay window. See https://developer.zendesk.com/documentation/webhooks/verifying/.

Context Vars

Optional
  • zendesk.webhook.secret

Values

DEFAULT_MAX_AGE_SECONDS

DEFAULT_MAX_AGE_SECONDS: Int 300

TEST_SIGNING_SECRET

TEST_SIGNING_SECRET: Str "dGhpc19zZWNyZXRfaXNfZm9yX3Rlc3Rpbmdfb25seQ=="

Functions

parse-timestamp

fn (value: Str): Int?

Parse a X-Zendesk-Webhook-Signature-Timestamp value to Unix seconds. Zendesk sends ISO 8601 UTC (2026-07-10T15:00:00Z, optionally with fractional seconds); Unix seconds are accepted too. Returns null for anything else. Exposed for testing.

Example

::zendesk::webhooks/parse-timestamp("2026-07-10T15:00:00Z")  // 1783695600
::zendesk::webhooks/parse-timestamp("yesterday")  // null

verify-request

fn (request: Map): Bool
fn (request: Map, secret: Str): Bool
fn (request: Map, secret: Str, max-age-seconds: Int): Bool

Verify a Zendesk webhook request: the x-zendesk-webhook-signature header must be the base64 HMAC-SHA256 of timestamp + raw body, compared in constant time, and the signed timestamp must be within max-age-seconds of now (default 300). Pass a max-age-seconds of 0 or less to skip the replay check. Uses the zendesk.webhook.secret context variable by default (failing when it is unset), or accepts an explicit secret. An empty explicit secret never verifies.

Example

zendesk-webhook
meta {webhook: {service: "zendesk", path: "/zendesk/webhook"}}
fn (request) {
  if(not(::zendesk::webhooks/verify-request(request)),
    ::hot::http/HttpResponse({status: 401, body: "invalid signature"}),
    {received: true, ticket: request.body})
}
Context Vars: zendesk.webhook.secret