cd /news/ai-agents/build-an-ai-powered-lead-qualificati… Β· home β€Ί topics β€Ί ai-agents β€Ί article
[ARTICLE Β· art-124644] src=dev.to β†— pub= topic=ai-agents verified=true sentiment=Β· neutral

Build an AI-Powered Lead Qualification Workflow with n8n

A developer has created an AI-powered lead qualification workflow using n8n, which automates the process of receiving, analyzing, and scoring leads from unstructured messages. The workflow uses a webhook to capture enquiries, an AI model to extract key details such as industry, budget, and urgency, and n8n's logic nodes to calculate a lead score and route qualified leads to sales. This approach reduces manual effort and speeds up response times.

by read7 min views3 publishedSep 9, 2026

Lead generation becomes difficult when enquiries arrive from multiple channels and someone has to manually read, qualify, copy, and assign every lead.

A simple automation can remove most of this repetitive work.

In this tutorial, we'll build an AI-powered lead qualification workflow with n8n.

The workflow will:

Receive a lead through a webhook

Extract useful information from the enquiry

Calculate a qualification score

Decide whether the lead is qualified

Prepare the lead for CRM/sales processing

Return a structured response

The architecture looks like this:

Lead Source

↓

Webhook

↓

AI / Lead Analysis

↓

Information Extraction

↓

Lead Scoring

↓

Qualified?

/ \

Yes No

↓ ↓

Sales Nurture

The advantage of this approach is that AI handles the understanding, while n8n handles the business logic.

What we'll build

Imagine a customer sends:

Hi, I'm looking for an AI chatbot for my real estate company in Dubai. We have around 500 enquiries per month and need something urgently. Our budget is around $2,000.

We want the automation to turn that unstructured message into something like:

{

"name": "Unknown",

"company": "Unknown",

"industry": "Real Estate",

"service": "AI Chatbot",

"location": "Dubai",

"budget": 2000,

"urgency": "High",

"leadScore": 90,

"qualified": true

}

The sales team doesn't need to manually interpret the original message.

Create a new workflow in n8n.

Add a Webhook node.

Configure it as:

HTTP Method: POST

Path: lead-qualification

Response Mode: Last Node

Your webhook endpoint will look similar to:

https://your-n8n-domain.com/webhook/lead-qualification

For local development, you can use the test URL generated by n8n.

You can test the webhook with cURL.

curl -X POST "https://your-n8n-domain.com/webhook/lead-qualification" \

-H "Content-Type: application/json" \

-d '{

"name": "John Smith",

"company": "Example Property Group",

"message": "We are a real estate company in Dubai looking for an AI chatbot. Our budget is around $2000 and we need it urgently."

}'

The Webhook node will now receive the lead.

Next, add a Code node.

Rename it:

Extract Lead Data

For this example, we'll use simple JavaScript to prepare the incoming data.

const lead = $json;

const name = lead.name || "";

const company = lead.company || "";

const message = lead.message || "";

return [

{

json: {

  name,

  company,

  message,

  receivedAt: new Date().toISOString()

}

}

];

This gives the rest of the workflow a predictable structure.

Now we can use an AI model to understand the customer's message.

You can use an OpenAI node or another LLM integration available in your n8n setup.

The important part is the prompt.

Use something similar to:

You are a lead qualification assistant.

Analyze the customer enquiry below.

Extract:

Return ONLY valid JSON.

Customer message:

{{ $json.message }}

A possible AI response would be:

{

"industry": "Real Estate",

"service": "AI Chatbot",

"location": "Dubai",

"budget": 2000,

"urgency": "High",

"buying_intent": "High"

}

For production systems, validate the AI response before allowing it to trigger business-critical actions.

Now we move the deterministic business logic into n8n.

Add another Code node called:

Calculate Lead Score

Example:

let score = 0;

if (lead.service) {

score += 30;

}

if (lead.budget) {

score += 20;

}

if (lead.urgency === "High") {

score += 20;

}

if (lead.location) {

score += 20;

}

if (lead.industry) {

score += 10;

}

const qualified = score >= 60;

return [

{

json: {

  ...lead,

  leadScore: score,

  qualified

}

}

];

Now the workflow has a simple rule:

Score >= 60 β†’ Qualified

Score < 60 β†’ Nurture

Add an IF node.

Configure the condition:

Value 1:

{{ $json.leadScore }}

Operation:

larger or equal

Value 2:

60

The workflow now splits into two paths.

         Lead Score
             |
      +------+------+
      |             |
   >= 60           < 60
      |             |
   Qualified       Nurture

For qualified leads, you could connect the workflow to your CRM.

For example:

Qualified Lead

  ↓

CRM

  ↓

Sales Notification

  ↓

