AI lead qualifier
AI scores each new lead and fast-tracks the hot ones to your sales team.
How it works
- Receive name, company, budget and message from your form.
- Ask an AI model to score the lead 1–10 against your ideal-customer description.
- If the score is 7 or more, alert #sales in Slack with the reasoning.
- Otherwise, send a polite automated reply with helpful resources.
Diagram
Code
JavaScript used in the Code step — already included in the template below.
// Mode: Run Once for Each Item
// The AI was asked to answer with JSON like {"score": 8, "reason": "..."}.
const match = $json.text.match(/\{[\s\S]*\}/);
const result = match ? JSON.parse(match[0]) : { score: 0, reason: "Could not read AI answer" };
const lead = $("New lead").item.json.body;
return {
json: {
...lead,
score: Number(result.score),
reason: result.reason,
},
};Build it
Pick your tool — same automation, step by step.
Copy and paste straight into an n8n canvas (Ctrl+V), or download and use Import from File. Then connect your own credentials and replace every YOUR_… placeholder. AI steps use a Claude model node — swap it for OpenAI, Gemini or Ollama if you prefer.
Show code (225 lines)
{
"name": "AI lead qualifier (Flowngn)",
"nodes": [
{
"parameters": {
"content": "## AI lead qualifier\nAI scores each new lead and fast-tracks the hot ones to your sales team.\n\n**Setup**\n1. Open each node and connect your own credentials.\n2. Replace every YOUR_… placeholder.\n3. Test once, then activate.\n\nFree template from Flowngn",
"height": 260,
"width": 340
},
"id": "292cf932-28a7-42d8-aca3-5a1f662fbc81",
"name": "Setup notes",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-420,
-60
]
},
{
"parameters": {
"httpMethod": "POST",
"path": "new-lead",
"options": {}
},
"id": "292cf932-28a7-42d8-aca3-5a1f662fbc81",
"name": "New lead",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
0,
0
],
"webhookId": "292cf932-28a7-42d8-aca3-5a1f662fbc81"
},
{
"parameters": {
"promptType": "define",
"text": "=You qualify B2B leads for our company. Our ideal customer: YOUR_IDEAL_CUSTOMER_DESCRIPTION.\n\nLead:\n{{ JSON.stringify($json.body, null, 2) }}\n\nReply ONLY with JSON: {\"score\": <1-10>, \"reason\": \"<one sentence>\"}"
},
"id": "292cf932-28a7-42d8-aca3-5a1f662fbc81",
"name": "Score lead",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"typeVersion": 1.5,
"position": [
300,
0
]
},
{
"parameters": {
"model": {
"__rl": true,
"value": "claude-sonnet-5",
"mode": "list"
},
"options": {}
},
"id": "292cf932-28a7-42d8-aca3-5a1f662fbc81",
"name": "Claude model",
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"typeVersion": 1.3,
"position": [
300,
220
]
},
{
"parameters": {
"jsCode": "// Mode: Run Once for Each Item\n// The AI was asked to answer with JSON like {\"score\": 8, \"reason\": \"...\"}.\nconst match = $json.text.match(/\\{[\\s\\S]*\\}/);\nconst result = match ? JSON.parse(match[0]) : { score: 0, reason: \"Could not read AI answer\" };\nconst lead = $(\"New lead\").item.json.body;\n\nreturn {\n json: {\n ...lead,\n score: Number(result.score),\n reason: result.reason,\n },\n};",
"mode": "runOnceForEachItem"
},
"id": "292cf932-28a7-42d8-aca3-5a1f662fbc81",
"name": "Read score",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
600,
0
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "loose"
},
"conditions": [
{
"id": "c1",
"leftValue": "={{ $json.score }}",
"rightValue": 7,
"operator": {
"type": "number",
"operation": "gte"
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "292cf932-28a7-42d8-aca3-5a1f662fbc81",
"name": "Score 7 or more?",
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
900,
0
]
},
{
"parameters": {
"select": "channel",
"channelId": {
"__rl": true,
"value": "#sales",
"mode": "name"
},
"text": "=🔥 Hot lead ({{ $json.score }}/10): {{ $json.name }} — {{ $json.company }}\n{{ $json.reason }}\n{{ $json.email }}",
"otherOptions": {}
},
"id": "292cf932-28a7-42d8-aca3-5a1f662fbc81",
"name": "Alert #sales",
"type": "n8n-nodes-base.slack",
"typeVersion": 2.2,
"position": [
1200,
0
]
},
{
"parameters": {
"sendTo": "={{ $json.email }}",
"subject": "Thanks for reaching out!",
"emailType": "text",
"message": "=Hi {{ $json.name }},\n\nThanks for your message! Here are some resources that might help while we get back to you: YOUR_RESOURCES_LINK\n\nBest,\nYOUR_NAME",
"options": {
"appendAttribution": false
}
},
"id": "292cf932-28a7-42d8-aca3-5a1f662fbc81",
"name": "Send friendly reply",
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.1,
"position": [
1200,
220
]
}
],
"connections": {
"New lead": {
"main": [
[
{
"node": "Score lead",
"type": "main",
"index": 0
}
]
]
},
"Score lead": {
"main": [
[
{
"node": "Read score",
"type": "main",
"index": 0
}
]
]
},
"Read score": {
"main": [
[
{
"node": "Score 7 or more?",
"type": "main",
"index": 0
}
]
]
},
"Score 7 or more?": {
"main": [
[
{
"node": "Alert #sales",
"type": "main",
"index": 0
}
],
[
{
"node": "Send friendly reply",
"type": "main",
"index": 0
}
]
]
},
"Claude model": {
"ai_languageModel": [
[
{
"node": "Score lead",
"type": "ai_languageModel",
"index": 0
}
]
]
}
},
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"meta": {
"templateCredsSetupCompleted": false
},
"tags": []
}In Make, create a new scenario and add these modules in order:
- Webhooks › Custom webhook
- Anthropic Claude › Create a Prompt (or OpenAI › Create a Completion)
- Tools › Set variable / Iterator + Array aggregator (same logic as the Code step)
- Router with two routes: “Score 7 or more?” (yes / no filters)
- If yesSlack › Create a Message
- If noGmail › Send an Email
- Every module run uses Make operations — the free plan includes a monthly quota.
- Make's built-in functions (map, sum, formatDate…) can replace most Code steps; for complex logic use a code module.
- Module and step names can differ slightly as Make and Zapier update their apps.
In Zapier, create a new Zap and add these steps in order:
- Webhooks by Zapier — Catch Hook
- Anthropic (Claude) — Send Message (or ChatGPT — Conversation)
- Code by Zapier — Run JavaScript (paste the code from the Code section)
- Paths by Zapier: “Score 7 or more?” (yes / no)
- If yesSlack — Send Channel Message
- If noGmail — Send Email
- Zaps with more than two steps need a paid Zapier plan.
- Webhooks, Filters/Paths and Code by Zapier are premium features on some Zapier plans.
- Code by Zapier runs JavaScript: reuse the code shown above, reading inputs from inputData instead of $json.
- Module and step names can differ slightly as Make and Zapier update their apps.
Tips
- Ask the AI to return JSON like {"score": 8, "reason": "..."} so it's easy to use.
Related flows
AI spam filter for contact forms
AI checks every form message and only real inquiries reach your team.
Automatic meeting prep brief
When a meeting is booked, get a short AI brief about the company you're meeting.
Contact form → Airtable + instant auto-reply
Website messages are saved in Airtable and the sender gets an instant confirmation.