{
  "name": "SLT Machine Lead Enrichment",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "GET",
        "path": "webhook/slt-lead-enrich",
        "responseMode": "onReceived",
        "responseData": {
          "responseCode": 200,
          "responseBody": "={\"status\": \"received\"}"
        }
      },
      "id": "1",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "const url = $json.url || $json.link || $json[\"url\"];\n\n// Extract domain for company research\nconst urlObj = new URL(url);\nconst domain = urlObj.hostname.replace(/^www\\./, '');\n\nreturn [{\n  ...$json,\n  company_domain: domain,\n  enrichment_timestamp: new Date().toISOString(),\n  enrichment_step: \"domain_extracted\"\n}];"
      },
      "id": "2",
      "name": "Extract Domain",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "// Simple company research - in production, you'd use Clearbit, Apollo, or similar\nconst domain = $json.company_domain;\nlet company_info = {\n  name: \"Unknown\",\n  industry: \"Unknown\",\n  description: \"Company info not available\",\n  technologies: [],\n  size: \"Unknown\"\n};\n\n// Basic heuristics based on domain\nif (domain.includes(\"aero\") || domain.includes(\"aviation\") || domain.includes(\"aircraft\")) {\n  company_info.industry = \"Aerospace\";\n  company_info.description = \"Likely aerospace components manufacturer or supplier\";\n} else if (domain.includes(\"oil\") || domain.includes(\"gas\") || domain.includes(\"energy\") || domain.includes(\"petro\")) {\n  company_info.industry = \"Oil & Gas\";\n  company_info.description = \"Likely energy sector equipment manufacturer or service provider\";\n} else if (domain.includes(\"med\") || domain.includes(\"health\")) {\n  company_info.industry = \"Medical\";\n  company_info.description = \"Likely medical device or equipment manufacturer\";\n}\n\n// Try to extract company name from domain\nconst nameParts = domain.split(\".\");\nif (nameParts.length > 0) {\n  let name = nameParts[0];\n  name = name.replace(/[0-9]/g, ''); // Remove numbers\n  name = name.replace(/[-_]/g, ' '); // Replace hyphens/underscores with spaces\n  name = name.split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');\n  if (name.length > 1) {\n    company_info.name = name;\n  }\n}\n\nreturn [{\n  ...$json,\n  company_name: company_info.name,\n  company_industry: company_info.industry,\n  company_description: company_info.description,\n  enrichment_step: \"company_researched\"\n}];"
      },
      "id": "3",
      "name": "Research Company",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "return [{\n  ...$json,\n  ready_for_sheets: true\n}];"
      },
      "id": "4",
      "name": "Prepare for Sheets",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "sheetId": "19hCNdwhOmqdgp1tqZl1AMyBmRL7ne3ZlsEoMKELz4A4",
        "range": "Leads!A:Z",
        "valueInputMode": "USER_ENTERED",
        "addHeader": false
      },
      "id": "5",
      "name": "Append to Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ],
      "credentials": {
        "googleSheetsOAuth2Api": "<your credential>"
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Extract Domain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Domain": {
      "main": [
        [
          {
            "node": "Research Company",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Research Company": {
      "main": [
        [
          {
            "node": "Prepare for Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare for Sheets": {
      "main": [
        [
          {
            "node": "Append to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "id": "1"
}