Using Webhooks in Your Elfsight AI Chatbot

Want to send data from your Elfsight AI Chatbot to another application or service? Add a webhook URL to automatically send conversation details—such as transcripts, AI summaries, collected contacts, and more—whenever a conversation ends.

A webhook works by sending an HTTP POST request to the URL you specify, allowing you to build your own integrations and automations. Follow the steps below to set it up.

Webhooks are intended for users familiar with APIs and HTTP requests. Since webhook endpoints are managed on your side, we can't assist with custom development, but we're happy to help with the Elfsight side of the integration.

In this article

Setting Up Webhooks

To add webhook URLs for your AI Chatbot conversations, follow these steps:

1
In your widget editor, go to the Integrations tab and click Webhooks:
2
Add one or more webhook URLs that should receive your conversation data:
Don’t have a webhook URL for testing yet? Use a free service like webhook.site. Copy your unique URL and add it to the widget to inspect the conversation data it receives.
3
Publish your widget to enable the Webhook integration:

That’s it for the setup on the Elfsight side! 🎉 Let’s take a closer look at when webhooks are triggered and what data they send.

When Webhook Data Is Sent

After you add your webhook URL and publish the widget, the AI Chatbot sends an HTTP POST request whenever a conversation ends. This happens in either of the following cases:

  • The visitor clicks New Chat in the chatbot window:
  • The configured inactivity period expires.

By default, a conversation closes after 10 minutes of inactivity. You can change this period in your widget editor under Settings Chat Session Close Conversation After Inactivity:

When one of the conditions is met, the widget sends one POST request to each webhook URL you have added. Next, we'll look at the structure of the conversation data included in the request.

Webhook Data Structure

The conversation data is sent in JSON format within the request body. It includes key details such as when and where the chat started, its duration and topic, an AI-generated summary, collected contact information, identified knowledge gaps, the full conversation transcript, and a direct link to the conversation in your Elfsight dashboard.

The same fields are included in every request. If certain information isn't available, the corresponding field may be empty.

Click the toggles below to view an example of the data structure and learn what each field represents:

Example JSON Data

The example below shows the structure of the conversation data sent to your webhook URL:

{
  "threadPid": "598f33ac-fa72-41b1-9a7f-2007455s32d1",
  "assistantPid": "51decad4-6ab7-473f-b0f7-24548dcnn78y",
  "widgetPid": "a395578b-f21f-4596-67fg-716df7b68432",
  "timeZone": "Etc/UTC",
  "chatStarted": "2025-03-15T14:32:10+00:00",
  "duration": "4 min",
  "sourcePage": "https://example.com/pricing",
  "chatTopic": "Pricing for enterprise plan",
  "summary": "The user asked about enterprise pricing. The assistant provided details and offered to connect with sales.",
  "leadName": "Jane Smith",
  "leadEmail": "jane@example.com",
  "leadPhone": "+1-555-5555",
  "knowledgeGaps": [
    {
      "shortName": "Refund policy",
      "summary": "What is the refund policy for annual plans?"
    }
  ],
  "transcript": [
    {
      "role": "AI Agent",
      "message": "<p>Hi there 👋</p><p>How can I help you today?</p>",
      "dateTime": "2025-03-15T14:32:10+00:00"
    },
    {
      "role": "User",
      "message": "What's the pricing for the enterprise plan?",
      "dateTime": "2025-03-15T14:32:25+00:00"
    },
    {
      "role": "System",
      "message": "Chat ended due to inactivity",
      "dateTime": "2025-03-15T14:36:10+00:00"
    }
  ],
  "dashboardLink": "https://dash.elfsight.com/widget/.../chats/..."
}
		
Webhook Data Fields

The tables below explain what each field in the webhook data represents:

Main Data Fields

Field Type Description
threadPid string (UUID) Unique identifier of the conversation.
assistantPid string (UUID) Unique identifier of the AI Agent.
widgetPid string (UUID) Widget ID.
timeZone string Time zone selected in the widget settings.
chatStarted string (ISO 8601) Date and time when the conversation started.
duration string Conversation duration.
sourcePage string (URL) Page where the visitor started the conversation.
chatTopic string Conversation topic identified by AI.
summary string AI-generated summary of the conversation.
leadName string | null Visitor's name collected through the Collect Contacts skill.
leadEmail string | null Visitor's email address collected through the Collect Contacts skill.
leadPhone string | null Visitor's phone number collected through the Collect Contacts skill.
knowledgeGaps object [] Questions the AI Agent couldn't answer. Contains an empty array if no knowledge gaps were identified. See Knowledge Gaps Fields below.
transcript object [] Complete conversation history. See Chat Transcript Fields below.
dashboardLink string (URL) Direct link to the conversation in your Elfsight dashboard.

Knowledge Gaps Fields

Field Type Description
shortName string Short title describing the knowledge gap.
summary string Detailed description of the question the AI Agent couldn't answer.

Chat Transcript Fields

Field Type Description
role string Message sender: "AI Agent", "User", or "System".
message string Message content. AI Agent messages may contain HTML, while visitor messages are provided as plain text.
dateTime string (ISO 8601) Date and time when the message was sent.

You can now process the received conversation data in an external service, store it in a database, or use it in your own integrations and automations.


We hope this article was helpful! If you have any questions or need assistance, feel free to contact our Support Team — we're happy to help! 🙌

Did this article answer your question? Share your feedback: Thanks for sharing your feedback. It helps us grow! There was a problem submitting your feedback. Please try again later.

Still looking for assistance? Contact Us Contact Us