← back to work← back to workAI-Powered Lead Qualification
AI Systems2024
AI-Powered Lead Qualification
& Intelligence System
A three-phase n8n pipeline that searches Google Maps by industry and location, deeply enriches each lead with contact data and website signals, scores response speed, and syncs a prioritised list to Google Sheets.
Phases
3
LLM
GPT-4o-mini
Lead Filters
6
Signal Types
5
Scoring
0–10
// the problem
Manual lead research doesn't scale
Sales teams spend hours finding businesses in a target market, then more hours manually checking websites for contact details and qualifying whether they're a good fit. This engine automates the entire pipeline — from keyword generation to a scored, enriched, ready-to-contact lead list — in a single workflow run.
// workflow diagram
Three phases at a glance
// phase 1 — intake & search
From search query to qualified lead list
01
Form Trigger
User submits industry, country, state, company size, and seniority level through a form.
02
Format Query
JavaScript builds a clean location string and context phrase from the inputs — handles global searches where state is optional.
03
Generate Keywords
GPT-4o-mini creates N diverse Google Maps search terms from the context. Configurable: default 2 terms per run.
04
Search Google Maps
Serper Maps API queries each keyword with location and returns the top N business listings.
05
Filter & Qualify Leads
Filters out closed businesses, those without a website or phone, and those with a rating below 4.0 or fewer than 10 reviews. Deduplicates by place ID.
06
Save Initial Leads to Sheets
Qualified leads (name, address, phone, website, category) are appended or updated in the Google Sheet before enrichment begins.
// phase 2 — enrichment loop
Deep enrichment per lead
01
Loop Each Lead
Processes one lead at a time through the enrichment pipeline. When all leads are done, exits to the summary phase.
02
Scrape Homepage
ScraperAPI fetches the business homepage. Raw HTML is capped at 500k characters and cleaned — scripts, styles, and noise stripped out.
03
Find Contact & Review URLs
Serper searches the business domain for contact pages, booking pages, and Trustpilot reviews. URLs parsed and classified.
04
Fetch Contact Page
ScraperAPI fetches the discovered contact page. If no contact URL is found, this step is skipped gracefully.
05
Extract Emails & Signals
Multi-strategy extraction: raw HTML scan, mailto links, text parsing (top and bottom 12k chars). Detects chat widgets, schedulers, instant quote tools, contact forms, and CRM presence.
06
Score Speed-to-Lead
Scores each lead 0–10 based on response channels found. High score = strong lead setup. Low score = friction gaps and sales opportunity.
07
Upsert to Sheets + Wait
Enriched lead data is upserted to the Google Sheet. A 30-second wait between leads prevents API rate limits.
// technical stack
Tools & technologies
n8n
Workflow orchestration — all three phases
GPT-4o-mini
Generates targeted Google Maps search keywords from industry + location
Serper API
Searches Google Maps and finds contact/Trustpilot URLs for each lead
ScraperAPI
Fetches homepage and contact page HTML for each qualified business
Google Sheets
Lead storage, enrichment upsert, and final scored output
Gmail
End-of-run summary email with stats and top samples
// engineering decisions
Why it was built this way
GPT-4o-mini for keyword generation
Fast and cheap for this task — keyword generation doesn't need a frontier model. Saves cost at scale while still producing diverse, creative search terms.
Multi-strategy email extraction
Businesses use emails in many formats — hidden in mid-page HTML, obfuscated with [at], or only in mailto links. The system tries all strategies ranked by confidence and falls back to a full field scan.
30-second loop wait
Prevents Serper and ScraperAPI rate limit errors when processing large lead lists. Configurable per deployment.
Speed-to-Lead scoring
Gives sales teams a prioritised list — high scorers already have strong response infrastructure, low scorers are the best prospects for the AI booking/follow-up pitch.
Separate qualify and enrich phases
Only qualified leads enter the expensive enrichment loop. Filtering early avoids unnecessary ScraperAPI credits on closed, low-rated, or contact-less businesses.
// business value
What this delivers
Targeted lead lists on demand
Configure industry, location, and volume. Run the workflow and get a ready-to-work list in minutes.
Prioritised by contact readiness
The Speed-to-Lead score tells your team exactly who to approach first and what gap to pitch.
Email and contact pre-found
Each lead arrives with verified contact data already extracted — no manual website digging.
Scalable and repeatable
Same workflow runs daily, weekly, or per campaign. Different industry or location, just change the form inputs.
Need a lead engine for your sales team?
Let's build a scraper and scoring pipeline tailored to your market.