Webhooks is a mechanism which enables applications to communicate with each other programmatically. It allows you to send real-time data from one application to another whenever a given event occurs.Whenever a specific event occurs, configured app sees the event, collects the data, and immediately sends a notification (user-defined HTTP callbacks) to the webhook URL specified.There are 2 main objects you can receive via webhooks:1. Received: Used to notify you when you get a new message and what is in that message.2. Status: Used to notify you when there's a status change in a message that you sent.Only use asynchronous handling of webhooksDo not process incoming messages and notifications in the webhook handler. Acknowledge immediately after receiving the webhook (with status 200), then you can process the data.
Recommendations#
For stable functioning of webhook it is recommended to make the webhook perform as fast as possible. That means:Respond with status 200 immediately after receiving a notification (the callbacks payload should NOT be processed before responding, but ack first then process).
Sending one message as opposed to getting one causes up to three callback notifications (sent, delivered and read). It means that the speed of processing concurrent requests should increase in accordance with the load of the number. In addition to a direct increase in the speed of processing notifications, we recommend making your webhook process as many parallel requests as possible. Otherwise, this can lead to the occurrence and overflow of the message queue.
The maximum tolerable time for webhook response is 2 seconds.
Here we mention different types of webhook responses:#
Agent receives a message from a suggestionAgent receives a locationMessage delivered to user