Automate Lead Scoring with n8n: AI Scoring, Routing, and Follow-Up
Automate n8n lead scoring with AI. Score inbound leads 0–100, route by tier, update your CRM, and trigger follow-up sequences automatically. Browse templates.
Most inbound lead pipelines share the same failure pattern: a webhook fires, a row lands in a spreadsheet, and a sales rep manually checks if the lead is worth calling. At 20 leads a day, that's manageable. At 200, it's a full-time job that nobody actually does.
n8n lead scoring automation solves this by running every inbound lead through an AI scoring step before it touches a human. The @n8n/n8n-nodes-langchain.openAi v2.1 node scores the lead 0–100 against a prompt you define once. Hot leads route to an immediate Slack alert and a CRM task. Cold leads get a drip sequence. Dead leads get filed.
That's a five-node pipeline. About 90 minutes to set up.
What You Can Automate with Lead Scoring
The n8n lead scoring pattern handles more qualification signals than a manual review ever could:
- Inbound form submissions scored against ideal customer profile criteria
- LinkedIn profile enrichment feeding the scoring prompt (job title, seniority, company size)
- Behavioral signals: pricing page visited, demo requested, or specific product pages viewed before submitting
- Email domain classification (work vs. free domain, known competitor, known prospect list)
- Time-based routing so leads arriving at 2 AM queue for 9 AM instead of firing a pointless Slack ping
- CRM deduplication before the lead record is even created
- Automatic follow-up cadences triggered per tier without rep involvement
The n8n Lead Scoring Pipeline
The core flow is linear:
Webhook (Inbound Form)
→ Code (normalize payload)
→ HTTP Request (enrichment — optional)
→ OpenAI (score 0–100 + reason)
→ Code (parse JSON response)
→ Switch (Hot / Warm / Cold)
→ Hot: Slack alert + CRM hot pipeline + calendar invite
→ Warm: CRM record + email drip sequence
→ Cold: archive tag + slow nurture or discard
Enrichment is optional but improves scoring accuracy for B2B leads where company fit matters more than form copy.
Step-by-Step Breakdown
1. Collect: Normalize the Inbound Payload
A Webhook trigger (n8n-nodes-base.webhook) receives the form payload. Typeform, HubSpot forms, and raw HTML forms all work. The data shape differs across tools, so a n8n-nodes-base.code v2 node standardizes field names into a consistent object before anything else runs.
Don't skip this step. A field arriving as first_name on one form and firstName on another causes the scoring prompt to misread the lead about 30% of the time. Normalize first, score second.
2. Enrich: Add Signal Before Scoring
An HTTP Request node (n8n-nodes-base.httpRequest v4.2) calls a data enrichment API — Apollo's /people/match, Clearbit, or Hunter — using the lead's email address. The enriched object brings in company_size, industry, technologies, and employee_count. Pass all of it to the scoring prompt.
Worth it for B2B. Company fit is usually the biggest qualifier, and the form itself rarely captures it explicitly. Without enrichment, the model infers company fit from a company name, which is unreliable.
3. Score: Run the AI Node
The @n8n/n8n-nodes-langchain.openAi v2.1 node runs the scoring prompt. The output path is $json.output[0].content[0].text. The prompt returns a JSON string with two fields: score (integer 0–100) and reason (one sentence). A Code node parses it.
The model returns text. The Switch node downstream expects an integer. The Code node that runs parseInt(JSON.parse($json.output[0].content[0].text).score) is one of the most-rewritten pieces of n8n AI workflows when it gets skipped — because the failure mode silently routes every lead to the cold tier without throwing an error. Add the parse step every time.
Most teams building lead scoring for the first time write a filter, not a scorer. They pick three hard conditions: job title contains "Director", company size over 50, email domain isn't Gmail. That's field matching. An LLM-based scorer reads the message body, infers intent, and catches edge cases that conditions won't cover. The reason field matters too: when a rep sees "Score: 87 — mentions budget, has Q3 timeline, company fits ICP" they trust the system and act on it. Without the reason, they'll override the score every time and you've built automation nobody uses.
4. Route: Split by Score Tier
A Switch node branches on the score integer. Three outputs: Hot (70+), Warm (40–69), Cold (below 40). The routing logic is one node; the branching is simple. The hard part is deciding what those tiers mean for your particular sales motion, not the n8n configuration.
One thing to build from the start: a 4-hour threshold check on hot leads. Hot leads that arrive after business hours shouldn't fire an immediate Slack notification. A date/time check queues overnight hot leads for 9 AM. Leads older than 4 hours convert at roughly half the rate of sub-30-minute contacts.
5. Follow Up: Act on Each Tier Without Manual Intervention
Hot leads trigger a Slack message to the assigned rep with the lead summary, score, and reason field. Simultaneously, a HubSpot or Airtable node creates the CRM record tagged to the "hot" pipeline stage. Warm leads enter a three-email drip sequence via the Email node. Cold leads get an archive tag.
Wire up the routing first. Get 50–100 scored leads through the system and check whether the tier distribution looks right. Adjust the prompt thresholds before automating the actual outreach copy. Getting the scoring wrong and then automating the messaging on top of it is worse than doing it manually.
Implementation Patterns
Pattern 1: Score on Form Data Only
The minimal version skips enrichment entirely. The prompt receives the normalized form fields directly:
// Code node — prompt construction
const lead = $input.first().json;
const prompt = `Score this B2B lead 0-100 based on fit for a SaaS tool targeting ops teams at companies with 20-500 employees.
Return JSON only: {"score": integer, "reason": "one sentence explanation"}
Lead:
Name: ${lead.name}
Company: ${lead.company}
Role: ${lead.role}
Message: ${lead.message}
Source: ${lead.source}`;
return [{ json: { prompt } }];
This works well for high-volume pipelines where enrichment API costs would outweigh the accuracy benefit. Form message quality varies, but intent signals in the message body are usually enough to separate clearly-hot from clearly-cold leads.
Pattern 2: Enrich-Then-Score
Add the HTTP Request enrichment node between Webhook and OpenAI. The enriched object adds explicit company fit signals that form data doesn't carry. Include company_size, industry, and technologies in the prompt. Score accuracy for B2B leads improves because company fit isn't inferred; it's stated.
The enrichment API call adds about 800ms per lead. At 100 leads per day, that's negligible. At 5,000 leads per day, you're looking at blocking API calls that may need a queue pattern to avoid hitting rate limits on the enrichment provider.
Pattern 3: Re-Score Stale Leads
A Schedule trigger fires daily, queries the CRM for leads stuck in "warm" status for 14+ days, and re-scores them with updated behavioral context (email opens, page revisits, product trial activity). The Stalled Lead Rescue template handles this exact pattern: it queries a "no response" tag, re-scores with updated context from the last 14 days, and either re-routes to active outreach or moves the lead to the archive. Useful for pipelines where warm leads expire without action.
n8n Nodes for Lead Scoring Workflows
| Node | Purpose |
|---|---|
n8n-nodes-base.webhook | Receive inbound form submissions or API payloads |
n8n-nodes-base.httpRequest v4.2 | Call enrichment APIs (Apollo, Clearbit, Hunter) |
@n8n/n8n-nodes-langchain.openAi v2.1 | Score and classify leads via GPT-4o |
n8n-nodes-base.code v2 | Normalize form data, parse AI JSON output |
n8n-nodes-base.switch | Route by score tier (hot / warm / cold) |
n8n-nodes-base.slack | Notify reps of hot leads immediately |
n8n-nodes-base.hubspot / n8n-nodes-base.airtable | Create or update CRM records |
n8n-nodes-base.gmail or SMTP | Trigger drip sequences for warm leads |
Getting Started with n8n Lead Scoring Automation
An n8n instance (self-hosted or n8n Cloud), an OpenAI API key, and webhook access from your form tool. The full pipeline runs 5–7 nodes depending on whether enrichment is included. Credentials for your CRM and Slack or email provider complete the setup.
- Create the Webhook trigger. Set the path to something readable (
/lead/inbound). Copy the production URL for the form tool configuration. - Add a Code node to normalize the payload. Standardize field names so the scoring prompt always receives the same shape regardless of which form tool fires.
- Add an HTTP Request node for enrichment (optional). Point it at Apollo's
/people/matchendpoint using the lead's email. Store the result in$json.enriched. - Add the OpenAI node. Use
@n8n/n8n-nodes-langchain.openAiv2.1. Wire the scoring prompt into theresponses.values[].contentparameter. - Add a Code node to parse the JSON response at
$json.output[0].content[0].text. Extractscoreandreason. - Add a Switch node with three outputs: Hot (>= 70), Warm (>= 40), Cold (< 40).
- Wire up each branch. Slack node for hot leads, email node for warm leads, CRM update for all three tiers.
The AI Lead Scoring template ships with the complete pipeline pre-wired: Webhook, normalization Code node, OpenAI scoring, Switch routing, and Slack/CRM/email branches with YOUR_ credential placeholders ready to swap. The scoring prompt targets a generic B2B SaaS ICP; update the company type and use case description and it's applicable to most pipelines the same day.
The lead scoring workflow is one of those automations where the biggest return isn't the time saved — it's the forced clarity about what "good lead" actually means for the business. You can't write a scoring prompt without answering that question first.
For teams already using n8n for CRM work, the n8n CRM automation guide covers what happens after a lead is scored and routed. If lead volume is the constraint rather than qualification, automating lead generation with n8n covers the acquisition side.
Channel-level attribution pairs well here too. The CAC Channel Quality Pipeline tracks which acquisition channels produce high-scoring leads, so spend concentrates where it converts — not just where it generates volume.
Browse all n8n automation templates →Common questions
How does n8n lead scoring work with AI?
What score threshold separates hot from warm leads in n8n?
Can n8n update my CRM automatically after scoring a lead?
Get the workflow templates this guide is built on
Import-ready n8n JSON, step-by-step setup, and tested end-to-end. One-time payment, own it forever.
More automation guides

Automate Competitor Monitoring and Market Tracking with n8n
What Competitor Monitoring Actually Catches A competitor changed their pricing on a Tuesday. You found out the following Monday when a prospect mentioned it during a demo. That gap, 6 days of operatin…

Build a SaaS Automation Pipeline with n8n
Where SaaS Revenue Slips Through Before Anyone Notices SaaS products don't lose users at the cancellation screen. The window closes earlier: a trial expires with no follow-up, a free user hits the sto…

How to Automate Online Community Management with n8n
Managing an online community by hand means refreshing Reddit tabs, drafting the same invite emails over and over, and manually logging who received a coupon code. When a community exceeds a few hundre…