Webhooks allow you to receive real-time notifications about events happening in your connected accounting systems. This enables you to automate workflows and keep your data in sync without the need for constant polling.

Setting up a webhook

To set up a webhook, you need to create a webhook subscription by sending a POST request to the /webhooks endpoint with the parameters that are included in the system’s page.
Example code snippet
    const response = await axios.post(url, {
        "callbackUrl": callbackUrl,
        "eventType": eventType,
        "resource": resource
    }, {
        headers: {
            'X-API-KEY': apiKey,
            'X-ACCOUNT-KEY': accountKey
        }
    });

Getting events

Once a webhook is set up, you will start receiving events at the specified callback URL. Each event will contain information about the resource that triggered the event, including its type and ID.

Handling events

When your server receives a webhook event, it should process the event according to your application’s logic. This may involve updating records in your database, triggering other workflows, or sending notifications.

Deleting a webhook

If you no longer need a webhook, you can delete it by sending a DELETE request to the /webhooks/{webhookId} endpoint.