{
  "name": "Lead Qualification Engine",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "new-lead",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "04e54dec-7157-4bf8-a777-2c0f45bf20b3",
      "name": "Form Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        240,
        300
      ],
      "notes": "Connect your website/Typeform/Tally form here. Expects: name, email, company, message."
    },
    {
      "parameters": {
        "method": "GET",
        "url": "https://company.clearbit.com/v2/companies/find",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "domain",
              "value": "={{ $json.body.email.split('@')[1] }}"
            }
          ]
        },
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "id": "285a2762-5e78-4324-8d32-6d7077d04162",
      "name": "Enrich Company",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        460,
        300
      ],
      "notes": "Swap Clearbit for any enrichment API you use. Returns employee count, industry, revenue."
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.anthropic.com/v1/messages",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-api-key",
              "value": "={{ $credentials.anthropicApi.apiKey }}"
            },
            {
              "name": "anthropic-version",
              "value": "2023-06-01"
            },
            {
              "name": "content-type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"model\": \"claude-sonnet-4-20250514\",\n  \"max_tokens\": 400,\n  \"system\": \"You are a B2B sales qualification engine. Score each lead 0-100 on fit and intent. Return ONLY JSON: {\\\"score\\\": number, \\\"tier\\\": \\\"hot|warm|cold\\\", \\\"reason\\\": string, \\\"suggested_action\\\": string}.\",\n  \"messages\": [{\"role\": \"user\", \"content\": \"Lead: {{ $('Form Webhook').item.json.body.name }} at {{ $('Form Webhook').item.json.body.company }}. Email: {{ $('Form Webhook').item.json.body.email }}. Message: {{ $('Form Webhook').item.json.body.message }}. Company data: {{ JSON.stringify($json) }}\"}]\n}",
        "options": {}
      },
      "id": "3639a104-498e-4c71-a82c-c16263f6c995",
      "name": "Score With Claude",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        680,
        300
      ],
      "notes": "Add your Anthropic API credential. Claude returns a structured score + tier."
    },
    {
      "parameters": {
        "jsScript": "const raw = $input.first().json.content[0].text;\nconst data = JSON.parse(raw);\nreturn [{ json: data }];"
      },
      "id": "2bc4bd4a-2805-47a9-bfad-bd566f501821",
      "name": "Parse Score",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        900,
        300
      ]
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.tier }}",
                    "rightValue": "hot",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ]
              },
              "outputKey": "hot"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.tier }}",
                    "rightValue": "warm",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ]
              },
              "outputKey": "warm"
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "id": "6abe8451-e288-4abb-9748-0898ebb9ceb0",
      "name": "Route By Tier",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3,
      "position": [
        1120,
        300
      ]
    },
    {
      "parameters": {
        "resource": "message",
        "operation": "post",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "sales",
          "mode": "name"
        },
        "text": "=:fire: *HOT LEAD* \u2014 {{ $('Parse Score').item.json.score }}/100\n{{ $('Form Webhook').item.json.body.name }} @ {{ $('Form Webhook').item.json.body.company }}\n{{ $('Parse Score').item.json.reason }}\nAction: {{ $('Parse Score').item.json.suggested_action }}",
        "otherOptions": {}
      },
      "id": "6bf08b3f-eed2-4869-8532-10dc4fb66a9e",
      "name": "Alert Sales (Slack)",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2,
      "position": [
        1360,
        160
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://your-crm.example.com/api/contacts",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"name\": \"{{ $('Form Webhook').item.json.body.name }}\",\n  \"email\": \"{{ $('Form Webhook').item.json.body.email }}\",\n  \"company\": \"{{ $('Form Webhook').item.json.body.company }}\",\n  \"score\": {{ $('Parse Score').item.json.score }},\n  \"tier\": \"{{ $('Parse Score').item.json.tier }}\"\n}",
        "options": {}
      },
      "id": "3ccc30da-c46c-4a63-b267-ac7a11f34318",
      "name": "Add To CRM",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        1360,
        300
      ],
      "notes": "Point this at HubSpot, Pipedrive, Attio, or your CRM's API."
    },
    {
      "parameters": {
        "resource": "message",
        "operation": "send",
        "sendTo": "={{ $('Form Webhook').item.json.body.email }}",
        "subject": "Thanks for reaching out",
        "message": "=Hi {{ $('Form Webhook').item.json.body.name }},\n\nThanks for getting in touch. Here are a few resources while we review your note...",
        "options": {}
      },
      "id": "94968773-2ee2-48f4-8351-b6ad6dd4bf62",
      "name": "Nurture Sequence",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2,
      "position": [
        1360,
        440
      ],
      "notes": "Cold/warm leads get an automated nurture email instead of a sales ping."
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={ \"ok\": true }",
        "options": {}
      },
      "id": "6b5b93f8-61c0-4e1f-a327-9518d31c0f16",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1580,
        300
      ]
    }
  ],
  "connections": {
    "Form Webhook": {
      "main": [
        [
          {
            "node": "Enrich Company",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enrich Company": {
      "main": [
        [
          {
            "node": "Score With Claude",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Score With Claude": {
      "main": [
        [
          {
            "node": "Parse Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Score": {
      "main": [
        [
          {
            "node": "Route By Tier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route By Tier": {
      "main": [
        [
          {
            "node": "Alert Sales (Slack)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Add To CRM",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Nurture Sequence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alert Sales (Slack)": {
      "main": [
        [
          {
            "node": "Add To CRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add To CRM": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Nurture Sequence": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "saveExecutionProgress": true,
    "saveManualExecutions": true
  },
  "versionId": "d93e4c43-b60c-49cf-8067-d03eaf693946",
  "meta": {
    "templateCredsSetupCompleted": false,
    "description": "Inbound form lead is enriched, scored 0-100 by Claude, then hot leads ping Sales in Slack + sync to CRM while cold leads enter an automated nurture sequence."
  },
  "tags": [
    {
      "name": "sales"
    },
    {
      "name": "ai"
    },
    {
      "name": "lead-gen"
    }
  ],
  "pinData": {}
}