AI Lead Qualification System
Automated lead scoring and routing pipeline using n8n, Groq-hosted LLaMA 3.3 70B, Google Sheets, and Gmail.
Overview
Built an automated lead qualification pipeline that ingests leads from multiple sources, scores them using LLaMA 3.3 70B for fit and intent, routes high-scoring leads to sales, and logs everything to Google Sheets for analysis. All orchestrated via n8n workflows.
Business Problem
Sales teams at B2B companies receive hundreds of inbound leads weekly. Manual triage is slow and inconsistent. High-value leads slip through while low-quality leads consume sales effort. Teams needed an automated system that consistently evaluates and routes leads based on fit criteria.
Solution
Designed an n8n workflow that watches lead sources (web forms, email inquiries, LinkedIn), runs each lead through a structured LLaMA 3.3 70B prompt for scoring across 5 dimensions (budget fit, authority, need, timeline, intent), computes a composite score, and routes leads above threshold directly to sales via Gmail with a formatted summary.
Architecture
Key Features
- →Multi-source lead ingestion (web forms, email, LinkedIn inquiries)
- →LLM-powered lead scoring across 5 dimensions with structured output parsing
- →Automated routing: high-scoring leads sent to sales with formatted summaries
- →Complete lead audit trail in Google Sheets
- →Configurable scoring thresholds and routing rules
- →Slack notifications for high-value leads
Tech Stack
Engineering Challenges
Structured Output from LLMs
Getting consistently formatted JSON scores from LLMs required careful prompt engineering with few-shot examples and explicit schema instructions. Added post-processing validation to catch malformed outputs.
n8n Workflow Reliability
Long-running workflows with API calls to multiple services occasionally timeout. Implemented retry logic with exponential backoff and error notifications to ensure no leads are lost.
Score Calibration
Initial LLM scores clustered around the middle (40-60 range) with low variance. Tuned the scoring prompt to penalize middling scores and reward clear signals, producing more actionable score distributions.
Lessons Learned
- →LLM scoring with structured output parsing is a viable alternative to trained classifiers for lead scoring, especially when labeled data is scarce
- →n8n is a powerful orchestrator for AI workflows but requires robust error handling for production use
- →A complete audit trail in Google Sheets builds stakeholder trust and enables continuous improvement
Results
The system processes 100+ leads weekly with zero manual effort. Sales team reports 35% higher conversion rate on AI-scored leads compared to manual triage. Lead response time dropped from 4 hours to under 5 minutes.
Related Projects
Let's Build Something Similar
Have a project in mind? Let's discuss how we can architect and build it together.
Discuss Your Project