Calendar / Follow-Up

You could create a CRM record containing:

{

"name": "John Smith",

"company": "Example Property Group",

"industry": "Real Estate",

"service": "AI Chatbot",

"location": "Dubai",

"leadScore": 90,

"status": "Qualified"

}

You can then notify the sales team through email, Slack, Microsoft Teams, WhatsApp or another communication channel.

Not every lead should immediately go to sales.

For lower-scoring leads, create a nurture path.

Unqualified Lead

  ↓

CRM

  ↓

Nurture Sequence

  ↓

Follow-Up

For example, the lead could receive useful information first and be followed up later.

This prevents salespeople from spending their time manually chasing every enquiry.

Finally, return the result to the system that sent the lead.

{

"success": true,

"leadScore": 90,

"qualified": true,

"message": "Lead successfully qualified"

}

Now another application can immediately know whether the lead was accepted.

The final workflow can look like this:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ Lead Source β”‚

β”‚ Website/WhatsApp β”‚

β”‚ Form/API β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

     ↓

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ Webhook β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

     ↓

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ Extract Data β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

     ↓

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ AI Analysis β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

     ↓

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ Lead Scoring β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

     ↓

β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”

↓         ↓

Score β‰₯60 Score <60

↓         ↓

Qualified Nurture

↓         ↓

CRM CRM

↓         ↓

Sales Follow-up

Alert

Complete scoring code

Here's the complete scoring logic again so you can copy it directly into an n8n Code node:

return [

{

json: {

  ...lead,

  leadScore: score,

  qualified: score >= 60

}

}

];

Why separate AI from business logic?

This is one of the most important design decisions in the workflow.

You could ask the AI:

"Is this lead qualified?"

But I wouldn't let an LLM make every business decision directly.

Instead:

AI

↓

Understand the message

↓

Extract structured information

↓

n8n

↓

Apply deterministic rules

↓

CRM / Sales / Follow-up

This makes the workflow easier to test and debug.

If your qualification criteria change, you can modify the n8n scoring logic without changing the AI prompt.

Adding WhatsApp

The same architecture can be connected to WhatsApp.

WhatsApp Message

   ↓

WhatsApp API

   ↓

n8n Webhook

   ↓

AI Analysis

   ↓

Lead Qualification

   ↓

CRM

   ↓

Sales Team

A customer could simply write:

"I need a website for my construction company. Can someone contact me tomorrow?"

The AI extracts the relevant information and n8n handles the rest.

Adding a CRM

The next step is connecting the workflow to your CRM.

Depending on the CRM you're using, you can create or update a contact automatically.

The workflow could check whether the lead already exists before creating a new record.

New Lead

↓

Search CRM

↓

Existing?

/ \

Yes No

| |

Update Create

\ /

\    /

Continue

This is important because duplicate lead records can create problems for sales teams.

Production improvements

The example above is intentionally simple.

For a production workflow, I'd add:

Never blindly trust an AI response.

Validate:

Required fields

Data types

Allowed values

Score ranges

JSON structure

If the AI API fails, the workflow should not silently lose the lead.

Store the original enquiry and retry or send it for manual review.

Check whether the email address, phone number or customer ID already exists.

Some conversations should always go to a human.

High-value lead

  ↓

Salesperson

Store important workflow events so you can understand what happened when something goes wrong.

Final architecture

A more complete production architecture could look like:

Website

WhatsApp

Facebook

Forms

β”‚

β–Ό

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ n8n β”‚

β”‚ Webhook β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜

    ↓

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ AI Extraction β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜

    ↓

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”

β”‚ Lead Scoring β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜

    ↓

β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”

↓ ↓

Qualified Nurture

↓ ↓

CRM CRM

↓ ↓

Sales Follow-up

The important concept is that AI doesn't need to control the entire workflow.

Use AI where understanding language is difficult.

Use deterministic automation where the rules are known.

That combination gives you a system that is both flexible and predictable.

Conclusion

n8n makes it possible to build sophisticated lead-generation workflows without creating an entire automation backend from scratch.

By combining:

n8n for orchestration

AI for understanding customer messages

CRM for lead management

Webhooks/APIs for integrations

Notifications for sales teams

Automated follow-ups for nurturing

you can turn a simple enquiry into an organized sales process.

The best place to start isn't with the most complicated workflow.

Start with one bottleneck:

slow response, manual qualification, scattered lead data, or forgotten follow-ups.

Automate that process, measure the result, and expand from there.

You can also explore more AI automation solutions at Aiotagen.

── more in #ai-agents 4 stories Β· sorted by recency
── more on @n8n 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/build-an-ai-powered-…] indexed:0 read:7min 2026-09-09 Β· β€”