Webhooks Verification
Verify the authenticity of Ordergroove webhook requests using HMAC-SHA256 payload signing
Payload Verification
Requests will be signed using the HMAC-SHA256 algorithm with a symmetric key we store and share with you at the time of configuration.
A webhook event will be delivered with the request header OrderGroove-Signature, which will contain:
- a timestamp of transmission
- a hex-encoded representation of a signature generated with HMAC-SHA256
It is strongly encouraged to verify the authenticity of events. A Python example below shows how one might go about using the values provided in the header to verify the signature.
As shown above by the sig_input variable, the signature is driven by:
- the timestamp provided in the request header
- a period (
.) - the payload of the webhook event
Let’s look at a more robust example.
Verification client/server example
Let’s say you set up a webhook target URL in Ordergroove and we generate a verification key of super-secret-webhooks-verification-key.
Below you’ll find a toy HTTP server written in Python 3. This represents your webhook target.
If you save this to a file called server.py you can run this toy webserver with the command:
Now, here’s a pre-made cURL request representing what Ordergroove would deliver to your target when an event is triggered.
If you run this cURL command against the toy webserver, you will see SUCCESS as the response.
The signature in the header above was generated using the:
tsvalue in the header- the POST body
- the key
super-secret-webhooks-verification-key
If you’d like to generate some of these values on your own, here’s the source that should help you get on your way:
Key Rotation
If the rotation of a signing key occurred, there will be two sig fields present, providing one signature for each key.