Advanced Features

Webhooks Setup

The step-by-step guide to setup webhooks to receive real-time chat events.

Webhook Setup

Our webhook solution allows for real-time synchronization of chat events with your server, enhancing the integration of the chatbot with your website or third-party platforms like Discord, Slack, or WhatsApp. This feature not only facilitates monitoring and usage analytics but also supports the implementation of exclusive chatbots for subscribed users, ensuring secure and private management of chat histories.

How to set up Webhooks


If you're subscribed to the Standard or Professional plan, you can obtain your SIGNING_SECRET from the Webhooks section within the Settings tab.

Step 2: Set Up Webhooks Endpoints

Follow the chat-data-webhooks-example git repository to configure the endpoint for receiving the chat events.

You can use the following function in the webhook.js to verify if the event is from Chat Data.

const verifySignature = (body, signature, signingSecret) => {
  const digest = crypto
.createHmac('sha256', signingSecret)
  const computedHmac = Buffer.from(digest, 'base64');
  try {
if (crypto.timingSafeEqual(computedHmac, Buffer.from(signature, 'base64'))) {
  return true;
} else {
  return false;
  } catch (err) {
return false;

Step 3: Get the Event Payload

Following this setup, all conversations conducted with the corresponding chatbot will be promptly forwarded to your endpoints in near real-time. Presently, we permit up to 3 endpoints with the Standard or Professional plan for each chatbot. For additional endpoints, please reach out to us.

Here is an illustration of the fields that will be included in the event payload. The messages denote the chat history initiated by the user, while the answer represents the response generated by the chatbot. The client_ip signifies the user's IP address if it's accessible (unavailable for chat originating from third-party integrations). The chatbot_id is the identifier for the associated chatbot. The source field specifies whether the chat originates from the web widget integration or a third-party integration. The conversation_id aids in maintaining continuity within an existing conversation thread. The cost_credits is the number of message credits consumed by this chat. The lead attribute identifies the user who posed questions to the chatbot; however, it may not be available for chats originating from third-party integrations.

  messages: [
  role: 'assistant',
  content: "👋 Hello there! I'm Chat Data AI, your go-to source for all things about Chat Data!"
  role: 'assistant',
  content: 'By the way, you can create a chatbot like me for your website! 😮'
{ role: 'user', content: 'How to integrate with Discord?' }
  answer: {
role: 'assistant',
content: 'You can follow the [guide]( to integrate your chatbot with Discord.',
score: 0.8503905227042547
  client_ip: 'xx.xx.xx.xx',
  chatbot_id: '654aee418bc9a33b0e50d0ad',
  source: 'widget',
  cost_credits: 20,
  conversation_id: 'dbf24043-83a6-47fb-b241-9865de3877c9',
  lead: { uuid: '28239132-671d-4b1f-9d43-1c7b70985ede' }
Collecting Leads