Webhooks
Webhooks
Webhooks are a powerful tool that allows you to automate processes and boost your productivity. When you make a request, the results are sent back to the URLs you provide. Compliancely expects a 2xx response code upon receiving the data at your endpoint.
Unlike API resources that represent static data which can be created, updated, and retrieved as needed, webhooks represent dynamic resources. Webhooks are particularly valuable for events that are not directly triggered by an API request, such as updates to business details.
Utilizing webhooks
Webhooks are invaluable for staying up-to-date with the progress of a business. While some requests yield synchronous results and may not require webhooks, there are processes that necessitate asynchronous responses. Webhooks allow your integration to receive timely notifications about changes to the status of a business as soon as they occur.
Verifying webhook signatures
Compliancely offers the option to sign the webhook events sent to your endpoints. Each event includes a signature in the Compliancely-Signature header, enabling you to verify that the events originate from Compliancely and not from a third party.
To verify signatures, you will need to set a secret in your application. You can find or set the token here. The signatures are generated using a hash-based message authentication code (HMAC) with SHA-256. Follow the steps below:
Step 1: Extract the signature from the header. Retrieve the value from the Compliancely-Signature header.
Step 2: Prepare the expected signature. Calculate an HMAC using the SHA-256 hash function. Utilize the provided secret as the key and the response body as the message.
Step 3: Compare the signatures. Compare the signature from the header with the expected signature.
Webhook Retries
Compliancely expects a 2xx HTTP response code in return. If there is an HTTP response code other than 2xx, Compliancely retries for another 2 attempts. One can monitor the webhook logs in here. The retry attempts will be in an exponential pattern. 2nd attempt will be in 3 minutes. 3rd attempt will be in 6 minutes.
Updated about 1 year ago