{
  "name": "AI lead qualification - evidence review sample",
  "active": false,
  "nodes": [
    {
      "id": "2ef05557-c829-4aee-bcb9-41b65805ab8b",
      "name": "Run synthetic example",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "d3d01a5e-2cf3-4e87-800a-32bc1d3b20bb",
      "name": "Seven synthetic records",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        240,
        0
      ],
      "parameters": {
        "jsCode": "// Synthetic fixtures only. No API, AI, email or CRM call is executed.\nreturn [\n  {\n    \"json\": {\n      \"case\": \"eligible_research_candidate\",\n      \"account\": \"North Example Manufacturing\",\n      \"company_domain\": \"north.example\",\n      \"country\": \"US\",\n      \"industry\": \"manufacturing\",\n      \"existing_opportunity\": false,\n      \"enrichment\": {\n        \"status\": \"success\",\n        \"http_status\": 200,\n        \"email_grade\": \"A\"\n      },\n      \"current_employment_checked\": true,\n      \"research\": {\n        \"status\": \"completed\",\n        \"supports_offer\": true,\n        \"source_checked\": true,\n        \"source_url\": \"https://north.example/products\",\n        \"observed_on\": \"2026-10-26\",\n        \"reason\": \"Synthetic product page describes the target manufacturing process.\"\n      },\n      \"ai_label\": \"qualified\",\n      \"ai_confidence\": 0.99,\n      \"synthetic\": true\n    }\n  },\n  {\n    \"json\": {\n      \"case\": \"http_200_no_match\",\n      \"account\": \"No Match Example\",\n      \"company_domain\": \"nomatch.example\",\n      \"country\": \"US\",\n      \"industry\": \"manufacturing\",\n      \"existing_opportunity\": false,\n      \"enrichment\": {\n        \"status\": \"not_found\",\n        \"http_status\": 200,\n        \"email_grade\": null\n      },\n      \"current_employment_checked\": false,\n      \"research\": {\n        \"status\": \"completed\",\n        \"supports_offer\": true,\n        \"source_checked\": true,\n        \"source_url\": \"https://nomatch.example/products\",\n        \"observed_on\": \"2026-10-26\"\n      },\n      \"ai_label\": \"qualified\",\n      \"ai_confidence\": 0.99,\n      \"synthetic\": true\n    }\n  },\n  {\n    \"json\": {\n      \"case\": \"wrong_industry_high_score\",\n      \"account\": \"Example Retail\",\n      \"company_domain\": \"retail.example\",\n      \"country\": \"US\",\n      \"industry\": \"retail\",\n      \"existing_opportunity\": false,\n      \"enrichment\": {\n        \"status\": \"success\",\n        \"http_status\": 200,\n        \"email_grade\": \"A\"\n      },\n      \"current_employment_checked\": true,\n      \"research\": {\n        \"status\": \"completed\",\n        \"supports_offer\": true,\n        \"source_checked\": true,\n        \"source_url\": \"https://retail.example/about\",\n        \"observed_on\": \"2026-10-26\"\n      },\n      \"ai_label\": \"qualified\",\n      \"ai_confidence\": 1.0,\n      \"synthetic\": true\n    }\n  },\n  {\n    \"json\": {\n      \"case\": \"deliverable_email_wrong_role\",\n      \"account\": \"Role Change Example\",\n      \"company_domain\": \"rolechange.example\",\n      \"country\": \"US\",\n      \"industry\": \"manufacturing\",\n      \"existing_opportunity\": false,\n      \"enrichment\": {\n        \"status\": \"success\",\n        \"http_status\": 200,\n        \"email_grade\": \"A\"\n      },\n      \"current_employment_checked\": false,\n      \"research\": {\n        \"status\": \"completed\",\n        \"supports_offer\": true,\n        \"source_checked\": true,\n        \"source_url\": \"https://rolechange.example/products\",\n        \"observed_on\": \"2026-10-26\"\n      },\n      \"ai_label\": \"qualified\",\n      \"ai_confidence\": 0.98,\n      \"synthetic\": true\n    }\n  },\n  {\n    \"json\": {\n      \"case\": \"existing_opportunity\",\n      \"account\": \"Existing Example\",\n      \"company_domain\": \"existing.example\",\n      \"country\": \"US\",\n      \"industry\": \"manufacturing\",\n      \"existing_opportunity\": true,\n      \"enrichment\": {\n        \"status\": \"success\",\n        \"http_status\": 200,\n        \"email_grade\": \"A\"\n      },\n      \"current_employment_checked\": true,\n      \"research\": {\n        \"status\": \"completed\",\n        \"supports_offer\": true,\n        \"source_checked\": true,\n        \"source_url\": \"https://existing.example/products\",\n        \"observed_on\": \"2026-10-26\"\n      },\n      \"ai_label\": \"qualified\",\n      \"ai_confidence\": 0.99,\n      \"synthetic\": true\n    }\n  },\n  {\n    \"json\": {\n      \"case\": \"research_not_finished\",\n      \"account\": \"Pending Example\",\n      \"company_domain\": \"pending.example\",\n      \"country\": \"US\",\n      \"industry\": \"manufacturing\",\n      \"existing_opportunity\": false,\n      \"enrichment\": {\n        \"status\": \"success\",\n        \"http_status\": 200,\n        \"email_grade\": \"A\"\n      },\n      \"current_employment_checked\": true,\n      \"research\": {\n        \"status\": \"running\",\n        \"supports_offer\": true,\n        \"source_checked\": false,\n        \"source_url\": null,\n        \"observed_on\": null\n      },\n      \"ai_label\": \"qualified\",\n      \"ai_confidence\": 0.99,\n      \"synthetic\": true\n    }\n  },\n  {\n    \"json\": {\n      \"case\": \"stale_source\",\n      \"account\": \"Old Source Example\",\n      \"company_domain\": \"oldsource.example\",\n      \"country\": \"US\",\n      \"industry\": \"manufacturing\",\n      \"existing_opportunity\": false,\n      \"enrichment\": {\n        \"status\": \"success\",\n        \"http_status\": 200,\n        \"email_grade\": \"A\"\n      },\n      \"current_employment_checked\": true,\n      \"research\": {\n        \"status\": \"completed\",\n        \"supports_offer\": true,\n        \"source_checked\": true,\n        \"source_url\": \"https://oldsource.example/products\",\n        \"observed_on\": \"2025-01-01\"\n      },\n      \"ai_label\": \"qualified\",\n      \"ai_confidence\": 0.99,\n      \"synthetic\": true\n    }\n  }\n];"
      }
    },
    {
      "id": "3dc5aa09-8db7-4532-ad12-300e4a43d874",
      "name": "Check evidence before qualification",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        480,
        0
      ],
      "parameters": {
        "jsCode": "// Normalized examples, not the raw schema of any provider.\n// A high model score never bypasses the business criteria.\nconst asOf = Date.parse('2026-10-27T12:00:00Z');\nconst maxAgeDays = 30; // Illustrative operating rule, not a vendor guarantee.\nreturn $input.all().map(item => {\n  const x = item.json;\n  let route = 'hold';\n  const reasons = [];\n  if (x.country !== 'US' || x.industry !== 'manufacturing') {\n    route = 'exclude'; reasons.push('Outside the explicitly selected sample market.');\n  } else if (x.existing_opportunity === true) {\n    route = 'existing_owner'; reasons.push('An opportunity already exists. Do not count a new lead.');\n  } else {\n    if (x.enrichment?.status !== 'success') reasons.push('No successful enrichment match; HTTP 200 alone is insufficient.');\n    if (x.current_employment_checked !== true) reasons.push('Current employment is not independently checked; email grade is not identity proof.');\n    if (x.research?.status !== 'completed') reasons.push('Research has not completed.');\n    if (x.research?.supports_offer !== true) reasons.push('The research does not establish fit with the offer.');\n    if (x.research?.source_checked !== true) reasons.push('A reviewer has not checked the cited evidence.');\n    const checkedAt = Date.parse(x.research?.observed_on || '');\n    const age = (asOf - checkedAt) / 86400000;\n    if (!Number.isFinite(age) || age < 0 || age > maxAgeDays) reasons.push('Evidence is missing, future-dated or outside the sample review window.');\n    let sourceValid = false;\n    try {\n      const u = new URL(x.research?.source_url || '');\n      sourceValid = u.protocol === 'https:' && (u.hostname === x.company_domain || u.hostname.endsWith('.' + x.company_domain));\n    } catch {}\n    if (!sourceValid) reasons.push('An inspectable company source is missing. A URL alone still does not prove the claim.');\n    if (reasons.length === 0) {\n      route = 'human_review';\n      reasons.push('Eligible for a research-review queue. No buyer need, budget, consent or sales acceptance is inferred.');\n    }\n  }\n  return {json: {...x, route, reasons, sales_accepted:false, pipeline_value:null,\n    send_authorized:false, crm_write_authorized:false}};\n});"
      }
    },
    {
      "id": "755e85dd-c630-477f-b3b6-2f9ee525b131",
      "name": "Review results only",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        720,
        0
      ],
      "parameters": {
        "jsCode": "const records = $input.all().map(item => item.json);\nreturn [{json:{synthetic:true, as_of:'2026-10-27', records,\n  counts: records.reduce((a,r) => {a[r.route]=(a[r.route]||0)+1;return a;},{}),\n  sales_accepted:0, pipeline_value:null, outgoing_messages:0,\n  note:'This manual demonstration contains fixture data. It neither calls AI nor contacts any provider or CRM.'}}];"
      }
    },
    {
      "id": "470e3db0-9283-4258-ba11-92ef4c6ee452",
      "name": "MoltSets lookup - disconnected and disabled",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        240,
        300
      ],
      "parameters": {
        "method": "POST",
        "url": "https://api.moltsets.com/api/v1/tools/search_people",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "JeffBrokaw-qualification-example/1.0"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\"title\": \"Procurement Director\", \"country\": \"United States\", \"limit\": 3, \"offset\": 0}",
        "options": {
          "timeout": 30000
        }
      },
      "disabled": true
    },
    {
      "id": "9b178938-7f9d-400f-898c-610f6d78889c",
      "name": "Exa research request - disconnected and disabled",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        480,
        300
      ],
      "parameters": {
        "method": "POST",
        "url": "https://api.exa.ai/websets/v0/websets",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\"search\": {\"query\": \"US manufacturers that publish evidence of industrial machining capabilities on their own company websites\", \"count\": 3}}",
        "options": {
          "timeout": 30000
        }
      },
      "disabled": true
    }
  ],
  "connections": {
    "Run synthetic example": {
      "main": [
        [
          {
            "node": "Seven synthetic records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Seven synthetic records": {
      "main": [
        [
          {
            "node": "Check evidence before qualification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check evidence before qualification": {
      "main": [
        [
          {
            "node": "Review results only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "tags": []
}
