Normalized for Mintlify from
knowledge-base/aiconnected-apps-and-modules/modules/funnelChat/legacy-kb-chat-lead-capture-routing.mdx.Lead Capture & Routing System
Overview
This specification extends the kbChat platform with lead capture and routing capabilities. The system allows agencies and businesses to create custom forms, capture lead information during chat conversations, and route that information to their preferred destination. Platform Responsibility: Capture the data, deliver the data. Agency/Business Responsibility: What happens after delivery.Admin Interface: Lead Capture Settings
Location: Business Settings → Lead Capture (or Agency Settings → Default Lead Capture for agency-wide defaults)Part 1: Form Builder
1.1 Form Configuration
1.2 Field Builder
Each form consists of custom fields. The admin can add, remove, reorder, and configure fields. Field Properties:
Field Types:
1.3 Preset Templates
To speed up setup, offer starter templates:
Agency can set a default template that applies to all new businesses.
1.4 Form Display Options
Part 2: AI Integration
2.1 How the AI Uses the Form
The AI needs to know:- What form(s) exist
- When to present the form
- What to do after submission
2.2 Conversational vs. Form Collection
Option A: Conversational Collection AI asks for fields naturally within the conversation: > “I’d be happy to have someone reach out to you. What’s the best email to contact you at?” Option B: Direct Form AI triggers form display: > “Let me grab your details so we can follow up. Just fill out this quick form:” > [Form appears] Admin Setting: Collection Style- Conversational (AI asks naturally)
- Form (AI presents form)
- Hybrid (AI asks 1-2 key fields, then presents form for rest)
Part 3: Routing Configuration
After form submission, where does the data go?3.1 Routing Destinations
Admin can enable one or more destinations. All enabled destinations fire simultaneously.Email Notification
- All captured form fields (label: value format)
- Timestamp
- Conversation transcript (if enabled)
- AI summary (if enabled): “User is interested in [X], asked about [Y], sentiment: [Z]“
SMS Notification
Webhook (JSON Payload)
3.2 JSON Payload Structure
lead object keys match the Field Key set in the form builder. Agencies can customize these keys to match their destination system’s expected field names, eliminating the need for field mapping on the receiving end.
3.3 Webhook Testing
3.4 Redirect Option
After form submission, optionally redirect the user:
This allows: Capture lead info → Send to webhook → Redirect to Calendly
The business gets the lead data AND the user can self-schedule. Best of both worlds.
Part 4: Database Schema Additions
4.1 New Tables
4.2 RLS Policies
Part 5: UI Mockup Descriptions
5.1 Form Builder Interface
Header:- Form Name (editable)
- Active/Inactive toggle
- Save / Delete buttons
- Draggable list of current fields
- Each field shows: Label, Type, Required indicator
- Drag handle for reordering
- Click to edit, X to delete
- Appears when field is selected
- All field properties editable
- Live preview of field appearance
- ”+ Add Field” button
- Dropdown of field types
- Or “Use Template” to load preset
5.2 Routing Configuration Interface
Tab Layout:- Email | SMS | Webhook | Redirect
- Enable toggle at top
- Configuration fields below (grayed out if disabled)
- Test button where applicable
- Payload Preview panel (shows live JSON)
- Test Result panel (shows last test response)
- Delivery Log link
5.3 Leads Dashboard
Table View:- Date/Time
- Name
- Phone
- Form Used
- Delivery Status (icons: ✓ email, ✓ SMS, ✓ webhook)
- Actions: View Details
- All captured fields
- Full conversation transcript
- AI summary
- Delivery log (what was sent where, when, response codes)
Part 6: Implementation Priority
Phase 1: Minimum Viable
- Form builder with basic fields (text, email, phone)
- Email notification only
- Basic leads table
Phase 2: Full Routing
- All field types
- SMS notification
- Webhook with authentication options
- Redirect option
Phase 3: Polish
- Preset templates
- Webhook testing and logs
- Leads dashboard with filtering/search
- AI summary generation