Skip to main content

Webhooks

Add endpoints with the API

(async () => {
const endpoint = await karrio.webhooks.create({
url: "https://example.com/my/webhook/endpoint",
enabled_events: ["all"],
test_mode: true,
});
})();

Returns the webhook endpoint object with the secret field populated.

{
"id": "weh_e355adb839a141c0b79865ee621f968f",
"url": "https://example.com/my/webhook/endpoint",
"description": "",
"enabled_events": ["all"],
"test_mode": true,
"disabled": false,
"object_type": "webhook",
"last_event_at": null,
"secret": "whsec_e2fed355115b4b9eb4b0ab8bf0d4d7ee"
}
webhook signature:

The signature is a string that is used to verify that the webhook request came from the correct service.

The secret field is the add to the request header X-Event-Id: <secret> to serve as a signature.