Firecrawl webhook verification. Crawl, batch-scrape, and extract
jobs started with a webhook option POST events (crawl.started,
crawl.page, crawl.completed, batch_scrape.*, extract.*, ...)
signed with HMAC-SHA256 over the raw body, sent as
X-Firecrawl-Signature: sha256=<hex>. The secret is in the
Firecrawl dashboard's account settings (Advanced tab). See
https://docs.firecrawl.dev/webhooks/security.
Values
SIGNATURE_HEADER
SIGNATURE_HEADER: Str "x-firecrawl-signature"
SIGNATURE_PREFIX
SIGNATURE_PREFIX: Str "sha256="
Functions
signature-hex
fn (header: Any): Str
The hex digest from an X-Firecrawl-Signature value (sha256=<hex>),
or "" when the header is missing or lacks the sha256= prefix.
Exposed for testing.
Example
::firecrawl::webhooks/signature-hex("sha256=ab12") // "ab12"
::firecrawl::webhooks/signature-hex("ab12") // ""
verify-request
fn (request: Map): Bool
fn (request: Map, secret: Str?): Bool
Verify a Firecrawl webhook request: HMAC-SHA256 of the raw body with
your webhook secret must match X-Firecrawl-Signature, compared in
constant time. Uses the firecrawl.webhook.secret context variable
(failing when it is unset), or an explicit secret, which is masked in
call records; an empty explicit secret never verifies.
Firecrawl signs no timestamp, so there is no replay window to
check: deduplicate on the payload's webhookId if a replayed
delivery would matter.
Example
firecrawl-webhook
meta {webhook: {service: "firecrawl", path: "/firecrawl/webhook"}}
fn (request) {
if(not(::firecrawl::webhooks/verify-request(request)),
::hot::http/HttpResponse({status: 401, body: "invalid signature"}),
::hot::http/HttpResponse({status: 200, body: {received: request.body.type}}))
}
firecrawl.webhook.secret