Skip to main content

Overview

ChurnKit signs every webhook payload with HMAC-SHA256 using your webhook secret. Always verify the signature before processing the payload. The SDK exports verifyWebhookSignature as a standalone function — no ChurnKit instance required.

Signature

Parameters

string
required
The raw, unparsed request body as a string. Do not parse it as JSON before passing it here — the signature is computed over the raw bytes.
string
required
The value of the X-ChurnKit-Signature header. Format: sha256=<hex>.
string
required
Your webhook signing secret from the FlowsBuilt Console.

Examples

Next.js App Router

Express

Hono (Cloudflare Workers)

How the signature is computed

ChurnKit computes:
And sends the hex digest as:
The SDK’s verifyWebhookSignature performs the same computation and compares with a constant-time comparison to prevent timing attacks.

Common mistakes

The signature is over the raw bytes. If you call JSON.parse() before verifying, the comparison will fail because JSON serialization can change whitespace and key order.
Express’s express.json() middleware consumes and parses the body. Use express.raw() for webhook routes instead.
If process.env.CHURNKIT_WEBHOOK_SECRET is undefined, verification always returns false. Check your environment variables and ensure the secret is set.