Lead Enrichment & Scoring in n8n with AI Nodes

AgentRoost · June 11, 2026 · 7 min read · View as Markdown
AgentRoost — n8n Automation

Most sales teams treat every inbound lead the same until a human reads it — which means the best leads sit in a queue next to tire-kickers for hours or days. With n8n and an AI node you can score every lead the moment the form submission hits your server: enrich the company data, pass it to a language model, get a numeric fit score plus a one-paragraph reason, and route the hot ones straight to Slack or your CRM.

This guide walks through the exact node sequence to build that workflow.

What "lead enrichment + AI scoring" actually means

Enrichment means augmenting raw form data (name, email, company) with signals your form didn't collect: company size, industry, technology stack, LinkedIn headcount, funding stage. You pull this from a data-enrichment API like Clearbit, Hunter, Apollo, or even a free option like api.brandfetch.io for basic company meta.

Scoring means taking those enriched signals and turning them into a priority rank — ideally with a short explanation so the sales rep knows why a lead scored 8/10, not just that it did.

The AI node is what makes the second step genuinely useful. A rule-based IF chain can check headcount > 50, but it can't read a company's self-description and judge whether it fits your ICP. A language model can.

The node sequence

Here is the full flow. Each step maps to a real n8n node.

Webhook  →  HTTP Request (enrich)  →  Set (shape payload)  →  AI Agent / LLM Node  →  IF (route by score)  →  Slack / CRM / Gmail

1. Webhook — catch the form submission

Add a Webhook node. Set method to POST, path to something like /lead-inbound. When you're ready to connect your form (Typeform, Tally, your own HTML form), point it at the public HTTPS URL n8n shows you. On your own n8n instance that URL looks like:

https://<your-id>.agentroost.app/webhook/lead-inbound

In test mode, hit "Listen for test event" and submit the form once to capture a sample payload. You'll use that shape downstream.

2. HTTP Request — enrich with company data

Add an HTTP Request node. For a quick free start, pull company meta from Brandfetch:

  • Method: GET
  • URL: https://api.brandfetch.io/v2/brands/{{ $json.body.company_domain }}
  • Authentication: Header Auth, key Authorization, value Bearer <your-brandfetch-key>

If you want headcount and funding you'll need Clearbit Enrichment or Apollo's /v1/organizations/enrich endpoint. The HTTP Request node handles either; just swap the URL and auth.

Tip: If the lead didn't submit a domain, use a Code node before this step to parse the email domain: return [{ json: { domain: $input.item.json.body.email.split('@')[1] } }]

3. Set — shape a clean payload for the AI node

Raw enrichment API responses are noisy. Use a Set node (or a Code node if you need conditional logic) to build a tight object:

{
  "lead_name": "Jane Doe",
  "lead_email": "[email protected]",
  "company_name": "Acme Corp",
  "industry": "Software",
  "employee_count": 120,
  "description": "Acme builds CI/CD tooling for enterprise DevOps teams.",
  "your_icp": "B2B SaaS companies, 50–500 employees, engineering-heavy"
}

Less noise means fewer tokens and a more reliable score.

4. AI Agent / LLM Node — score and summarize

This is the core step. Add the AI Agent node (or the Basic LLM Chain node if you just want a single prompt-response without tool calls).

Model: pick any model available on your instance. GPT-4o mini is a sensible default for cost-to-quality; switch to Claude Sonnet if you need richer reasoning.

System prompt:

You are a sales qualification assistant. Given a lead's profile and our ideal customer profile (ICP), return ONLY valid JSON in this shape:
{
  "score": <integer 1–10>,
  "tier": "<Hot|Warm|Cold>",
  "summary": "<2-3 sentence explanation of the score>"
}
Score 8–10 = strong ICP fit and clear buying signal. 4–7 = partial fit or missing info. 1–3 = poor fit.

User message (expression):

Lead: {{ $json.lead_name }} ({{ $json.lead_email }})
Company: {{ $json.company_name }}, {{ $json.industry }}, {{ $json.employee_count }} employees
Description: {{ $json.description }}
Our ICP: {{ $json.your_icp }}

The node returns something like:

{
  "score": 9,
  "tier": "Hot",
  "summary": "Acme is squarely in the DevOps SaaS segment with 120 employees, well within the 50–500 ICP band. Their CI/CD focus aligns directly with our integration story. High likelihood of a fast procurement cycle."
}

Parse this in a Code node (JSON.parse($input.item.json.output)) so downstream nodes can reference $json.score and $json.tier directly.

5. IF — route by tier

