← All projectsCase study · Sales & CRM

AI Lead Management Automation

Every lead from the website is validated, de-duplicated, scored 0–100, classified Hot / Warm / Cold and stored — then AI writes a sales brief for the qualified ones and pushes it to the sales team instantly.

n8nOpenAIJavaScriptGoogle SheetsPushoverWebhooksHTML/CSS/JS
0–100
lead score on 7 weighted factors
3
tiers: Hot · Warm · Cold
9
edge cases handled
20
workflow nodes
How it works
triggerailogicdataaction
  1. 01 · TriggerLead form webhook
  2. 02 · LogicValidate & normalize
  3. 03 · DataDuplicate check
  4. 04 · LogicScore & classify
  5. 05 · DataStore in Sheets
  6. 06 · AIAI sales insight
  7. 07 · ActionNotify sales
The actual workflow↓ Download JSON

Click to interact · zoom, pan and inspect each node. Credentials removed.

The problem

Leads arrive from forms and landing pages, and without automation the sales team has to do everything by hand: check the data is valid, spot duplicates, judge the lead’s quality, decide who deserves a call first, save it somewhere, read the message to understand the intent — and only then reply.

Slow, inconsistent, and the best leads wait in the same queue as the junk.

The solution

A single n8n system that takes a lead from the form to the salesperson’s phone:

  • Custom lead form served by n8n itself, posting to a webhook.
  • Backend validation of name, email and Egyptian phone numbers — even though the form validates too, because client-side checks can be bypassed. Phones are normalized from every common format (010…, +2010…, 20…).
  • Duplicate detection by email and phone. Duplicates get their own response and a page telling the user exactly what matched: email, phone or both.
  • Rule-based scoring (0–100) and classification: 80+ Hot, 60+ Warm, below that Cold.
  • Every lead is stored in Google Sheets with an ID, score, tier and timestamp.
  • AI analyses only Hot and Warm leads and produces a short brief — intent, need, potential, recommended action — instructed to use only what the lead provided and never invent details.
  • The brief is pushed to sales via Pushover, and the customer gets a confirmation page.

How the score works

Factor Max points
Budget 50
Number of branches 20
Business type 15
Message / intent 15
Email 10
Phone 10
Company 10

Technical decisions

Deterministic rules first, AI second

Validation and scoring must give the same answer every time, so they’re plain JavaScript in Code nodes. AI is used only where interpretation adds value — reading the message in the context of budget, branches and score. This keeps the system predictable and keeps AI cost low (Cold leads never reach the model).

Edge cases covered

Invalid email · invalid Egyptian phone · invalid name · duplicate email · duplicate phone · duplicate email + phone · cold leads · invalid submissions · missing fields.

What I’d add for scale

PostgreSQL with unique constraints instead of Sheets, structured AI output, retries and a dedicated error workflow, rate limiting, and queue-based processing for traffic spikes.

The result

The sales team stops processing leads and starts talking to the right ones: duplicates never reach them, Cold leads are filed automatically, and every Hot lead arrives on their phone with a ready-to-read brief and a recommended next step.