Skip to content
On this page

Lead Collection

Automatically extract structured lead data from widget chat conversations and deliver it to your external systems via webhooks.

Overview

Lead Collection monitors your chat widget conversations for inactivity. When a visitor stops chatting, the system uses AI to extract structured data based on your configured parameters, classifies the lead by completeness, and forwards it to your configured webhooks.

How It Works

  1. Visitor chats with your widget — The conversation is stored as a widget session.
  2. Inactivity detection — A cron job scans for sessions that have been inactive for longer than your configured threshold (default: 10 minutes).
  3. AI extraction — The conversation is sent to an LLM that extracts structured data based on your data collection parameters (e.g., name, email, phone number).
  4. Lead classification — Each lead is classified as:
    • Success — All requested data points were extracted
    • Partial — Some data points were extracted
    • Failure — No meaningful data was extracted
  5. Webhook delivery — The lead is POSTed to each active webhook that matches the configured lead status filters.

Configuration

Enabling Lead Collection

Toggle the Enabled switch in the Lead Collection settings page.

Inactivity Threshold

Set how many minutes of inactivity must pass before a session is processed (1–1440 minutes, default: 10).

Data Collection Parameters

Define what data to extract from conversations as a JSON object. Each key is a field name, and each value is a description of what to extract.

Example:

json
{
  "name": "Extract the visitor's full name",
  "email": "Extract the visitor's email address if provided",
  "phone": "Extract phone number if mentioned",
  "company": "Extract company name if mentioned"
}

Webhooks

You can configure multiple webhooks, each with independent settings:

  • URL — The endpoint where lead data will be POSTed
  • Active — Toggle to enable/disable the webhook without deleting it
  • Lead Statuses — Multi-select to choose which lead statuses to send to this webhook:
    • Success — Only fully extracted leads
    • Partial — Leads with some data extracted
    • Failure — Leads where no data was extracted
    • Leave empty to send all statuses
  • Custom Headers — Add custom HTTP headers to the webhook request.

Webhook Payload

When a lead is delivered, the following JSON is POSTed to each webhook:

json
{
  "lead_id": "abc123",
  "session_id": "sess_xyz789",
  "extracted_data": {
    "name": "John Doe",
    "email": "john@example.com"
  },
  "chat_summary": "Visitor asked about pricing and provided contact details.",
  "status": "success",
  "created_at": "2025-07-07T18:30:00.000Z"
}

Webhook Response Storage

The response from each webhook is stored and visible in the dashboard. You can view:

  • Whether the webhook succeeded or failed
  • HTTP status code
  • Response body (or error message)

External API Access

Leads can also be fetched programmatically via the external API endpoint:

GET /api/lead-collection/leads?status=success&limit=50&page=1
x-api-key: <your_api_key>

See the API Reference for full details.

Dashboard

The Lead Collection dashboard provides:

  • Configuration form — Enable/disable, configure webhooks, set inactivity threshold, and define data collection parameters
  • Leads table — View all collected leads with status, chat summary, creation date, and sent date
  • Lead detail modal — View full extracted data and webhook responses
  • Retry webhook — Re-send a lead to all matching webhooks if a delivery failed

Lead Statuses

StatusDescriptionColor
SuccessAll requested data points were extractedGreen
PartialSome data points were extractedOrange
FailureNo meaningful data was extractedRed