CRPRO Hub webhook signature: what it covers
The native CRPRO Hub webhook HMAC covers timestamp, delivery id and body. See the headers, the Node code and the mistake that fails every delivery.
Anyone who has integrated webhooks from other APIs tends to write verification from memory: HMAC of the body, compare, done. With CRPRO Hub that formula fails on every delivery, because the native signature covers more than the body. This article shows the four headers that accompany each delivery, what goes into the computation, and how to write a verification that passes on the first try.
The four headers on every delivery
Each Hub delivery arrives with four headers: X-Hub-Delivery-Id, X-Hub-Timestamp, X-Hub-Signature-Version and X-Hub-Signature-256. The first is the delivery UUID, the same across all its attempts and new on a manual replay. The second is the send time, in seconds since the Unix epoch. The third says which signature format was used. The fourth is the HMAC-SHA256, written as sha256= followed by hex.
X-Hub-Delivery-Id: c2d3e4f5-6a7b-4c8d-9e0f-1a2b3c4d5e6f
X-Hub-Timestamp: 1766000000
X-Hub-Signature-Version: v2
X-Hub-Signature-256: sha256=<64 hex characters>The endpoint secret, which starts with whsec_, is shown only once, at creation. It does not appear again in the listing or in the dashboard. If lost, the only way out is to rotate it, and the previous secret stops working immediately. Store it in an environment variable or vault before closing the terminal where you created it.
What the native signature covers
In the native format, identified by X-Hub-Signature-Version equal to v2, the HMAC covers the string timestamp, dot, delivery id, dot, body. That is three ingredients together, using the exact values of that delivery's headers and the exact bytes of the body. Anyone who computes only the HMAC of the body sees verification fail on 100% of deliveries, not some.
Tying the signature to the timestamp and the delivery id has a purpose: stopping a captured body from being transplanted into another delivery, with other headers, and still passing as valid. For the receiver there is a practical extra: since the timestamp is inside the signature, you can reject deliveries with a timestamp that is too old without worrying that the value was tampered with. Which tolerance window to adopt is your decision; the Hub does not impose one on the receiver.
A concrete verification example in Node
The snippet below builds the signed string, computes the HMAC with the endpoint secret and compares in constant time. It assumes you have the raw body in rawBody, with no JSON parsing before it.
import { createHmac, timingSafeEqual } from 'node:crypto'
const timestamp = request.headers['x-hub-timestamp']
const deliveryId = request.headers['x-hub-delivery-id']
const signed = `${timestamp}.${deliveryId}.${rawBody}`
const expected = createHmac('sha256', process.env.WEBHOOK_SECRET).update(signed).digest('hex')
const received = request.headers['x-hub-signature-256']?.replace('sha256=', '')
const valid = !!received &&
/^[0-9a-f]{64}$/.test(received) &&
timingSafeEqual(Buffer.from(received, 'hex'), Buffer.from(expected, 'hex'))Two details are not style. The comparison uses timingSafeEqual and never ===, because ordinary string comparison leaks time per byte position. And the 64-character hex regular expression comes before Buffer.from, because a signature with non-hex content makes a short buffer and timingSafeEqual would throw RangeError instead of returning false. Without that guard, a malformed header crashes the handler.
The Hub side has tests that execute these same snippets against the function that generates the signature, so the documentation and the algorithm cannot diverge without breaking the suite. If you copy the code from the documentation, you are copying something that is exercised, not an illustration.
The evohub compatibility format
There is a second format, meant for people migrating from EvoHub who cannot touch their handler: there the signature covers only the raw body. You recognize it by the X-Hub-Signature-Version header with the value evohub-v1. The delivery id and timestamp headers keep arriving and remain useful for deduplication, but they are outside the HMAC.
The format is a property of the endpoint, the delivery_format field, and it does not change after creation: to switch, create another endpoint. The default is native. The Hub's own guidance is to prefer native in new integrations and use evohub only while the migration lasts, because native is safer.
Since the format changes the computation, your handler should read X-Hub-Signature-Version before computing. If your system receives from endpoints of both kinds, a two-line branch solves it; if from only one, a fixed verification with a header check already protects against misconfiguration.
The most common integration mistakes
The mistakes boil down to four, and all produce the same symptom: invalid signature on every delivery. The first is signing only the body. The second is parsing the JSON before reading the raw body. The third is using an old secret after a rotation. The fourth is building the string with values different from the headers, for example reading a header with capital letters in a framework that delivers keys in lowercase.
- Body only in the HMAC: include timestamp and delivery id, in the order timestamp, id, body.
- Re-serialized body: read the raw bytes before any parser.
- Old secret: after rotating, the previous one dies immediately; update the environment.
- Wrong header casing: in many frameworks keys arrive in lowercase.
- Wrong format: check X-Hub-Signature-Version before computing.
When verification fails, return an error status and do not process the event. Remember the Hub counts only a 2xx response as a completed delivery; any other response goes back to the retry queue, so a bug in your verification produces a stream of resends. Once verification is fixed, queued deliveries resume and dead ones can be replayed, as the Hub documentation describes.
Where to see the full contract
The reference for headers, both formats and the receiving rules is the CRPRO Hub webhooks page. For calls you make to the Hub, authentication covers the API keys. For a new endpoint, the short path is to create it, store the secret, send the test event and check the status your receiver returned in the deliveries list: a 401 there usually means a wrongly computed signature.
Frequently asked questions
Is the Hub's signature the same as Meta's?
No. Meta's is an HMAC of the payload with the app secret. The Hub's uses the endpoint secret and, in the native format, covers timestamp, delivery id and body.
Why does my verification fail on every delivery?
The most common mistake is computing the HMAC over the body only. In the native format (v2) the signed string is timestamp.delivery_id.body.
Can I change the format of an existing endpoint?
No. delivery_format does not change after creation. To switch, create another endpoint with the format you want.
I lost the whsec_ secret. Now what?
It is not shown again. Rotate the secret, which invalidates the previous one immediately, and store the new value.
Fontes
Documentação oficial da Meta, conferida em 31 de outubro de 2026.