Verifying webhook message signatures
This guide will teach you how to verify the webhook message signatures sent in the header of webhook message requests. This enables you to verify that the message originated from dynamic and the message payload has not been tampered with since only Dynamic and you have access to the secret used to sign messages.
Below is a simple typescript function that takes in the webhook secret, signature, and payload; and returns a boolean value indicating if the signature is valid or not.
The following is a practical example of how to use the verifySignature function to verify a webhook message signature for a given payload.
The structure of the payload object matters; if the payload object is not structured in the manner in which the message was sent the signature verification will fail.
Was this page helpful?