{
 "name": "Lead triage (fictional demo)",
 "nodes": [
  {
   "parameters": {
    "content": "## Lead triage \u2014 fictional demo\nIllustrates the 6-step pipeline from the n8n review's concrete example\n(webhook \u2192 enrichment \u2192 AI scoring \u2192 IF router \u2192 action \u2192 log).\n\n**Everything downstream of the webhook is a MOCK stand-in** running on\nfictional lead data (`.example` domains \u2014 no real people, no real\ncompanies, no credentials). Nothing leaves n8n: no API calls, no emails,\nno Slack messages.\n\nTo publish for real: follow `CONFIG_NOTES.md` to swap each mock for the\nreal node (HTTP enrichment, AI Agent + model, CRM, Slack, email).",
    "height": 260,
    "width": 1080,
    "color": 4
   },
   "id": "479fad84-1f98-4ba2-828d-03740494291a",
   "name": "Sticky Note",
   "type": "n8n-nodes-base.stickyNote",
   "typeVersion": 1,
   "position": [
    120,
    60
   ]
  },
  {
   "parameters": {
    "httpMethod": "POST",
    "path": "lead-intake",
    "responseMode": "lastNode",
    "options": {}
   },
   "id": "7d107915-ab1b-4fb2-a35b-22ac12714108",
   "name": "Webhook: Lead intake",
   "type": "n8n-nodes-base.webhook",
   "typeVersion": 2,
   "position": [
    240,
    300
   ],
   "webhookId": "68246bd2-719f-4937-a01c-b2a4a0ab134c"
  },
  {
   "parameters": {
    "mode": "runOnceForAllItems",
    "jsCode": "// MOCK STAND-IN \u2014 fictional firmographic data.\n// Replace with a real HTTP node calling your enrichment API\n// (see CONFIG_NOTES.md) before publishing.\nconst FIRMOGRAPHICS = {\n  \"acme-anvils.example\":  { headcount: 480,  industry: \"Manufacturing\", techStack: [\"Salesforce\", \"NetSuite\"], funding: \"Series B\" },\n  \"blue-orchid.example\":  { headcount: 14,   industry: \"Consulting\",    techStack: [\"HubSpot\"],                funding: \"Bootstrapped\" },\n  \"cinder-block.example\": { headcount: 1200, industry: \"Logistics\",     techStack: [\"SAP\", \"Salesforce\"],      funding: \"Series C\" },\n  \"dune-cafe.example\":    { headcount: 8,    industry: \"Hospitality\",   techStack: [],                         funding: \"Bootstrapped\" }\n};\nconst DEFAULTS = { headcount: 25, industry: \"Unknown\", techStack: [], funding: \"Unknown\" };\n\nreturn $input.all().map(({ json: lead }, i) => {\n  // Production webhooks wrap the payload in {body, headers, ...}; pinned test data is the lead itself.\n  const src = (lead && typeof lead.body === \"object\" && lead.body !== null) ? lead.body : lead;\n  const domain = String(src.domain || \"\").toLowerCase();\n  const firm = FIRMOGRAPHICS[domain] || DEFAULTS;\n  return {\n    json: {\n      leadId: \"demo-lead-\" + (i + 1),\n      name: src.name, email: src.email,\n      company: src.company, domain: src.domain,\n      inboundMessage: src.message || \"\",\n      headcount: firm.headcount, industry: firm.industry,\n      techStack: firm.techStack, funding: firm.funding,\n      enrichedBy: \"MOCK \u2014 fictional data, no API called\"\n    }\n  };\n});\n"
   },
   "id": "7eac07b0-3de1-4bbe-80db-f27935a39866",
   "name": "Mock: Enrich lead (fictional data)",
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "position": [
    480,
    300
   ]
  },
  {
   "parameters": {
    "mode": "runOnceForAllItems",
    "jsCode": "// MOCK STAND-IN for the AI agent scoring node.\n// Deterministic rules on fictional data so the demo runs with zero\n// credentials. Replace with an AI Agent node + model credentials\n// (see CONFIG_NOTES.md) before publishing.\nconst ICP_INDUSTRIES = [\"Manufacturing\", \"Logistics\", \"SaaS\"];\n\nreturn $input.all().map(({ json: l }) => {\n  let score = 0;\n  const reasons = [];\n  if (l.headcount >= 50 && l.headcount <= 2000) { score += 30; reasons.push(\"headcount \" + l.headcount + \" in ICP range\"); }\n  if (ICP_INDUSTRIES.includes(l.industry))     { score += 25; reasons.push(l.industry + \" is an ICP industry\"); }\n  if (l.techStack.includes(\"Salesforce\") || l.techStack.includes(\"HubSpot\")) { score += 20; reasons.push(\"uses a known CRM\"); }\n  if (l.email && !/gmail|yahoo|hotmail|outlook/i.test(l.email)) { score += 15; reasons.push(\"work email\"); }\n  if (/Series [ABC]/i.test(l.funding || \"\"))   { score += 10; reasons.push(\"funded (\" + l.funding + \")\"); }\n  score = Math.min(score, 100);\n  const tier = score >= 70 ? \"hot\" : \"nurture\";\n  return {\n    json: {\n      ...l, score, tier,\n      scoreReason: reasons.length ? reasons.join(\"; \") : \"no ICP signals matched\",\n      scoredBy: \"MOCK \u2014 rule-based stand-in, not an LLM\"\n    }\n  };\n});\n"
   },
   "id": "6cea5647-d3f1-4972-a8a7-3009f40d25f2",
   "name": "Mock: Score lead (stand-in for AI agent)",
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "position": [
    720,
    300
   ]
  },
  {
   "parameters": {
    "conditions": {
     "options": {
      "caseSensitive": true,
      "leftValue": "",
      "typeValidation": "loose"
     },
     "conditions": [
      {
       "id": "bad27d90-f03d-425b-bd85-05c86a6178e8",
       "leftValue": "={{ $json.score }}",
       "rightValue": 70,
       "operator": {
        "type": "number",
        "operation": "largerEqual"
       }
      }
     ],
     "combinator": "and"
    },
    "looseTypeValidation": true,
    "options": {}
   },
   "id": "d6f88f53-6236-4e0b-905d-df84d9adf4d1",
   "name": "Router: Hot lead? (score >= 70)",
   "type": "n8n-nodes-base.if",
   "typeVersion": 2.2,
   "position": [
    960,
    300
   ]
  },
  {
   "parameters": {
    "mode": "runOnceForAllItems",
    "jsCode": "// MOCK STAND-IN \u2014 builds the payloads that WOULD go to your CRM and Slack.\n// Nothing is sent. Wire real CRM + Slack nodes here before publishing.\nconst OWNERS = [\"priya\", \"marcus\"]; // fictional owners, round-robin\n\nreturn $input.all().map(({ json: l }, i) => {\n  const owner = OWNERS[i % OWNERS.length];\n  return {\n    json: {\n      ...l, owner,\n      crmRecord: {\n        object: \"Contact\", name: l.name, email: l.email,\n        company: l.company, leadScore: l.score,\n        owner: owner, status: \"New \u2014 hot lead\"\n      },\n      slackChannel: \"#hot-leads\",\n      slackMessage: \":fire: *Hot lead* (\" + l.score + \"/100): \" + l.name + \" \u2014 \" + l.company +\n        \" (\" + l.industry + \", \" + l.headcount + \" staff). Reason: \" + l.scoreReason + \". Owner: @\" + owner,\n      sentToCrm: false, sentToSlack: false,\n      note: \"MOCK \u2014 payloads built but not sent; connect real CRM/Slack nodes to send.\"\n    }\n  };\n});\n"
   },
   "id": "46fdd98d-7e79-4c19-a3e8-a554a3e113db",
   "name": "Hot: Build CRM + Slack actions",
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "position": [
    1200,
    200
   ]
  },
  {
   "parameters": {
    "mode": "runOnceForAllItems",
    "jsCode": "// MOCK STAND-IN \u2014 drafts the follow-up email. Nothing is sent.\n// Connect a real email node + a human-review step before publishing.\nreturn $input.all().map(({ json: l }) => {\n  const firstName = String(l.name || \"there\").split(\" \")[0];\n  return {\n    json: {\n      ...l,\n      needsHumanReview: true,\n      queuedForReview: true,\n      emailDraft: {\n        to: l.email,\n        subject: \"Quick follow-up, \" + firstName + \" \u2014 \" + l.company,\n        body: \"Hi \" + firstName + \",\\n\\nThanks for reaching out about automation. \" +\n          \"Based on what you shared, I think there could be a fit \u2014 \" +\n          \"would a 15-minute call next week work to explore it?\\n\\nBest,\\nThe team\"\n      },\n      note: \"MOCK \u2014 draft only; nothing sent.\"\n    }\n  };\n});\n"
   },
   "id": "06bc3325-dded-4cab-9b05-c77cf55ca2dd",
   "name": "Cold: Draft follow-up email",
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "position": [
    1200,
    440
   ]
  },
  {
   "parameters": {
    "mode": "append"
   },
   "id": "33e2b454-706d-40e5-8bdd-1fbc35142b8b",
   "name": "Merge: Unify branches",
   "type": "n8n-nodes-base.merge",
   "typeVersion": 3,
   "position": [
    1440,
    300
   ]
  },
  {
   "parameters": {
    "mode": "runOnceForAllItems",
    "jsCode": "// Execution log entry \u2014 mirrors what you'd capture from a real run.\nreturn $input.all().map(({ json: l }) => ({\n  json: {\n    timestamp: new Date().toISOString(),\n    workflow: \"Lead triage (fictional demo)\",\n    leadId: l.leadId, name: l.name, company: l.company,\n    score: l.score, tier: l.tier, reason: l.scoreReason,\n    branch: l.tier === \"hot\" ? \"hot \u2192 CRM + Slack\" : \"nurture \u2192 email draft (human review)\",\n    actions: l.tier === \"hot\"\n      ? { crm: \"payload built (not sent \u2014 mock)\", slack: \"#hot-leads message built (not sent \u2014 mock)\", owner: l.owner }\n      : { emailDraft: \"drafted (not sent \u2014 mock)\", needsHumanReview: true }\n  }\n}));\n"
   },
   "id": "565c2967-389a-4793-9041-545e0eab9af3",
   "name": "Log: Execution record",
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "position": [
    1680,
    300
   ]
  }
 ],
 "pinData": {
  "Webhook: Lead intake": [
   {
    "json": {
     "name": "Jane Doe",
     "email": "jane@acme-anvils.example",
     "company": "Acme Anvils",
     "domain": "acme-anvils.example",
     "message": "We need help automating order follow-ups."
    }
   },
   {
    "json": {
     "name": "Li Wei",
     "email": "li@blue-orchid.example",
     "company": "Blue Orchid Consulting",
     "domain": "blue-orchid.example",
     "message": "Curious what automation could do for us."
    }
   },
   {
    "json": {
     "name": "Sam Carter",
     "email": "sam@cinder-block.example",
     "company": "Cinder Block Logistics",
     "domain": "cinder-block.example",
     "message": "Looking to triage inbound freight quotes faster."
    }
   },
   {
    "json": {
     "name": "Ana Ruiz",
     "email": "ana@dune-cafe.example",
     "company": "Dune Cafe",
     "domain": "dune-cafe.example",
     "message": "Small cafe, just exploring options."
    }
   }
  ]
 },
 "connections": {
  "Webhook: Lead intake": {
   "main": [
    [
     {
      "node": "Mock: Enrich lead (fictional data)",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Mock: Enrich lead (fictional data)": {
   "main": [
    [
     {
      "node": "Mock: Score lead (stand-in for AI agent)",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Mock: Score lead (stand-in for AI agent)": {
   "main": [
    [
     {
      "node": "Router: Hot lead? (score >= 70)",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Router: Hot lead? (score >= 70)": {
   "main": [
    [
     {
      "node": "Hot: Build CRM + Slack actions",
      "type": "main",
      "index": 0
     }
    ],
    [
     {
      "node": "Cold: Draft follow-up email",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Hot: Build CRM + Slack actions": {
   "main": [
    [
     {
      "node": "Merge: Unify branches",
      "type": "main",
      "index": 1
     }
    ]
   ]
  },
  "Cold: Draft follow-up email": {
   "main": [
    [
     {
      "node": "Merge: Unify branches",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Merge: Unify branches": {
   "main": [
    [
     {
      "node": "Log: Execution record",
      "type": "main",
      "index": 0
     }
    ]
   ]
  }
 },
 "active": false,
 "settings": {
  "executionOrder": "v1"
 },
 "staticData": null
}