{
  "id": "sxn2JK2kAGItRWSW",
  "name": "AI Lead Qualification Agent: Auto-Score, Route and Reply with Claude",
  "tags": [],
  "nodes": [
    {
      "id": "20f5be09-5982-413f-b17b-8f4018d641a0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1664,
        272
      ],
      "parameters": {
        "color": 0,
        "width": 460,
        "height": 1044,
        "content": "## AI Lead Qualification Agent: Auto-Score, Route and Reply with Claude\n\nStop wasting time on leads that will never convert. This workflow reads every inbound form submission, uses Claude AI to score the lead 1-10 against your ideal customer profile, and automatically takes the right action \u2014 all without you lifting a finger.\n\n### How it works\n\n1. A lead submits your n8n Form (or any connected form tool).\n2. Claude AI reads the submission and assigns a score from 1 to 10 based on fit, intent, and company size.\n3. Hot leads (score 7-10) get an instant personalised reply email and a Slack alert to your team.\n4. Warm leads (score 4-6) get a softer reply and are added to a follow-up sequence.\n5. Cold leads (score 1-3) receive a polite decline email.\n6. Every lead \u2014 regardless of score \u2014 is logged to Google Sheets with the score and reasoning.\n\n### Setup steps\n\n- [ ] **n8n Form** \u2014 The form is built into this workflow. Copy the form URL from the Form Trigger node and embed or share it as your contact form.\n- [ ] **Claude AI** \u2014 Click the Claude Sonnet sub-node under Score Lead Intent, add a new Anthropic credential, and paste your API key from console.anthropic.com.\n- [ ] **Gmail** \u2014 Connect your Gmail account in the three email nodes: Hot Lead Reply, Warm Lead Reply, and Cold Lead Reply.\n- [ ] **Slack** \u2014 Connect your Slack account in Notify Team - Hot Lead and select your channel (e.g. sales-leads). Right-click and Disable this node if you do not use Slack.\n- [ ] **Google Sheets** \u2014 Create a sheet with headers: Timestamp, Name, Email, Company, Message, Score, Tier, Reasoning. Connect your Google account in Log Lead to Sheets.\n- [ ] Update the AI scoring prompt inside Score Lead Intent to describe your ideal customer profile.\n- [ ] Activate the workflow and submit a test form entry to verify all three branches work.\n\n### Customization\n\nAdjust the hot/warm/cold score thresholds in the Route by Score node to match your standards. Swap Claude Sonnet for Claude Haiku to reduce API costs if volume is high."
      },
      "typeVersion": 1
    },
    {
      "id": "9ad58882-eb25-4693-8e58-573b84309ec7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1136,
        288
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 320,
        "content": "## Capture inbound lead\n\nAn n8n Form collects the lead's name, email, company, and message. No third-party form tool needed \u2014 the URL is generated automatically when you activate the workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "21fed022-5d1e-42d7-bf04-3fea1a5bba09",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        288
      ],
      "parameters": {
        "color": 7,
        "width": 376,
        "height": 340,
        "content": "## Score lead with Claude AI\n\nClaude Sonnet reads the submission and returns a score (1-10) plus a one-line reasoning. Edit the system prompt in this node to describe your ideal customer so Claude scores against your actual criteria."
      },
      "typeVersion": 1
    },
    {
      "id": "eb407925-c97e-43d6-a829-4e9ab7695935",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        288
      ],
      "parameters": {
        "color": 7,
        "width": 280,
        "height": 336,
        "content": "## Route by score\n\nSplits leads into three tiers: Hot (7-10), Warm (4-6), and Cold (1-3). Each tier triggers a different set of actions below."
      },
      "typeVersion": 1
    },
    {
      "id": "0919a0a9-4c98-4039-b51a-51694d1cd381",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 580,
        "height": 324,
        "content": "## Hot lead branch (score 7-10)\n\nThis lead matches your ideal profile. Sends an instant personalised reply email, fires a Slack alert to your team, and logs everything to Google Sheets.\n\nSlack is optional \u2014 right-click the Notify Team node and Disable if unused."
      },
      "typeVersion": 1
    },
    {
      "id": "c4974033-8ae1-4786-ba47-124d236c4bec",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        304
      ],
      "parameters": {
        "color": 7,
        "width": 520,
        "height": 288,
        "content": "## Warm lead branch (score 4-6)\n\nPromising but not yet a clear fit. Sends a friendly holding reply that sets expectations, then logs to Google Sheets for manual follow-up."
      },
      "typeVersion": 1
    },
    {
      "id": "6bf12966-4199-4013-8355-b743714c2af2",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        640
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 288,
        "content": "## Cold lead branch (score 1-3)\n\nNot a fit right now. Sends a short, respectful decline email so the lead gets a response and your inbox stays clean. Logged to Sheets for records."
      },
      "typeVersion": 1
    },
    {
      "id": "5225fb09-2be8-4624-a795-ce388030e70b",
      "name": "Inbound Lead Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1104,
        464
      ],
      "parameters": {
        "options": {},
        "formTitle": "Get in Touch",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Full Name",
              "requiredField": true
            },
            {
              "fieldType": "email",
              "fieldLabel": "Work Email",
              "requiredField": true
            },
            {
              "fieldLabel": "Company Name",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Company Size",
              "fieldOptions": {
                "values": [
                  {
                    "option": "1-10"
                  },
                  {
                    "option": "11-50"
                  },
                  {
                    "option": "51-200"
                  },
                  {
                    "option": "201-500"
                  },
                  {
                    "option": "500+"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "How can we help you?",
              "requiredField": true
            }
          ]
        },
        "responseMode": "lastNode",
        "formDescription": "Tell us a bit about yourself and what you are looking for."
      },
      "typeVersion": 2.2
    },
    {
      "id": "ebe73dee-7b41-42ad-b870-df223a7eb5c8",
      "name": "Extract Lead Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -912,
        464
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "74be8873-fd3d-4425-b6f8-799327857ec5",
              "name": "lead_name",
              "type": "string",
              "value": "={{ $json['Full Name'] }}"
            },
            {
              "id": "a8cb2b83-4bab-4837-b12a-25b384f9f1ab",
              "name": "lead_email",
              "type": "string",
              "value": "={{ $json['Work Email'] }}"
            },
            {
              "id": "4047f326-dfc5-41d3-b2b8-032b7ad257dd",
              "name": "lead_company",
              "type": "string",
              "value": "={{ $json['Company Name'] }}"
            },
            {
              "id": "3fe76b8a-35f0-4b6b-8611-8d51f54f6207",
              "name": "company_size",
              "type": "string",
              "value": "={{ $json['Company Size'] }}"
            },
            {
              "id": "229be5db-eec8-457c-bde6-2cb4d5f17783",
              "name": "lead_message",
              "type": "string",
              "value": "={{ $json['How can we help you?'] }}"
            },
            {
              "id": "1df7d545-899b-4f24-80a1-c59392c635ef",
              "name": "timestamp",
              "type": "string",
              "value": "={{ new Date().toISOString() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b1b61168-865f-470f-9fa7-a71aaaddf150",
      "name": "Score Lead Intent",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -704,
        512
      ],
      "parameters": {
        "text": "=You are a B2B lead qualification specialist. Score the following inbound lead from 1 to 10 based on how well they fit the ideal customer profile below.\n\nIDEAL CUSTOMER PROFILE:\n- Small to mid-size businesses (1-200 employees)\n- Looking for AI automation, workflow automation, or sales automation\n- Has a clear problem or goal mentioned\n- Decision maker or senior role\n\nLEAD DETAILS:\nName: {{ $json.lead_name }}\nCompany: {{ $json.lead_company }}\nCompany Size: {{ $json.company_size }}\nMessage: {{ $json.lead_message }}\n\nRespond ONLY with valid JSON in this exact format, nothing else:\n{\"score\": 8, \"tier\": \"Hot\", \"reasoning\": \"One sentence explaining the score\"}\n\nScore guide: 7-10 = Hot, 4-6 = Warm, 1-3 = Cold",
        "promptType": "define"
      },
      "typeVersion": 1.4
    },
    {
      "id": "42e4a687-a856-48b9-a000-94126f3e68b7",
      "name": "Claude Sonnet",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        -624,
        752
      ],
      "parameters": {
        "model": "claude-sonnet-4-5",
        "options": {
          "temperature": 0
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "8415f205-6985-4684-8200-ac9fc6dfb99c",
      "name": "Parse Score",
      "type": "n8n-nodes-base.code",
      "position": [
        -448,
        448
      ],
      "parameters": {
        "jsCode": "const text = $input.first().json.text || '';\nlet parsed = { score: 5, tier: 'Warm', reasoning: 'Could not parse AI response' };\ntry {\n  const match = text.match(/\\{[^}]+\\}/);\n  if (match) parsed = JSON.parse(match[0]);\n} catch(e) {}\nconst item = $('Extract Lead Fields').first().json;\nreturn {\n  json: {\n    lead_name:    item.lead_name,\n    lead_email:   item.lead_email,\n    lead_company: item.lead_company,\n    company_size: item.company_size,\n    lead_message: item.lead_message,\n    timestamp:    item.timestamp,\n    score:        parsed.score,\n    tier:         parsed.tier,\n    reasoning:    parsed.reasoning\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "1b6b0c48-f7c7-4b6d-923a-ea2535059169",
      "name": "Route by Score",
      "type": "n8n-nodes-base.switch",
      "position": [
        -208,
        432
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Hot",
              "conditions": {
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "number",
                      "operation": "gte"
                    },
                    "leftValue": "={{ $json.score }}",
                    "rightValue": 7
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Warm",
              "conditions": {
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "number",
                      "operation": "gte"
                    },
                    "leftValue": "={{ $json.score }}",
                    "rightValue": 4
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Cold",
              "conditions": {
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "number",
                      "operation": "gte"
                    },
                    "leftValue": "={{ $json.score }}",
                    "rightValue": 1
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "837f148c-175a-47ff-8c9a-88a317faa7df",
      "name": "Notify Team - Hot Lead",
      "type": "n8n-nodes-base.slack",
      "position": [
        48,
        112
      ],
      "parameters": {
        "text": "Hot lead just came in!\n\nName: {{ $json.lead_name }}\nCompany: {{ $json.lead_company }} ({{ $json.company_size }} employees)\nEmail: {{ $json.lead_email }}\nScore: {{ $json.score }}/10\nReason: {{ $json.reasoning }}\n\nMessage: {{ $json.lead_message }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "#sales-leads"
        },
        "otherOptions": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "1edd5efe-eb25-44c9-a303-c75942319314",
      "name": "Hot Lead Reply",
      "type": "n8n-nodes-base.gmail",
      "position": [
        224,
        112
      ],
      "parameters": {
        "sendTo": "={{ $json.lead_email }}",
        "message": "Hi {{ $json.lead_name }},\n\nThanks for reaching out \u2014 this is exactly the kind of challenge we love solving.\n\nBased on what you have shared, I think there is a real opportunity here. I would love to jump on a quick call to learn more about your situation and show you what is possible.\n\nYou can book a time that works for you here: YOUR_CALENDAR_LINK\n\nLooking forward to connecting.\n\nBest,\n[Your Name]\n[Your Company]",
        "options": {},
        "subject": "Re: Your enquiry \u2014 lets find a time to talk",
        "emailType": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "842179fe-966f-4d9f-8aa1-02f0b4273cfe",
      "name": "Log to Sheets - Hot",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        432,
        112
      ],
      "parameters": {
        "columns": {
          "value": {
            "Name": "={{ $json.lead_name }}",
            "Size": "={{ $json.company_size }}",
            "Tier": "Hot",
            "Email": "={{ $json.lead_email }}",
            "Score": "={{ $json.score }}",
            "Company": "={{ $json.lead_company }}",
            "Message": "={{ $json.lead_message }}",
            "Reasoning": "={{ $json.reasoning }}",
            "Timestamp": "={{ $json.timestamp }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "4ad5a420-3ce7-40aa-89ec-576293daa3a5",
      "name": "Warm Lead Reply",
      "type": "n8n-nodes-base.gmail",
      "position": [
        48,
        432
      ],
      "parameters": {
        "sendTo": "={{ $json.lead_email }}",
        "message": "Hi {{ $json.lead_name }},\n\nThank you for getting in touch \u2014 great to hear from you.\n\nI have had a look at what you have shared and I would love to learn a bit more before we set up a call. Could you tell me a little more about the current challenge you are trying to solve and what a good outcome would look like for you?\n\nLooking forward to your reply.\n\nBest,\n[Your Name]\n[Your Company]",
        "options": {},
        "subject": "Re: Your enquiry",
        "emailType": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "72b21d17-ca1e-417c-99bc-f533775eea6c",
      "name": "Log to Sheets - Warm",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        272,
        432
      ],
      "parameters": {
        "columns": {
          "value": {
            "Name": "={{ $json.lead_name }}",
            "Size": "={{ $json.company_size }}",
            "Tier": "Warm",
            "Email": "={{ $json.lead_email }}",
            "Score": "={{ $json.score }}",
            "Company": "={{ $json.lead_company }}",
            "Message": "={{ $json.lead_message }}",
            "Reasoning": "={{ $json.reasoning }}",
            "Timestamp": "={{ $json.timestamp }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "468079d6-4046-4bda-9920-3b945d55edb7",
      "name": "Cold Lead Reply",
      "type": "n8n-nodes-base.gmail",
      "position": [
        64,
        784
      ],
      "parameters": {
        "sendTo": "={{ $json.lead_email }}",
        "message": "Hi {{ $json.lead_name }},\n\nThank you for reaching out and taking the time to get in touch.\n\nAfter reviewing your enquiry, I do not think we are the right fit for where you are right now \u2014 but I appreciate you considering us and wish you all the best in finding the right solution.\n\nIf things change down the line, do not hesitate to reach back out.\n\nAll the best,\n[Your Name]\n[Your Company]",
        "options": {},
        "subject": "Re: Your enquiry",
        "emailType": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "42b56060-5a1c-4cd1-8cec-fa384165b351",
      "name": "Log to Sheets - Cold",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        288,
        784
      ],
      "parameters": {
        "columns": {
          "value": {
            "Name": "={{ $json.lead_name }}",
            "Size": "={{ $json.company_size }}",
            "Tier": "Cold",
            "Email": "={{ $json.lead_email }}",
            "Score": "={{ $json.score }}",
            "Company": "={{ $json.lead_company }}",
            "Message": "={{ $json.lead_message }}",
            "Reasoning": "={{ $json.reasoning }}",
            "Timestamp": "={{ $json.timestamp }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "1fefc03f-d6ae-44ae-bdef-83b45ec0b79f",
  "connections": {
    "Parse Score": {
      "main": [
        [
          {
            "node": "Route by Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude Sonnet": {
      "ai_languageModel": [
        [
          {
            "node": "Score Lead Intent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Hot Lead Reply": {
      "main": [
        [
          {
            "node": "Log to Sheets - Hot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Score": {
      "main": [
        [
          {
            "node": "Notify Team - Hot Lead",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Warm Lead Reply",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Cold Lead Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cold Lead Reply": {
      "main": [
        [
          {
            "node": "Log to Sheets - Cold",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Warm Lead Reply": {
      "main": [
        [
          {
            "node": "Log to Sheets - Warm",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Inbound Lead Form": {
      "main": [
        [
          {
            "node": "Extract Lead Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Score Lead Intent": {
      "main": [
        [
          {
            "node": "Parse Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Lead Fields": {
      "main": [
        [
          {
            "node": "Score Lead Intent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Team - Hot Lead": {
      "main": [
        [
          {
            "node": "Hot Lead Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}