{
  "id": "CKcKFoEOfPQBPjxI",
  "name": "Lead Qualification & Routing Engine",
  "tags": [],
  "nodes": [
    {
      "id": "a7fe2e16-0890-4732-8466-9cd08b12acc7",
      "name": "Lead Intake Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1328,
        320
      ],
      "parameters": {
        "path": "lead-intake",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "5faded1e-4091-4a33-8acb-670c7af221a9",
      "name": "Acknowledge Receipt",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -1104,
        320
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ { \"success\": true, \"message\": \"Lead received and processing\", \"leadId\": $json.leadId } }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "656cff0b-a058-4fdb-8fd1-da3deb7a0b24",
      "name": "Enrich Lead Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -880,
        320
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "lead-id",
              "name": "leadId",
              "type": "string",
              "value": "={{ $now.format('yyyyMMddHHmmss') }}-{{ $json.email.split('@')[0] }}"
            },
            {
              "id": "timestamp",
              "name": "timestamp",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            },
            {
              "id": "source",
              "name": "source",
              "type": "string",
              "value": "={{ $json.source || 'website' }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3d6667f0-8a10-43eb-b6e2-015e7961ac6c",
      "name": "AI Lead Qualification",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -1040,
        640
      ],
      "parameters": {
        "text": "=Analyze this lead and provide a qualification score:\n\nName: {{ $json.name }}\nEmail: {{ $json.email }}\nCompany: {{ $json.company }}\nMessage: {{ $json.message }}\nBudget: {{ $json.budget }}\nTimeline: {{ $json.timeline }}",
        "batching": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "521d3066-5891-4543-b9a2-d86a0b1c9440",
      "name": "Parse AI Response",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -832,
        880
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"score\": {\n      \"type\": \"integer\",\n      \"description\": \"Lead qualification score from 0-100\"\n    },\n    \"category\": {\n      \"type\": \"string\",\n      \"enum\": [\"hot\", \"warm\", \"cold\"],\n      \"description\": \"Lead temperature category\"\n    },\n    \"reasoning\": {\n      \"type\": \"string\",\n      \"description\": \"Brief explanation of the score\"\n    },\n    \"recommended_action\": {\n      \"type\": \"string\",\n      \"description\": \"Suggested next step\"\n    },\n    \"key_strengths\": {\n      \"type\": \"array\",\n      \"items\": { \"type\": \"string\" },\n      \"description\": \"Top 3 positive indicators\"\n    },\n    \"concerns\": {\n      \"type\": \"array\",\n      \"items\": { \"type\": \"string\" },\n      \"description\": \"Potential red flags or concerns\"\n    }\n  },\n  \"required\": [\"score\", \"category\", \"reasoning\", \"recommended_action\"]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "437b5f85-504a-4d3a-83e1-d1a757df6333",
      "name": "OpenAI Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1104,
        880
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ab747fea-dafa-42f9-a9b3-484023977da7",
      "name": "Route by Quality",
      "type": "n8n-nodes-base.if",
      "position": [
        -512,
        384
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "hot-lead",
              "operator": {
                "name": "filter.operator.larger",
                "type": "number",
                "operation": "larger"
              },
              "leftValue": "={{ $json.output.score }}",
              "rightValue": "70"
            },
            {
              "id": "79621b78-52b5-4b32-a28b-c64dc84958f4",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "bc9abb67-6fa7-4cbe-955f-b90c6af29d68",
      "name": "Save to Airtable (Hot Leads)",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -128,
        528
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_AIRTABLE_BASE_ID"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_AIRTABLE_TABLE_ID"
        },
        "operation": "append"
      },
      "typeVersion": 2.1
    },
    {
      "id": "8ab50b21-c1c1-44f4-a73d-c3b3f867b191",
      "name": "Save to Airtable (Nurture Queue)",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -512,
        592
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_AIRTABLE_BASE_ID"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_AIRTABLE_TABLE_ID"
        },
        "operation": "append"
      },
      "typeVersion": 2.1
    },
    {
      "id": "8bed314d-059d-44b3-b618-3dd290507c26",
      "name": "Alert Team (Slack)",
      "type": "n8n-nodes-base.slack",
      "position": [
        96,
        336
      ],
      "parameters": {
        "operation": "send"
      },
      "typeVersion": 2.2
    },
    {
      "id": "dc041629-b53a-41b8-ad97-787bf8196403",
      "name": "Send Confirmation Email (Hot)",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        96,
        640
      ],
      "parameters": {
        "options": {},
        "subject": "Thank you for your inquiry - We'll be in touch soon!",
        "toEmail": "={{ $('Lead Intake Webhook').item.json.email }}",
        "fromEmail": "user@example.com"
      },
      "typeVersion": 2.1
    },
    {
      "id": "07f3821f-7d75-480d-819c-1cdb07b22f9c",
      "name": "Send Nurture Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -512,
        816
      ],
      "parameters": {
        "options": {},
        "subject": "Thank you for contacting us",
        "toEmail": "={{ $('Lead Intake Webhook').item.json.email }}",
        "fromEmail": "user@example.com"
      },
      "typeVersion": 2.1
    },
    {
      "id": "27b73032-cfcc-451e-bb09-69550e252211",
      "name": "Note: Intake",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1440,
        80
      ],
      "parameters": {
        "color": 4,
        "width": 784,
        "height": 424,
        "content": "## \ud83c\udfaf Lead Intake\nCaptures leads from any source:\n- Website forms\n- Landing pages\n- API integrations\n- Manual entry tools"
      },
      "typeVersion": 1
    },
    {
      "id": "0e5438ef-5393-49f0-b440-a19900c0a283",
      "name": "Note: Smart Routing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -656,
        80
      ],
      "parameters": {
        "color": 6,
        "width": 432,
        "height": 968,
        "content": "## \ud83d\udd00 Intelligent Routing\nAutomatic lead distribution:\n- Hot Leads (70+) \u2192 Sales Team\n- Warm/Cold \u2192 Nurture Campaign\n### No manual sorting needed!"
      },
      "typeVersion": 1
    },
    {
      "id": "ec12b993-5bd3-448d-9ead-570dfd08f0a1",
      "name": "Note: Actions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        80
      ],
      "parameters": {
        "color": 7,
        "width": 572,
        "height": 968,
        "content": "## \ud83d\udcbe Data & Notifications\nAutomatic actions:\n- Save to Airtable\n- Slack alerts for hot leads\n- Personalized email responses\n- CRM updates (ready to add)"
      },
      "typeVersion": 1
    },
    {
      "id": "bddca7d5-04a2-497d-98f0-861822adbe15",
      "name": "Note: AI Analysis1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1440,
        512
      ],
      "parameters": {
        "color": 5,
        "width": 788,
        "height": 536,
        "content": "#   \n## \ud83e\udd16 AI-Powered Qualification\nOpenAI analyzes each lead for:\n- Budget fit\n- Timeline urgency\n- Project complexity\n- Quality indicators\n### Outputs structured score + insights"
      },
      "typeVersion": 1
    },
    {
      "id": "04a5ac3e-87d3-4d6c-8b31-ac624797b3b7",
      "name": "Note: Intake1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2288,
        80
      ],
      "parameters": {
        "color": 3,
        "width": 768,
        "height": 1976,
        "content": "# **AI Lead Qualifier & Router**\n\nAn intelligent lead management system that automatically captures incoming leads via webhook, uses AI to analyze and score each prospect, then routes them to the appropriate team or campaign based on qualification score\u2014delivering hot leads to sales instantly while nurturing others on autopilot.\n\n## **What It Does**\n\nThis workflow eliminates the manual process of:\n\n\u2022 Daily lead review and qualification\n\u2022 Manual scoring and prioritization\n\u2022 Lead assignment and routing decisions\n\u2022 Follow-up email composition\n\u2022 CRM data entry and updates\n\u2022 Sales team notifications for hot prospects\n\nInstead, it delivers **qualified, routed leads with AI insights in under 30 seconds**\u2014complete with structured scoring, personalized responses, and organized data storage for tracking.\n\n## **Key Features**\n\n\u2022 **Webhook Lead Capture** - Accepts leads from any source (forms, landing pages, APIs)\n\u2022 **AI-Powered Qualification** - Analyzes budget, timeline, message quality, and fit using OpenAI\n\u2022 **Structured Scoring** - Generates 0-100 scores with reasoning, strengths, and concerns\n\u2022 **Intelligent Routing** - Automatically directs hot leads (70+) to sales, others to nurture\n\u2022 **Instant Notifications** - Slack alerts for high-priority prospects with full context\n\u2022 **Dual Email Flows** - Personalized responses based on lead quality and urgency\n\u2022 **Airtable Storage** - Organized tracking with qualification data and timestamps\n\n## **Who It's For**\n\nMarketing agencies, SaaS companies, and service businesses that need to process high volumes of inbound leads efficiently\u2014without sacrificing lead quality or response time. Perfect for teams tired of manual qualification bottlenecks.\n\n## **Time Saved**\n\nFrom **5+ minutes of manual review per lead** \u2192 **automated processing in 20-30 seconds** per lead.\n\n## **Workflow Breakdown**\n\n**Capture \u2192 Enrich \u2192 Qualify \u2192 Route \u2192 Store & Notify**\n\nEach stage runs automatically, analyzing leads with AI and delivering organized results to your sales team via Slack and Airtable, with zero manual intervention required.\n\n---\n\n## **\ud83d\udd27 SETUP INSTRUCTIONS**\n\n### **Required Credentials:**\n\n1. **OpenAI API** - For AI-powered lead qualification\n2. **Airtable** - For lead storage and tracking database\n3. **Slack** - For real-time team notifications\n4. **Email Service** - For automated confirmation/nurture emails (SMTP or provider)\n\n### **Configuration Steps:**\n\n1. Replace `YOUR_AIRTABLE_BASE_ID` and `YOUR_AIRTABLE_TABLE_ID` in both Airtable nodes\n2. Configure Airtable field mapping to match your base structure\n3. Set up Slack channel and message formatting in \"Alert Team\" node\n4. Update email addresses in both email nodes (`leads@youragency.com`)\n5. Customize AI qualification prompt based on your business criteria\n6. Adjust qualification threshold (currently 70+) in \"Route by Quality\" node\n7. Test with a single lead before enabling webhook publicly\n\n### **Alternative Approaches:**\n\n\u2022 Can use HubSpot or Salesforce instead of Airtable for CRM integration\n\u2022 Can use Microsoft Teams instead of Slack for notifications\n\u2022 Can add SMS alerts for ultra-hot leads using Twilio\n\u2022 Can implement multi-tier routing (hot/warm/cold) with additional IF nodes\n\u2022 Can add calendar booking links for hot leads automatically"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e2984c20-f71f-4c0a-b36a-6676f406ac62",
  "connections": {
    "OpenAI Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Lead Qualification",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Enrich Lead Data": {
      "main": [
        [
          {
            "node": "AI Lead Qualification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Quality": {
      "main": [
        [
          {
            "node": "Save to Airtable (Hot Leads)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Save to Airtable (Nurture Queue)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Response": {
      "ai_outputParser": [
        [
          {
            "node": "AI Lead Qualification",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Acknowledge Receipt": {
      "main": [
        [
          {
            "node": "Enrich Lead Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lead Intake Webhook": {
      "main": [
        [
          {
            "node": "Acknowledge Receipt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Lead Qualification": {
      "main": [
        [
          {
            "node": "Route by Quality",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save to Airtable (Hot Leads)": {
      "main": [
        [
          {
            "node": "Alert Team (Slack)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Confirmation Email (Hot)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save to Airtable (Nurture Queue)": {
      "main": [
        [
          {
            "node": "Send Nurture Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}