Most small businesses lose leads the same way: someone visits the website at 9 PM, has a question, sees no one is available, and leaves. Or they call during lunch and get voicemail. Or they message on Facebook and wait three days for a reply. Each of those is a prospect who was ready to buy and got nothing.
I built a system that eliminates this problem across three channels simultaneously — website chat, phone calls, and Facebook Messenger — using AI agents that qualify leads, capture contact information, and notify the business owner in real time. Not a chatbot widget from a SaaS vendor. A custom-built system that understands the business, asks the right questions, and routes hot leads immediately.
This article breaks down the architecture across two real deployments: the AI sales agent on LuxuriousComputers.com and the voice AI receptionist for a service business in Marion, Ohio.
The Three-Channel Architecture
Lead generation is not a single-channel problem. Prospects reach businesses through whatever channel is most convenient for them at that moment. A system that only covers website chat misses phone callers. One that only covers phone misses the 70% of people who will never pick up a phone to call a small business.
The system I built covers three channels with a unified lead qualification pipeline:
Channel 1: Website Chat (AI Sales Agent)
The website chat agent — deployed on LuxuriousComputers.com — does more than answer questions. It watches what the visitor is doing on the site, scores their buying intent in real time, and adjusts its approach accordingly.
The scoring model considers behavioral signals that most chatbots ignore:
// Lead scoring based on real-time behavioral signals
function scoreLeadIntent(session) {
let score = 0;
// Page-level signals
score += session.productPageViews * 15; // Browsing products = interest
score += session.timeOnSite > 120 ? 20 : 0; // 2+ minutes = engaged
score += session.scrollDepth > 0.7 ? 10 : 0; // Read most of the page
score += session.returnVisit ? 25 : 0; // Came back = serious
// Cart signals (highest weight)
score += session.cartItems.length * 30; // Added to cart = hot
score += session.cartAbandoned ? 15 : 0; // Cart abandon = needs nudge
// Chat signals
score += session.chatInitiated ? 20 : 0; // Started a conversation
score += session.askedAboutPricing ? 15 : 0; // Price question = buying
score += session.askedAboutWarranty ? 10 : 0; // Warranty = close to decision
return {
score,
tier: score >= 80 ? 'hot' : score >= 40 ? 'warm' : 'cold',
action: score >= 80 ? 'close' : score >= 40 ? 'qualify' : 'nurture'
};
}
A visitor who browsed three product pages, added something to their cart, and then opened the chat widget gets a completely different greeting than someone who just landed on the homepage. The first gets: "I see you are looking at the MacBook Air M2 — great choice. Any questions before you check out?" The second gets: "Hey, welcome. Looking for a specific Mac, or just browsing what we have?"
This is not complicated AI. It is basic sales sense encoded into a system prompt with real-time context injection. But it is the difference between a tool that waits passively and one that actively qualifies and converts.
Channel 2: Phone (Voice AI Receptionist)
The phone channel uses a voice AI receptionist built on Asterisk PBX and Pipecat. When someone calls the business number, the AI answers within one ring, handles the conversation in natural language, and captures lead information — name, phone number, what they need, and how urgent it is.
The voice AI qualifies callers using the same intent framework as the chat agent, but adapted for phone conversations. A caller asking "how much do you charge for a screen repair?" is a warm lead. A caller saying "my phone fell in water and I need it fixed today" is a hot lead with urgency. The system classifies these differently and adjusts both its response and the notification priority sent to the owner.
Caller ID integration adds another qualification layer. If the phone number matches a previous caller, the AI pulls up their history: "Hi Sarah, good to hear from you again. Last time you called about a battery replacement — did you want to go ahead and schedule that?"
Channel 3: Facebook Messenger (Webhook Integration)
The Messenger channel is the simplest integration but covers a surprisingly large source of leads for local businesses. Many people discover small businesses through Facebook — from posts, marketplace listings, or group recommendations — and their natural action is to message the page rather than visit the website or call.
The integration uses Facebook's webhook API. When a message arrives, it hits a Cloudflare Worker that routes it through the same LLM pipeline as the website chat, with the business context and qualification logic. The response goes back through the Messenger API. From the customer's perspective, they are just chatting with the business on Messenger. Behind the scenes, the same AI that handles website visitors is qualifying them and capturing their information.
The Unified Lead Pipeline
All three channels feed into the same pipeline. When a lead is qualified — meaning they have expressed genuine interest and the AI has captured their contact information and need — the system fires a notification to the business owner.
// Unified lead capture and notification
async function captureAndNotifyLead(lead, env) {
// Store lead in KV with channel source
const leadKey = `lead:${Date.now()}:${lead.channel}`;
await env.KV.put(leadKey, JSON.stringify({
name: lead.name,
phone: lead.phone || null,
email: lead.email || null,
channel: lead.channel, // 'chat' | 'phone' | 'messenger'
intent: lead.intent, // What they need
score: lead.score, // Qualification score
tier: lead.tier, // 'hot' | 'warm' | 'cold'
transcript: lead.messages, // Conversation history
timestamp: new Date().toISOString()
}), { expirationTtl: 2592000 }); // 30-day retention
// Notify owner based on lead tier
const priority = lead.tier === 'hot' ? 5 : lead.tier === 'warm' ? 3 : 2;
await fetch('https://ntfy.beamvideos.com/publish', {
method: 'POST',
body: JSON.stringify({
topic: 'business-leads',
title: `${lead.tier.toUpperCase()} Lead via ${lead.channel}`,
message: `${lead.name}: "${lead.intent}"`,
priority,
tags: lead.tier === 'hot' ? ['fire'] : ['incoming']
})
});
}
The notification system uses self-hosted ntfy — a push notification service running on the same infrastructure as the rest of the stack. Hot leads trigger high-priority notifications that bypass Do Not Disturb on the owner's phone. Warm leads get standard notifications. Cold leads get logged but do not interrupt the owner.
This tiered notification approach solves a real problem: if every chat interaction triggers a notification, the owner learns to ignore them. If only qualified, high-intent leads trigger alerts, every notification is worth acting on.
Why This Beats HubSpot, Drift, and Calendly
SaaS lead capture tools solve a subset of this problem at a premium price. Here is how they compare:
HubSpot ($50-800/month): Excellent CRM, but the chatbot is a rule-based flow builder. It cannot have a real conversation, does not understand context, and requires manual setup of every question-and-answer path. It also does not cover phone or Messenger.
Drift ($400-1500/month): Better AI in the chat widget, but limited to website only. No phone integration. No behavioral scoring from page views and cart actions. And at $400/month minimum, it costs more per year than a custom-built system costs to build once.
Calendly ($12-16/month per user): Good for scheduling, but it is a form, not a qualifier. It lets anyone book a meeting without filtering for intent or urgency. The business owner ends up on calls with tire-kickers who booked because the calendar was there.
The custom system I built costs $0/month in infrastructure (Cloudflare Workers free tier handles the traffic, ntfy is self-hosted, Asterisk runs on existing hardware). The only ongoing cost is API calls to Claude for the LLM reasoning — typically $5-15/month for a small business receiving 20-50 leads per month across all channels.
More importantly, the custom system qualifies leads before they reach the owner. The owner does not waste time on spam messages, wrong-number phone calls, or website visitors who were just browsing. Every notification represents a real prospect with a real need.
Lead Scoring in Practice
Lead scoring sounds like enterprise software jargon, but the implementation is straightforward. Each interaction contributes points, and the total determines the lead tier and the urgency of the notification.
In practice, the scoring model needs calibration per business. An e-commerce store weights cart additions heavily because adding to cart is a strong buying signal. A service business weights phone calls heavily because someone who picks up the phone to call a repair shop is further along in their decision than someone browsing the website.
The calibration process is simple: review the first 50 leads, check which ones converted to customers, and adjust the weights. I typically do this two weeks after deployment and then monthly thereafter. Most of the weight adjustments are obvious once you see the data — things like "people who ask about pricing on the phone convert at 3x the rate of people who ask via chat" lead directly to increasing the phone-pricing-question weight.
The Session Memory Advantage
The most underrated feature of this system is cross-session memory. Every interaction — chat, phone, Messenger — is stored in Cloudflare KV with a 30-day retention window. When a prospect returns through any channel, the AI picks up where it left off.
This creates experiences that SaaS tools cannot match. A prospect chats on the website on Monday, calls on Wednesday, and messages on Facebook on Friday. Each time, the AI knows who they are, what they need, and what has already been discussed. The third interaction is not "how can I help you?" — it is "Hi, you mentioned on Monday you were looking at the MacBook Pro. Would you like to come in and see it, or should I ship it to you?"
Cross-channel session memory requires a consistent identity key. For the phone channel, it is the caller ID. For website chat, it is a session cookie. For Messenger, it is the Facebook user ID. When any two of these can be linked — for example, the chat agent captures a phone number that later calls in — the system merges the profiles and the AI has the full conversation history across channels.
What I Learned Building This
Qualification questions matter more than AI sophistication. The biggest improvement in lead quality came not from upgrading the LLM model but from refining what the AI asks. Three questions — "What do you need?", "When do you need it?", and "What is your budget range?" — separate serious buyers from browsers more effectively than any amount of behavioral scoring.
Notification fatigue is real. The first version sent a push notification for every chat interaction. Within a week, the business owner turned off notifications entirely. The tiered system — only hot leads interrupt, warm leads get standard priority, cold leads just log — solved this completely. Now every buzz on the owner's phone means money.
The phone channel converts best. Across both deployments, phone leads convert to paying customers at roughly 3x the rate of chat leads and 5x the rate of Messenger leads. People who call are further along in their buying journey. The voice AI's job is not to sell them — it is to capture their information and connect them with the owner before they call the next business on their list.
Speed of response is the competitive advantage. Most small businesses take hours or days to respond to online inquiries. The AI responds in seconds. For a prospect who messaged three businesses, the one that responds instantly gets the business. This is not theoretical — I have seen it in the data repeatedly. First response wins.
The Autonomous Monitoring Layer
A lead generation system that goes down at 2 AM and stays down until someone notices at 9 AM has lost 7 hours of leads. The system is monitored by an autonomous health-check loop that verifies all three channels every hour: pings the chat endpoint, makes a test call to the voice AI, and sends a test message through the Messenger webhook. If anything fails, I get an alert immediately.
This monitoring layer is the difference between a demo and a production system. Demos work when you are watching. Production systems work when no one is watching.
Related Articles
AI Chatbot That Closes Sales
Most AI chatbots are FAQ scrapers with a text box. Here is how to build one that handles objections, tracks cart state, and actually closes deals.
Voice AI Agent for Business
How I built a real-time voice AI receptionist that handles inbound calls, qualifies leads, and routes to humans.
Autonomous AI Operator
How I built a scheduled AI agent loop that health-checks infrastructure, analyzes inventory, and generates marketing content.