{
  "name": "Identify Website Visitors — Clearbit Reveal → HubSpot",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "visitor-identify",
        "responseMode": "responseNode"
      },
      "id": "webhook",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [0, 0],
      "webhookId": "visitor-identify"
    },
    {
      "parameters": {
        "method": "GET",
        "url": "=https://reveal.clearbit.com/v1/companies/find?ip={{ $json.body.ip }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "id": "reveal-ip",
      "name": "Clearbit Reveal",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [220, 0],
      "credentials": {
        "httpHeaderAuth": {
          "id": "credential-id",
          "name": "Clearbit API Key"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" },
          "conditions": [
            {
              "leftValue": "={{ $json.company.type }}",
              "rightValue": "company",
              "operator": { "type": "string", "operation": "equals" }
            },
            {
              "leftValue": "={{ $json.company.metrics.employees }}",
              "rightValue": 50,
              "operator": { "type": "number", "operation": "gte" }
            }
          ],
          "combinator": "and"
        }
      },
      "id": "filter-icp",
      "name": "ICP Filter",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [440, 0]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.hubapi.com/crm/v3/objects/companies/search",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "hubspotApi",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"filterGroups\": [{\n    \"filters\": [{\n      \"propertyName\": \"domain\",\n      \"operator\": \"EQ\",\n      \"value\": \"{{ $json.company.domain }}\"\n    }]\n  }]\n}",
        "options": {}
      },
      "id": "check-existing",
      "name": "Check Existing Company",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [660, -100],
      "credentials": {
        "hubspotApi": { "id": "credential-id", "name": "HubSpot API" }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" },
          "conditions": [
            {
              "leftValue": "={{ $json.total }}",
              "rightValue": 0,
              "operator": { "type": "number", "operation": "equals" }
            }
          ],
          "combinator": "and"
        }
      },
      "id": "is-new",
      "name": "Is New Company?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [880, -100]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.hubapi.com/crm/v3/objects/companies",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "hubspotApi",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"properties\": {\n    \"domain\": \"{{ $('Clearbit Reveal').item.json.company.domain }}\",\n    \"name\": \"{{ $('Clearbit Reveal').item.json.company.name }}\",\n    \"industry\": \"{{ $('Clearbit Reveal').item.json.company.category.industry }}\",\n    \"numberofemployees\": \"{{ $('Clearbit Reveal').item.json.company.metrics.employees }}\",\n    \"city\": \"{{ $('Clearbit Reveal').item.json.company.geo.city }}\",\n    \"state\": \"{{ $('Clearbit Reveal').item.json.company.geo.state }}\",\n    \"country\": \"{{ $('Clearbit Reveal').item.json.company.geo.country }}\",\n    \"description\": \"{{ $('Clearbit Reveal').item.json.company.description }}\"\n  }\n}",
        "options": {}
      },
      "id": "create-company",
      "name": "Create Company",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [1100, -200],
      "credentials": {
        "hubspotApi": { "id": "credential-id", "name": "HubSpot API" }
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [[{ "node": "Clearbit Reveal", "type": "main", "index": 0 }]]
    },
    "Clearbit Reveal": {
      "main": [[{ "node": "ICP Filter", "type": "main", "index": 0 }]]
    },
    "ICP Filter": {
      "main": [
        [{ "node": "Check Existing Company", "type": "main", "index": 0 }],
        []
      ]
    },
    "Check Existing Company": {
      "main": [[{ "node": "Is New Company?", "type": "main", "index": 0 }]]
    },
    "Is New Company?": {
      "main": [
        [{ "node": "Create Company", "type": "main", "index": 0 }],
        []
      ]
    }
  },
  "pinData": {},
  "settings": { "executionOrder": "v1" },
  "staticData": null,
  "tags": [],
  "triggerCount": 0,
  "active": false,
  "meta": { "instanceId": "", "templateId": "revi-reveal-visitors" }
}
