Webhooks
Setup webhooks through the API in order to be notified of any Vibrant events.
enabledEvents
It is possible to subscribe to one or more event types or *
to get all events.
See the full list of possible event types in the API documentation: REST API doc create webhook
url
The endpoint to which the events will be posted.
metadata
If desired it is possible to add some meta data to the webhook that can be retrieved again when getting the webhook object. The meta data will not be attached to the events.
status
Here it is possible to enable
or disable
the webhook.
Webhook event verification
Each webhook created in Vibrant holds a secret key.
This can be used to verify that the events posted to your webhook url is actually coming from Vibrant.
The secret key can be used to calculate an expected hash from a received message, to validate that the message in fact is from Vibrant and to this unique webhook.
How to verify messages:
Messages to a webhook hold a header named Vibrant-Signature
.
The signature holds a timestamp and a hash, with comma in between.
t=1652744532,v0=1327f867e7efdzecb36ahfg46cgfs4fa51cad7e57f5g59pf736d6ce8f406d3fv
Follow these three steps to verify the Vibrant signature.
Create a string combining the value of timestamp
t
then a . and then the message body.Compute a HMAC with the SHA256 hash function. Use the endpoint’s secret key as the key, and use the string from step 1. as the message.
Compare the Vibrant signature
v0
from the header to the expected signature from step 2. For an equality match, compute the difference between the current timestamp and the received timestamp, then decide if the difference is within your tolerance.
The timestamp is used to prevent replay attacks resending a valid message to your endpoint. So you can check if the timestamp is too old.
Webhook Retrial behaviour
Upon the registration of the webhook, Vibrant will initiate delivery attempts for the selected events specified during the webhook creation process. In the event of a delivery failure, Vibrant will engage in a series of retransmission attempts employing an exponential backoff strategy, initially prioritizing expedited delivery followed by subsequent attempts spread over a maximum period of 31 days.
Webhooks best practices
These are some of the practices recommended by Vibrant for a smooth webhook integration.
Acknowledgement of the webhooks
Upon receipt of a webhook from our system, it is imperative that the customer endpoint service promptly acknowledges receipt by sending a HTTP 200 OK response. This response serves as confirmation that the webhook payload has been successfully received and acknowledged by the third-party system. Failure to promptly respond with a 200 status code will result in unintended consequences, such as repeated delivery attempts.
Last updated