WebHooks
Webhooks send real-time data from one application to another whenever a specified event occurs.
The “event” is a process which runs inside App A. This can be a login, a purchase, a timed event, anything really.
App A holds a list of URLs called “webhook URLs” which point to other applications which have requested to be notified when the event happens. Other applications “register” their webhook URLs with App A by any mechanism.
When the event occurs in App A, the app sends a POST request to each webhook URL registered for the event. The request from App A contains the data or “payload” usually in the form of JSON or XML.
Best Practices
Identify the hook
The POST request from App A should contain a timestamp
and webhook_id
given by the client when they registered their “webhook URL”.
Allow clients to define multiple URLs
Give clients the chance to register multiple URLs with the app. Each URL should be able to define which of the available App A events that URL should be sent. This allows for more flexibility for clients ingesting the data.