Skip to main content

Webhooks

What is Webhooks

A webhook (also called a web callback or HTTP push API) is a way for an app to provide other applications with real-time information. A webhook delivers data to other applications as it happens, meaning you get data immediately.

Setup Webhooks via API

Read more about how to setup webhooks subscription here: Webhooks Subscriptions

Setup Webhooks via Backoffice

You can setup Webhooks via Dintero Backoffice under Settings --> Webhooks.

Verify event signature

You can verify that the request received originated from Dintero by creating the subscription with HMAC-SHA1 secret set.

The request sent to your subscription url will then include a event-signature header that you can verify using the secret used when the subscription was created

Example code

const verifyEventSignature = (req, secret) => {
const eventSignature = req.headers["event-signature"];
const calculatedEventSignature = crypto
.createHmac("sha1", Buffer.from(secret))
.update(JSON.stringify(req.body))
.digest("hex");
assert.ok(eventSignature === calculatedEventSignature);
};