Receiving Messages via Webhook
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, the Qikchat 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:
message
: Used to notify you when you get a new message and what is in the new message.statuses
: Used to notify you when there's a status change in a message you sent.
Only use asynchronous handling of webhooks
Do 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 tothree
callback notifications (sent
,delivered
andread
). 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.
Webhook URL
The webhook URL is a resource address to which the Qikchat Server sends notifications, which are triggered by specific events. The maximum tolerable time for webhook response is 2 seconds.
Set Webhook URL
You can update it or remove it at any time in settings.
Example setting webhook with Basic Auth
If the webhook URL needs to be authorized by user, USER
and PASS
should be provided in the header Authorization
that contains Basic base64(USER:PASS)
.
Request body example for USER=testuser
and PASS=testpass
Receiving notifications for incoming messages
When a customer sends you a message, the Qikchat server will send an HTTP POST request notification to the webhook URL with the details that are described below:
Received Incoming Text Message
Received Incoming Media Message
Receiving notifications for statuses
Last updated
Was this helpful?