What is signed
Three headers go with every call.
The signature is an HMAC-SHA256, in base64, of the text
<webhook-id>.<webhook-timestamp>.<raw body>. To check a call:
- Take your secret (it starts with
whsec_), drop that prefix and decode the rest from base64. Those bytes are the key. - Join the
webhook-id, a dot, thewebhook-timestamp, a dot and the raw body. - Sign it with HMAC-SHA256 under the key, encode the result in base64 and put
v1,in front. - Compare it, in constant time, with each signature in the header. One match is enough.
- Refuse a call whose
webhook-timestampis more than five minutes away from your clock.
Check a call
Each example takes the raw body, the three headers and your secret, and throws (Go returns an error) when the call does not come from Widgetic. The last argument is the current time: leave it out, and the example reads the clock. A test passes the time of its sample call.Get the raw body
Every framework has a way to hand you the body before it parses it.Use it in a receiver
This Express receiver keeps the body as it arrived, checks it, drops an event it has already handled and answers quickly. The same steps fit any framework.Use a library
Standard Webhooks publishes a library for C#, Elixir, Go, Java, JavaScript, PHP, Python, Ruby and Rust. It reads the secret as Widgetic gives it, with thewhsec_ prefix, and checks the five minutes for you. In JavaScript:
Rotate a secret
A secret can change while calls are on their way. For a while, Widgetic signs each call with the old secret and the new one, and lists both signatures inwebhook-signature, separated by a space. The examples above accept a call when either one matches, so you can switch your receiver to the new secret before the old one stops signing.
- For partner webhooks, rotate the secret with
POST /partners/{partnerId}/notifications/webhook-secret. The old one keeps signing for . - For MCP events, send
events/subscribeagain with a newsecret. The old one keeps signing for .
Check your code against a known call
Use this call to try your code before the first real event. It is made up: the secret signs nothing else.
The body is this text, in one line and without a line break at the end:
1794303005 as the current time. It must accept the call. Change one character of the body, or of the secret, and it must refuse it. The clock is a separate check: with a current time more than 300 seconds away from 1794303005, it must refuse a call whose signature is right.
When the signature does not match
- You signed a copy of the body. Parsing the JSON and writing it out again changes the bytes. Use the raw body.
- Something changed the body on its way. A proxy or a middleware that reads the body first, or one that changes its encoding, breaks the signature. Look at the bytes your application receives.
- It is the secret of another source. A partner webhook and every MCP subscription have a secret of their own. A partner secret is shown once, when you set the address or rotate it; an MCP secret is the one you gave to
events/subscribe. - You used the secret as text. The key is the base64-decoded part after
whsec_, as bytes. - Your clock is off. A call whose
webhook-timestampis more than five minutes away from your clock is refused, even with a right signature. Keep the clock of your servers in step with a time service. - Your framework lower-cases or merges header names. Header names are not case-sensitive, so look them up in a way that is not either.
Partner webhooks
Set an address, choose events, answer and retries
MCP events
Be called when a visitor sends an entry