Add an IF node. Condition: {{ $json.tier }} equals Hot.

  • True branch: Post to Slack #hot-leads with the summary and a link to the CRM record.
  • False branch: Add to a HubSpot / Attio / Notion database for async review, or send a drip-email via Gmail.

For a three-way split (Hot / Warm / Cold) use the Switch node instead.

6. CRM write (optional but recommended)

Whether a lead is hot or cold, you probably want it in your CRM. Add a HubSpot, Attio, or HTTP Request node at the end of each branch to create/update the contact and stamp it with the score, tier, and summary fields. That way every lead is traceable even if a human never looks at the Slack message.

Tips and common pitfalls

  • Parse errors from the AI node: Language models occasionally add markdown fences around JSON. Wrap your JSON.parse in a try/catch and fall back to regex extraction if needed: JSON.parse(text.replace(/```json|```/g, '').trim()).
  • Missing enrichment data: If the enrichment API returns 404 (unknown domain), set a description fallback like "No public data found" in your Set node. The AI node will still score based on company name and email alone — just expect lower confidence, which the model will say in the summary.
  • Rate limits on enrichment APIs: If you're getting hundreds of leads per day, add a Wait node (1–2 seconds) before the enrichment call to stay inside free-tier limits on third-party APIs.
  • Test with real data: Paste a few of your actual past leads into the webhook tester and see whether the scores match your human gut. Adjust the system prompt if the model is too generous or too strict.

Run this on your own n8n instance — without an OpenAI account

The workflow above assumes you have an AI node connected to a language model. On most self-hosted n8n setups that means creating an OpenAI API key, wiring it into credentials, watching costs accumulate, and debugging auth errors when the key rotates.

On AgentRoost you skip all of that. When you launch your n8n instance, AI/LLM credits are already included in the subscription price — no API key, no separate billing dashboard, no surprise invoice at month-end. You open the AI Agent node and the model is already wired up and ready.

How to do it:

  1. Sign up at agentroost.app — email/password, Google, Microsoft, or Discord.
  2. Pick the n8n framework, give your instance a name.
  3. Your private n8n editor opens at https://<your-id>.agentroost.app. It's yours — your login, your data, your workflows.
  4. Build the webhook → enrich → AI node → route flow above. The AI nodes already have credits attached; pick any available model.
  5. Copy the webhook URL from the Webhook node and paste it into your form.

That's it. The whole flow from signup to a working scored lead in Slack takes about 20 minutes of build time. Pricing starts at $19.99/mo all-in, and there's a 14-day money-back guarantee if the workflow doesn't do what you expected.

Compare plans and get started →

What this unlocks

A scored lead pipeline isn't just a time-saver — it changes sales behavior. When the rep sees a Slack message that says "Score 9/10 — Acme Corp (120 employees, DevOps SaaS, strong ICP match) submitted a form 3 minutes ago," they pick up the phone. When they see "Score 3/10 — freelancer, 1-person shop, unrelated industry," they know to put them in the nurture sequence and move on.

The AI node earns its place here because the reasoning is readable. The rep can agree or disagree with it, which is far more useful than a black-box rule that just spits out a number.

Frequently asked questions

Do I need an OpenAI API key to use the AI node in this workflow?

Not on AgentRoost. AI/LLM credits are included in every subscription, so the AI Agent and Basic LLM Chain nodes work out of the box — no OpenAI account, no separate API key, no extra billing. If you're self-hosting n8n on your own server you will need to supply your own key.

Which enrichment API should I use?

For a quick free start, Brandfetch covers logos, industry, and basic company meta. For headcount and funding data, Clearbit Enrichment and Apollo both have free tiers for their enrichment endpoints. You hit them with n8n's HTTP Request node — just swap the URL and auth header. The AI node will do a reasonable job even with partial data; it will say so in the summary.

What if the AI node returns malformed JSON?

Language models occasionally wrap JSON in markdown fences. In the Code node that parses the output, strip fences before parsing: JSON.parse(text.replace(/```json|```/g, '').trim()). If parsing still fails, catch the error and set score: null, tier: 'Unknown' so the workflow continues and the lead still lands in your CRM.

Can I export my workflows if I want to leave AgentRoost?

Yes. Your n8n instance is your own — you own the data and workflows. n8n has a built-in export feature (Settings → Import/Export) that produces a standard JSON file you can import into any other n8n instance, including a self-hosted one you run yourself.

How much does it cost, and can I cancel?

Plans start at $19.99/mo, billed monthly, cancel anytime. There's a 14-day money-back guarantee. Higher tiers add more compute and more included AI credits. There is no free tier or long-term contract.