What is a Webhook? How does a Webhook work?
- Getting Started
- Bot Building
- Smart Agent Chat
- Conversation Design
-
Developer Guides
Code Step Integration Static Step Integration Shopify Integration SETU Integration Exotel Integration CIBIL integration Freshdesk KMS Integration PayU Integration Zendesk Guide Integration Twilio Integration Razorpay Integration LeadSquared Integration USU(Unymira) Integration Helo(VivaConnect) Integration Salesforce KMS Integration Stripe Integration PayPal Integration CleverTap Integration Fynd Integration HubSpot Integration Magento Integration WooCommerce Integration Microsoft Dynamics 365 Integration
- Deployment
- External Agent Tool Setup
- Analytics & Reporting
- Notifications
- Commerce Plus
- Troubleshooting Guides
- Release Notes
Table of Contents
Webhook
A Webhook is an API concept that is growing in popularity. Whatever we do on the web, can be described as an Event. A Webhook (also called a web callback or HTTP push API) is a way for an app to provide other applications with real-time information. A Webhook delivers data to other applications as it happens, meaning you get the data immediately. Unlike typical APIs where you would need to check for the data very frequently in order to get it real-time. This makes webhooks much more efficient.
Working of Webhook
Let us understand the working of a Webhook, with the help of this flow shown below.
Here, as we can see, there is a online pet store, that has information about all the animals that are available in the store as pets.
Following are the series of events that happen -
- A buyer comes to the online pet store and he wants to buy a dog. He goes through the catalog, selects a dog, and proceeds to pay.
- A request is been sent to the payment gateway that is integrated with the online pet store. This payment gateway handles all the payment-related technicalities.
- Payment gateway sends all the details to the buyer, related to payment.
- The buyer makes the payment and the same is notified to the payment gateway.
- The owner contacts the buyer after receiving the notification of successful payment being made by the buyer.
In this scenario, every event that has occurred in this transaction was sent as a notification to the owner, and the owner responded only when he received the final notification which was "Payment done successfully by the buyer".
This is how Webhook works, by sending real-time information of the events as they occur.
In general, Haptik uses the following Webhook events:
- A new event when an agent completes a chat (ex: webhook_agent_chat_complete)
- Sending a new event with 8 min of inactivity (ex: webhook_conversation_complete_partial)
Payload of these two events is as follows:
{
"version":
"timestamp":
"business_id":
"business_name":
"event_name": "webhook_agent_chat_close/webhook_conversation_complete_partial",
"user": {
"auth_id":
"device_platform":
"device_platform_name":
"user_name":
"user_id":
"phone_model":
"os_version":
"package_name":
},
"agent": {
"name":
"username":
"profile_image":
"id":
"email":
"is_automated":
},
"data": {
"collection_id":
"conversation_no":
"conversation_identifier":
"chat_link":
"complete_chat_link":
"closing_categories": (Only if this exists)
}
}
Kindly reach your Haptik SPOC if you have any queries regarding webhook events of Haptik.