{
  "name": "HYPEAKZ \u2014 AI Lead Qualification Scorer (100% Local)",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "qualify-lead",
        "responseMode": "responseNode"
      },
      "id": "node-webhook",
      "name": "New Lead Input",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "model": "llama3.2",
        "baseUrl": "http://ollama:11434"
      },
      "id": "node-ollama",
      "name": "Ollama Local LLM",
      "type": "@n8n/n8n-nodes-langchain.lmOllama",
      "typeVersion": 1,
      "position": [
        550,
        550
      ]
    },
    {
      "parameters": {
        "prompt": "You are a B2B lead qualification expert. Score this lead using BANT methodology:\n\nLead Data:\n- Name: {{ $json.body.name || 'Unknown' }}\n- Company: {{ $json.body.company || 'Unknown' }}\n- Email: {{ $json.body.email || 'Unknown' }}\n- Message/Inquiry: {{ $json.body.message || 'No message' }}\n- Source: {{ $json.body.source || 'Unknown' }}\n- Industry: {{ $json.body.industry || 'Unknown' }}\n- Company Size: {{ $json.body.company_size || 'Unknown' }}\n\nScore each BANT dimension 0-25:\n- Budget: Signs of budget availability (mentions pricing, ROI, investment)\n- Authority: Is this a decision maker? (title, language used)\n- Need: How urgent/specific is their need?\n- Timeline: Any urgency indicators?\n\nReturn JSON with:\n- total_score: 0-100\n- grade: A (80-100), B (60-79), C (40-59), D (0-39)\n- budget_score: 0-25 with reasoning\n- authority_score: 0-25 with reasoning\n- need_score: 0-25 with reasoning\n- timeline_score: 0-25 with reasoning\n- recommended_action: what sales should do next\n- talking_points: 3 personalized talking points for outreach\n- disqualification_flags: any red flags"
      },
      "id": "node-score",
      "name": "Score Lead (AI)",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.4,
      "position": [
        550,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.text }}",
              "operation": "contains",
              "value2": "\"grade\": \"A\""
            }
          ]
        }
      },
      "id": "node-if-hot",
      "name": "Hot Lead?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        800,
        200
      ]
    },
    {
      "parameters": {
        "channel": "#sales",
        "text": ":fire: HOT LEAD (Grade A)\n*Name:* {{ $('New Lead Input').item.json.body.name }}\n*Company:* {{ $('New Lead Input').item.json.body.company }}\n*Score:* {{ $('Score Lead (AI)').item.json.text }}"
      },
      "id": "node-slack",
      "name": "Alert Sales (Slack)",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        1050,
        100
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ score: $('Score Lead (AI)').item.json.text, lead: $('New Lead Input').item.json.body.name, processed_at: $now.toISO(), model: 'llama3.2 (local)' }) }}"
      },
      "id": "node-respond",
      "name": "Return Score",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1050,
        350
      ]
    }
  ],
  "connections": {
    "New Lead Input": {
      "main": [
        [
          {
            "node": "Score Lead (AI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Local LLM": {
      "ai_languageModel": [
        [
          {
            "node": "Score Lead (AI)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Score Lead (AI)": {
      "main": [
        [
          {
            "node": "Hot Lead?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Return Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Hot Lead?": {
      "main": [
        [
          {
            "node": "Alert Sales (Slack)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "tags": [
    {
      "name": "HYPEAKZ.IO"
    },
    {
      "name": "Self-Hosted AI"
    },
    {
      "name": "Ollama"
    },
    {
      "name": "Lead Scoring"
    }
  ]
}