The AI Lead Magnet That Qualifies While It Chats
Building a RAG-powered conversational widget that provides value and scores leads simultaneously.
Most lead magnets follow the same playbook: offer a PDF, gate it behind a form, hope someone reads it. The conversion rate on gated PDFs has been declining for years. People are tired of downloading whitepapers they'll never open.
I built something different for a coaching certification company: a conversational widget that answers questions about their program using RAG (retrieval-augmented generation) - and quietly scores the lead based on what they ask. The value exchange is immediate: ask a question, get a useful answer. No form required upfront. The scoring happens in the background.
How It Works
User types question in chat widget (embedded on landing page)
│
▼
n8n Chat Trigger receives message + session ID
│
▼
Supabase Vector Store > Retrieve relevant program knowledge chunks
│
▼
Claude API > Generate contextual response using retrieved chunks
│
├── Response sent to user
│
└── Scoring Logic (parallel):
├── Question classification (pricing, schedule, requirements, general)
├── Intent signal extraction (urgency, specificity, decision stage)
└── Session score update in HubSpot (if email captured)
The RAG Knowledge Base
The Supabase vector store contains program content chunked into semantic segments:
- Program structure (CTP, LPT, ELI certification details)
- Pricing and payment plans
- Schedule and time commitment
- Career outcomes and graduate success stories
- Comparison content (program vs. other certifications)
- FAQ responses from actual sales conversations
Each chunk is embedded using OpenAI's text-embedding-ada-002 and stored with metadata tags (topic, program, intent_level) for filtered retrieval.
Implicit Lead Scoring
The scoring happens without the user knowing. Based on what they ask, the system classifies intent:
- Pricing questions = high intent (score +20)
- Schedule/time commitment = high intent (score +15)
- Requirements/prerequisites = medium-high intent (score +12)
- Comparison questions = medium intent (score +10)
- General "what is coaching" = low intent (score +3)
When a user asks enough high-intent questions to cross the threshold score of 70, the widget gently surfaces a CTA: "It sounds like you're seriously considering this - would you like to schedule a quick call with an admissions advisor?" This feels natural because it IS natural - the user has been asking detailed, specific questions.
The Chat Interface
The frontend is a lightweight HTML/CSS/JS widget that posts to the n8n webhook. It includes session management (sessionStorage), typing indicators, and error handling. The interface is intentionally simple - it looks like a help chat, not a sales bot.
Key implementation detail: the widget sends a sessionId with every message so n8n can maintain conversation context across the exchange. The n8n workflow uses a Window Buffer Memory node to keep the last 10 messages in context for the Claude API call.
Results
- Average session length: 3.2 questions (vs. 1 page view for a static PDF)
- Users who engaged with the chat were 2.4x more likely to book a call
- Implicit scoring identified high-intent leads 48 hours faster than traditional form-based scoring
- Sales team reported higher quality conversations because leads arrived pre-educated
Download the Workflow
The AI Lead Magnet Chat workflow is available as a ready-to-import n8n JSON file. It includes the Webhook trigger for the chat widget, Supabase vector store retrieval, the Claude RAG prompt with system instructions, Window Buffer Memory for conversation context, and the implicit lead scoring logic. All credentials and API keys have been replaced with placeholders.
Download AI Lead Magnet Chat Workflow
Requires: OpenAI API key, Supabase API key (with pgvector extension).
Edward Chalupa is a digital marketing specialist and founder of Whtnxt, a digital marketing and automation consultancy. Connect with him on LinkedIn or explore more at echalupa.com.