{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "ebb69e6b-6dac-47d6-9f0e-9338b12f5f12",
      "name": "\ud83d\udccb Lead Scoring + Enrichment",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        -192
      ],
      "parameters": {
        "width": 860,
        "height": 480,
        "content": "## Lead Scoring + Enrichment with Lusha\n\n**Who it's for:** Growth & RevOps teams who want to prioritize inbound leads automatically\n\n**What it does:** Combines Lusha enrichment with scoring logic (job seniority, company size, tech stack) to automatically prioritize the most valuable leads.\n\n### How it works\n1. Receives new lead via webhook\n2. Enriches with Lusha for contact + company data\n3. Applies scoring logic based on seniority, company size, industry\n4. Routes high-score leads to SDRs immediately\n5. Low-score leads go to nurture campaigns\n\n### Scoring Criteria (customize these!)\n- VP/C-Suite seniority: +30 pts\n- Director: +20 pts\n- Manager: +10 pts\n- Company 200+ employees: +20 pts\n- Target industry match: +15 pts\n- Has direct phone: +10 pts\n- Has verified email: +5 pts"
      },
      "typeVersion": 1
    },
    {
      "id": "ece34584-bd4c-4c0a-9faa-5833055d5530",
      "name": "\u26a1 1. Receive Lead",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        384
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 270,
        "content": "Webhook receives a new lead with an email address. The lead is immediately sent to Lusha for enrichment.\n\n**Nodes:** Webhook \u2192 Lusha Contact Enrich\n\n\ud83d\udca1 Point your lead capture form, landing page, or marketing automation to this webhook."
      },
      "typeVersion": 1
    },
    {
      "id": "63bb1b81-a135-4e7b-8d69-84a8420316d5",
      "name": "\ud83d\udd0d 2. Enrich & Score",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        384
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 270,
        "content": "Lusha enriches the contact with seniority, company size, industry, and phone data. A code node calculates a lead score based on ICP fit criteria (customize the weights!).\n\n**Nodes:** Lusha Enrich \u2192 Calculate Lead Score\n\n\ud83d\udcd6 [Lusha API docs](https://www.lusha.com/docs/)"
      },
      "typeVersion": 1
    },
    {
      "id": "b937b5d9-899a-4199-b7b4-14f43d2046ff",
      "name": "\ud83d\udce4 3. Route by Score Tier",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1152,
        352
      ],
      "parameters": {
        "color": 7,
        "width": 800,
        "height": 300,
        "content": "Three-tier routing based on lead score:\n\n**Hot (60+ pts):** Slack #hot-leads alert + CRM upsert with full data\n**Warm (35-59 pts):** CRM upsert + Slack #warm-leads notification\n**Cold (<35 pts):** CRM upsert for long-term nurture\n\n**Nodes:** Is Hot? \u2192 [Slack Alert + CRM Upsert] / Is Warm? \u2192 [CRM + Slack] / CRM Nurture\n\nA webhook response returns the score and tier to the calling system."
      },
      "typeVersion": 1
    },
    {
      "id": "535125a1-9ba7-4af2-ad77-0e92b17df652",
      "name": "New Lead Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        80,
        912
      ],
      "parameters": {
        "path": "lead-scoring",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "1f41b903-702c-478a-bcf5-a94473d88ed3",
      "name": "Validate Email",
      "type": "n8n-nodes-base.code",
      "position": [
        352,
        912
      ],
      "parameters": {
        "jsCode": "// Validate and normalize the incoming email\nconst body = $json.body || $json;\nconst email = (body.email || '').trim().toLowerCase();\n\nif (!email || !email.includes('@') || !email.includes('.')) {\n  throw new Error('Invalid or missing email: ' + email);\n}\n\nreturn { json: { ...body, email } };"
      },
      "typeVersion": 2
    },
    {
      "id": "ea7df3cb-fbdf-41ee-93a3-9fffefd8b540",
      "name": "Enrich with Lusha",
      "type": "@lusha-org/n8n-nodes-lusha.lusha",
      "position": [
        640,
        912
      ],
      "parameters": {
        "email": "={{ $json.email }}",
        "searchBy": "email",
        "contactEnrichAdditionalOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "0687decf-cf16-417b-bcf1-74d05b842fc0",
      "name": "Calculate Lead Score",
      "type": "n8n-nodes-base.code",
      "position": [
        976,
        912
      ],
      "parameters": {
        "jsCode": "// Lead Scoring Logic \u2014 uses Lusha simplified output fields\nconst lusha = $json;\nconst form = $('Validate Email').first().json;\nlet score = 0;\nconst reasons = [];\n\n// Seniority scoring\nconst seniority = (lusha.seniority || '').toLowerCase();\nif (['c-suite', 'cxo', 'founder', 'owner'].some(s => seniority.includes(s))) {\n  score += 30; reasons.push('C-Suite/Founder (+30)');\n} else if (seniority.includes('vp') || seniority.includes('vice president')) {\n  score += 25; reasons.push('VP level (+25)');\n} else if (seniority.includes('director')) {\n  score += 20; reasons.push('Director level (+20)');\n} else if (seniority.includes('manager')) {\n  score += 10; reasons.push('Manager level (+10)');\n}\n\n// Company size scoring (companySize is an array like [51, 200])\nconst empMax = Array.isArray(lusha.companySize) ? lusha.companySize[1] : 0;\nif (empMax >= 1000) {\n  score += 25; reasons.push('Enterprise 1000+ (+25)');\n} else if (empMax >= 200) {\n  score += 20; reasons.push('Mid-market 200+ (+20)');\n} else if (empMax >= 50) {\n  score += 10; reasons.push('SMB 50+ (+10)');\n}\n\n// Target industry (customize this list!)\nconst targetIndustries = ['technology', 'software', 'saas', 'fintech', 'financial services'];\nconst industry = (lusha.companyMainIndustry || '').toLowerCase();\nif (targetIndustries.some(ti => industry.includes(ti))) {\n  score += 15; reasons.push('Target industry (+15)');\n}\n\n// Data quality scoring\nif (lusha.primaryPhone) { score += 10; reasons.push('Has direct phone (+10)'); }\nif (lusha.primaryEmail) { score += 5; reasons.push('Has verified email (+5)'); }\n\n// Determine tier\nlet tier = 'cold';\nif (score >= 60) tier = 'hot';\nelse if (score >= 35) tier = 'warm';\n\nreturn {\n  json: {\n    firstName: form.firstName || lusha.firstName,\n    lastName: form.lastName || lusha.lastName,\n    email: form.email,\n    verifiedEmail: lusha.primaryEmail,\n    phone: lusha.primaryPhone,\n    jobTitle: lusha.jobTitle,\n    seniority: lusha.seniority,\n    company: lusha.companyName,\n    companyDomain: lusha.companyDomain,\n    companySize: empMax,\n    industry: lusha.companyMainIndustry,\n    linkedinUrl: lusha.linkedinProfile || '',\n    leadScore: score,\n    leadTier: tier,\n    scoreReasons: reasons,\n    enrichedAt: new Date().toISOString()\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "5406adc4-2907-4f41-82dd-eeb7d114a340",
      "name": "Is Hot Lead?",
      "type": "n8n-nodes-base.if",
      "position": [
        1280,
        912
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "combinator": "and",
          "conditions": [
            {
              "id": "4fd09ca9-3e6e-4bfd-b02a-7fae7fe92daa",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.leadTier }}",
              "rightValue": "hot"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "6a22ef00-9d98-4b78-8ea3-0fd75dddb11d",
      "name": "Alert SDR Team (Hot Lead)",
      "type": "n8n-nodes-base.slack",
      "position": [
        1568,
        736
      ],
      "parameters": {
        "text": "=\ud83d\udd25 *HOT LEAD (Score: {{ $json.leadScore }})*\n\n*{{ $json.firstName }} {{ $json.lastName }}*\n{{ $json.jobTitle }} at {{ $json.company }}\nSeniority: {{ $json.seniority }}\nCompany Size: {{ $json.companySize }} employees\nIndustry: {{ $json.industry }}\n\n\ud83d\udce7 {{ $json.verifiedEmail || $json.email }}\n\ud83d\udcf1 {{ $json.phone || 'N/A' }}\n\ud83d\udd17 {{ $json.linkedinUrl || 'N/A' }}\n\n*Score breakdown:*\n{{ $json.scoreReasons.join('\\n') }}",
        "otherOptions": {}
      },
      "typeVersion": 2
    },
    {
      "id": "dc00edc9-1cc2-4ad1-968c-fdda2ce84494",
      "name": "CRM Upsert (Hot Lead)",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1568,
        912
      ],
      "parameters": {
        "email": "={{ $json.email }}",
        "options": {},
        "additionalFields": {
          "industry": "={{ $json.industry }}",
          "lastName": "={{ $json.lastName }}",
          "firstName": "={{ $json.firstName }}"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "76e4f756-5e3a-4b9e-848f-ccd253a7dd68",
      "name": "Is Warm Lead?",
      "type": "n8n-nodes-base.if",
      "position": [
        1568,
        1136
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "combinator": "and",
          "conditions": [
            {
              "id": "23a0de48-f565-42e2-9e24-a23c1cdcf3b8",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.leadTier }}",
              "rightValue": "warm"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "4ea16958-1e7a-4e18-b2ed-b61f6d8b16cb",
      "name": "CRM Upsert (Warm \u2014 Outreach)",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1872,
        1024
      ],
      "parameters": {
        "email": "={{ $json.email }}",
        "options": {},
        "additionalFields": {
          "industry": "={{ $json.industry }}",
          "lastName": "={{ $json.lastName }}",
          "firstName": "={{ $json.firstName }}"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "0f6f83bf-1f6b-4411-8b04-c721caa822e0",
      "name": "Notify Warm Lead",
      "type": "n8n-nodes-base.slack",
      "position": [
        1872,
        1216
      ],
      "parameters": {
        "text": "=\ud83d\udfe1 *Warm Lead (Score: {{ $json.leadScore }})*\n\n*{{ $json.firstName }} {{ $json.lastName }}*\n{{ $json.jobTitle }} at {{ $json.company }}\n\ud83d\udce7 {{ $json.email }} | \ud83d\udcf1 {{ $json.phone || 'N/A' }}\n\n_Added to standard outreach. Score: {{ $json.scoreReasons.join(', ') }}_",
        "otherOptions": {}
      },
      "typeVersion": 2
    },
    {
      "id": "985ce293-5eb2-4c99-beca-0c843efae7b3",
      "name": "CRM Upsert (Cold \u2014 Nurture)",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1872,
        1376
      ],
      "parameters": {
        "email": "={{ $json.email }}",
        "options": {},
        "additionalFields": {
          "lastName": "={{ $json.lastName }}",
          "firstName": "={{ $json.firstName }}"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "936aeeab-69ff-4d8a-b0cd-ddfb42c4efc8",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1280,
        736
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ status: 'scored', tier: $('Calculate Lead Score').first().json.leadTier, score: $('Calculate Lead Score').first().json.leadScore }) }}"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Is Hot Lead?": {
      "main": [
        [
          {
            "node": "Alert SDR Team (Hot Lead)",
            "type": "main",
            "index": 0
          },
          {
            "node": "CRM Upsert (Hot Lead)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Is Warm Lead?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Warm Lead?": {
      "main": [
        [
          {
            "node": "CRM Upsert (Warm \u2014 Outreach)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Notify Warm Lead",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "CRM Upsert (Cold \u2014 Nurture)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Email": {
      "main": [
        [
          {
            "node": "Enrich with Lusha",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New Lead Webhook": {
      "main": [
        [
          {
            "node": "Validate Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enrich with Lusha": {
      "main": [
        [
          {
            "node": "Calculate Lead Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Lead Score": {
      "main": [
        [
          {
            "node": "Is Hot Lead?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}