Webhooks
Introduction
A webhook is a callback function based on the HTTP protocol.
It allows a remote API to establish event-oriented communication with the HUB2 API.
In simple words, events can be subscribed on the HUB2 API and whenever such event occurs, the remote API will be called using the HTTP protocol.
To subscribe a webhook, the list of events to listen to must be provided alongside an URL which will be called.
Doing so remove the necessity to perform polling on the HUB2 API to know the current status of a transaction. Instead the HUB2 API will automatically reach the provided URL with all useful data in the request body to let the remote API know an update occurred.
The advantages of webhooks
- They replace continuous interrogation. It’s no longer needed to call HUB2 API at regular intervals (polling), saving valuable resources for both sides.
- Webhooks are quick to configure.
- Instant notification whenever an event of interest occurs, preventing possible delays from the polling method.