AI lead qualifier

AI scores each new lead and fast-tracks the hot ones to your sales team.

Advanced Saves ~8 hours/month Sales & CRMBy Flowngn team

Works with n8n · Make · Zapier

How it works

Trigger: Webhook — form posts lead data
  1. Receive name, company, budget and message from your form.
  2. Ask an AI model to score the lead 1–10 against your ideal-customer description.
  3. If the score is 7 or more, alert #sales in Slack with the reasoning.
  4. Otherwise, send a polite automated reply with helpful resources.

Diagram

truefalseNew leadWebhookScore leadBasic LLM ChainClaude modelAnthropic Chat Mo…{ }Read scoreCode⑂Score 7 or more?IfSAlert #salesSlackGSend friendly replyGmail
Trigger App Logic Code AI

Code

JavaScript used in the Code step — already included in the template below.

Read score · Code node
// 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.

Workflow JSON
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": []
}

Open in the playground to edit →

Tips

  • Ask the AI to return JSON like {"score": 8, "reason": "..."} so it's easy to use.

Related flows