{
  "name": "Import Funded Companies — Crunchbase → HubSpot",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 8
            }
          ]
        }
      },
      "id": "schedule-trigger",
      "name": "Daily 8am",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [0, 0]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.crunchbase.com/api/v4/searches/funding_rounds",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "X-cb-user-key", "value": "YOUR_CRUNCHBASE_API_KEY" }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"field_ids\": [\n    \"identifier\", \"announced_on\", \"money_raised\",\n    \"funded_organization_identifier\", \"investment_type\",\n    \"investor_identifiers\"\n  ],\n  \"query\": [\n    {\n      \"type\": \"predicate\",\n      \"field_id\": \"announced_on\",\n      \"operator_id\": \"gte\",\n      \"values\": [\"{{ $now.minus(30, 'days').format('yyyy-MM-dd') }}\"]\n    },\n    {\n      \"type\": \"predicate\",\n      \"field_id\": \"investment_type\",\n      \"operator_id\": \"includes\",\n      \"values\": [\"series_a\", \"series_b\", \"series_c\", \"series_d\"]\n    }\n  ],\n  \"limit\": 100\n}",
        "options": {}
      },
      "id": "search-funding",
      "name": "Search Funding Rounds",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [220, 0]
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "id": "loop-rounds",
      "name": "Loop Funding Rounds",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [440, 0]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "=https://api.crunchbase.com/api/v4/entities/organizations/{{ $json.properties.funded_organization_identifier.uuid }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "X-cb-user-key", "value": "YOUR_CRUNCHBASE_API_KEY" }
          ]
        },
        "options": {
          "queryParameters": {
            "parameters": [
              { "name": "field_ids", "value": "short_description,categories,num_employees_enum,website_url,founded_on" }
            ]
          }
        }
      },
      "id": "fetch-org",
      "name": "Fetch Organization",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [660, 0]
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" },
          "conditions": [
            {
              "leftValue": "={{ $json.properties.website_url }}",
              "rightValue": "",
              "operator": { "type": "string", "operation": "notEmpty" }
            }
          ],
          "combinator": "and"
        }
      },
      "id": "filter-icp",
      "name": "Has Website?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [880, 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.properties.website_url.replace('https://', '').replace('http://', '').replace('www.', '').split('/')[0] }}\"\n    }]\n  }]\n}",
        "options": {}
      },
      "id": "check-existing",
      "name": "Check Existing",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [1100, -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?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [1320, -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\": \"{{ $('Fetch Organization').item.json.properties.website_url }}\",\n    \"name\": \"{{ $('Fetch Organization').item.json.properties.identifier.value }}\",\n    \"industry\": \"{{ ($('Fetch Organization').item.json.properties.categories || [])[0]?.value || '' }}\",\n    \"description\": \"{{ $('Fetch Organization').item.json.properties.short_description }}\",\n    \"funding_stage\": \"{{ $('Loop Funding Rounds').item.json.properties.investment_type }}\",\n    \"funding_amount\": \"{{ $('Loop Funding Rounds').item.json.properties.money_raised?.value || '' }}\",\n    \"funding_date\": \"{{ $('Loop Funding Rounds').item.json.properties.announced_on }}\"\n  }\n}",
        "options": {}
      },
      "id": "create-company",
      "name": "Create Company",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [1540, -200],
      "credentials": {
        "hubspotApi": { "id": "credential-id", "name": "HubSpot API" }
      }
    }
  ],
  "connections": {
    "Daily 8am": {
      "main": [[{ "node": "Search Funding Rounds", "type": "main", "index": 0 }]]
    },
    "Search Funding Rounds": {
      "main": [[{ "node": "Loop Funding Rounds", "type": "main", "index": 0 }]]
    },
    "Loop Funding Rounds": {
      "main": [
        [{ "node": "Fetch Organization", "type": "main", "index": 0 }],
        []
      ]
    },
    "Fetch Organization": {
      "main": [[{ "node": "Has Website?", "type": "main", "index": 0 }]]
    },
    "Has Website?": {
      "main": [
        [{ "node": "Check Existing", "type": "main", "index": 0 }],
        [{ "node": "Loop Funding Rounds", "type": "main", "index": 0 }]
      ]
    },
    "Check Existing": {
      "main": [[{ "node": "Is New?", "type": "main", "index": 0 }]]
    },
    "Is New?": {
      "main": [
        [{ "node": "Create Company", "type": "main", "index": 0 }],
        [{ "node": "Loop Funding Rounds", "type": "main", "index": 0 }]
      ]
    },
    "Create Company": {
      "main": [[{ "node": "Loop Funding Rounds", "type": "main", "index": 0 }]]
    }
  },
  "pinData": {},
  "settings": { "executionOrder": "v1" },
  "staticData": null,
  "tags": [],
  "triggerCount": 0,
  "active": false,
  "meta": { "instanceId": "", "templateId": "revi-funded-companies" }
}
