{
  "name": "Auto-Enrich New Contacts — HubSpot + Apollo",
  "nodes": [
    {
      "parameters": {
        "event": "contactCreated",
        "additionalFields": {}
      },
      "id": "hubspot-trigger",
      "name": "HubSpot Trigger",
      "type": "n8n-nodes-base.hubspotTrigger",
      "typeVersion": 1,
      "position": [0, 0],
      "credentials": {
        "hubspotApi": {
          "id": "credential-id",
          "name": "HubSpot API"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apollo.io/api/v1/people/match",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-api-key",
              "value": "={{ $credentials.apolloApi.apiKey }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"email\": \"{{ $json.properties.email }}\"\n}",
        "options": {}
      },
      "id": "apollo-enrich",
      "name": "Apollo Enrich",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [220, 0]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "leftValue": "={{ $json.person }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "isNotEmpty"
              }
            }
          ],
          "combinator": "and"
        }
      },
      "id": "if-found",
      "name": "Person Found?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [440, 0]
    },
    {
      "parameters": {
        "method": "PATCH",
        "url": "=https://api.hubapi.com/crm/v3/objects/contacts/{{ $('HubSpot Trigger').item.json.id }}",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "hubspotApi",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"properties\": {\n    \"jobtitle\": \"{{ $json.person.title }}\",\n    \"company\": \"{{ $json.person.organization.name }}\",\n    \"phone\": \"{{ $json.person.phone_numbers[0]?.sanitized_number }}\",\n    \"linkedin_url\": \"{{ $json.person.linkedin_url }}\",\n    \"industry\": \"{{ $json.person.organization.industry }}\",\n    \"numemployees\": \"{{ $json.person.organization.estimated_num_employees }}\"\n  }\n}",
        "options": {}
      },
      "id": "update-hubspot",
      "name": "Update HubSpot Contact",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [660, -100],
      "credentials": {
        "hubspotApi": {
          "id": "credential-id",
          "name": "HubSpot API"
        }
      }
    }
  ],
  "connections": {
    "HubSpot Trigger": {
      "main": [[{ "node": "Apollo Enrich", "type": "main", "index": 0 }]]
    },
    "Apollo Enrich": {
      "main": [[{ "node": "Person Found?", "type": "main", "index": 0 }]]
    },
    "Person Found?": {
      "main": [
        [{ "node": "Update HubSpot Contact", "type": "main", "index": 0 }],
        []
      ]
    }
  },
  "pinData": {},
  "settings": { "executionOrder": "v1" },
  "staticData": null,
  "tags": [],
  "triggerCount": 0,
  "active": false,
  "meta": { "instanceId": "", "templateId": "revi-contact-enrichment" }
}
