{
  "name": "New Google Sheet row → Company Contact Finder → HubSpot",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyHour"
            }
          ]
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "https://docs.google.com/spreadsheets/d/<your sheet id>/edit"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Companies"
        },
        "event": "rowAdded"
      },
      "name": "New company row (name, country, website)",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/acts/rich_minds~company-contact-finder-ai/run-sync-get-dataset-items?timeout=300",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ sourceMode: 'live', companies: [[$json.name, $json.country, $json.website].filter(Boolean).join(', ')], enableAi: true, maxQualified: 1, maxDiscoveryChargeUsd: 0.1 }) }}",
        "options": {}
      },
      "name": "Company Contact Finder (Apify)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        260,
        0
      ],
      "notes": "Header auth credential: Authorization = Bearer <your Apify API token>. One company per row; the run returns its dataset rows."
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.bestEmail }}",
              "operation": "isNotEmpty"
            }
          ]
        }
      },
      "name": "Has a checked e-mail?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        520,
        0
      ]
    },
    {
      "parameters": {
        "resource": "contact",
        "operation": "upsert",
        "email": "={{ $json.bestEmail }}",
        "additionalFields": {
          "companyName": "={{ $json.legalName || $json.name }}",
          "websiteUrl": "={{ $json.website }}",
          "jobTitle": "={{ $json.bestEmailRole }} inbox",
          "phoneNumber": "={{ ($json.phones[0] || {}).number }}"
        }
      },
      "name": "HubSpot: upsert the contact",
      "type": "n8n-nodes-base.hubspot",
      "typeVersion": 2,
      "position": [
        780,
        -80
      ]
    }
  ],
  "connections": {
    "New company row (name, country, website)": {
      "main": [
        [
          {
            "node": "Company Contact Finder (Apify)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Company Contact Finder (Apify)": {
      "main": [
        [
          {
            "node": "Has a checked e-mail?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has a checked e-mail?": {
      "main": [
        [
          {
            "node": "HubSpot: upsert the contact",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  },
  "settings": {},
  "meta": {
    "templateCredsSetupCompleted": false,
    "description": "Each new row of a Google Sheet (name, country, optional website) is looked up by rich_minds/company-contact-finder-ai — website, checked e-mail, phone — and the address to write to is upserted into HubSpot. Pay per company with a checked contact; the first 25 are free."
  }
}