{
  "name": "Company names to enriched HubSpot contacts: domain, emails, phones, tech stack",
  "nodes": [
    {
      "parameters": {
        "formTitle": "Enrich companies into HubSpot",
        "formDescription": "Paste company names. Each one is matched to its website, then emails, phones, socials and tech stack are added to HubSpot.",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Company names (one per line)",
              "fieldType": "textarea",
              "requiredField": true
            },
            {
              "fieldLabel": "Country (optional, ISO code like US)",
              "fieldType": "text"
            }
          ]
        },
        "options": {}
      },
      "id": "d3c42fcc-a913-56d2-96b7-780f52c97275",
      "name": "Company list form",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        0,
        300
      ],
      "webhookId": "6d689ffe-f36f-5c4e-8720-c7bda50fd4b9"
    },
    {
      "parameters": {
        "jsCode": "// Company names from the form -> Actor input.\nconst names = [...new Set(($json['Company names (one per line)'] || '').split('\\n').map(s => s.trim()).filter(Boolean))];\nif (!names.length) throw new Error('Enter at least one company name');\nreturn [{ json: { companies: names.slice(0, 500), country: $json['Country (optional, ISO code like US)'] || null, minConfidence: 70 } }];"
      },
      "id": "f876db50-a8f3-512b-a50d-a44ac245cbc2",
      "name": "Build input",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        220,
        300
      ]
    },
    {
      "parameters": {
        "resource": "Actors",
        "operation": "Run actor and get dataset",
        "actorId": "wrenfield-data~company-name-to-domain",
        "customBody": "={{ JSON.stringify($json) }}",
        "timeout": 900,
        "memory": 1024,
        "maxTotalChargeUsd": 2,
        "authentication": "apifyApi"
      },
      "id": "79f19cd0-4bba-5ee1-9661-60b6cd00c058",
      "name": "Find company domains",
      "type": "@apify/n8n-nodes-apify.apify",
      "typeVersion": 2,
      "position": [
        440,
        300
      ],
      "credentials": {
        "apifyApi": {
          "id": "",
          "name": "Apify account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Keep confidently matched domains only.\nconst domains = [...new Set($input.all().map(i => i.json).filter(r => r.status === 'found' && r.domain).map(r => r.domain))];\nif (!domains.length) throw new Error('No company could be matched to a domain');\nreturn [{ json: { urls: domains } }];"
      },
      "id": "bf80f28a-c9df-579f-954f-7145b7b45376",
      "name": "Matched domains",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        660,
        300
      ]
    },
    {
      "parameters": {
        "resource": "Actors",
        "operation": "Run actor and get dataset",
        "actorId": "wrenfield-data~website-contact-scraper",
        "customBody": "={{ JSON.stringify({ urls: $json.urls, maxPagesPerDomain: 6, onlyOwnDomainEmails: true, checkMx: true }) }}",
        "timeout": 1800,
        "memory": 1024,
        "maxTotalChargeUsd": 3,
        "authentication": "apifyApi"
      },
      "id": "e81bda85-5fc6-5ae8-90b1-cc4718b12b48",
      "name": "Find emails and phones",
      "type": "@apify/n8n-nodes-apify.apify",
      "typeVersion": 2,
      "position": [
        880,
        300
      ],
      "credentials": {
        "apifyApi": {
          "id": "",
          "name": "Apify account"
        }
      }
    },
    {
      "parameters": {
        "resource": "Actors",
        "operation": "Run actor and get dataset",
        "actorId": "wrenfield-data~website-tech-stack-detector",
        "customBody": "={{ JSON.stringify({ urls: $('Matched domains').first().json.urls, includeTechnologyDetails: false }) }}",
        "timeout": 1800,
        "memory": 1024,
        "maxTotalChargeUsd": 2,
        "authentication": "apifyApi"
      },
      "id": "f5e4af3e-7417-56aa-bd5e-2e94901e7ef7",
      "name": "Detect tech stack",
      "type": "@apify/n8n-nodes-apify.apify",
      "typeVersion": 2,
      "position": [
        1100,
        300
      ],
      "credentials": {
        "apifyApi": {
          "id": "",
          "name": "Apify account"
        }
      },
      "executeOnce": true
    },
    {
      "parameters": {
        "jsCode": "// Join contacts + tech stack + company match by domain; one HubSpot contact per company that has an email.\nconst byDomain = {};\nfor (const i of $('Find company domains').all()) if (i.json.domain) byDomain[i.json.domain] = { company: i.json.companyNameFound || i.json.companyName };\nconst tech = {};\nfor (const i of $input.all()) tech[i.json.domain] = i.json;\nconst out = [];\nfor (const i of $('Find emails and phones').all()) {\n  const c = i.json; if (!c.primaryEmail) continue;\n  const t = tech[c.domain] || {};\n  const list = (k) => (t[k] || []).join(', ');\n  out.push({ json: {\n    email: c.primaryEmail,\n    company: c.companyName || (byDomain[c.domain] || {}).company || c.domain,\n    website: 'https://' + c.domain,\n    phone: c.primaryPhone || '',\n    linkedin: c.linkedin || '',\n    tech_summary: [list('cms'), list('ecommerce'), list('crm'), list('marketingAutomation'), list('analytics')].filter(Boolean).join(' | '),\n  }});\n}\nreturn out;"
      },
      "id": "e82325aa-e553-5abd-95dd-a04e58452841",
      "name": "Join by domain",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1320,
        300
      ]
    },
    {
      "parameters": {
        "authentication": "appToken",
        "resource": "contact",
        "operation": "upsert",
        "email": "={{ $json.email }}",
        "additionalFields": {
          "companyName": "={{ $json.company }}",
          "websiteUrl": "={{ $json.website }}",
          "phoneNumber": "={{ $json.phone }}",
          "message": "={{ 'Tech stack: ' + $json.tech_summary + ($json.linkedin ? '\\nLinkedIn: ' + $json.linkedin : '') }}"
        },
        "options": {}
      },
      "id": "aec4087a-00cd-5d01-bb2f-a7749c405f5c",
      "name": "Upsert HubSpot contact",
      "type": "n8n-nodes-base.hubspot",
      "typeVersion": 2.1,
      "position": [
        1540,
        300
      ],
      "credentials": {
        "hubspotAppToken": {
          "id": "",
          "name": "HubSpot account"
        }
      }
    },
    {
      "parameters": {
        "content": "## Company names to enriched HubSpot contacts\nPaste a list of company names. The workflow finds each official domain, crawls the site for emails, phones and social profiles, detects the tech stack (CMS, ecommerce, CRM, analytics) and upserts a HubSpot contact.\n\n**Setup**\n1. Add your Apify API token as the *Apify account* credential.\n2. Connect HubSpot (private app token with contacts write scope).\n3. Activate and open the form URL.\n\n**Cost:** three pay-per-result Actors, roughly $0.008 per company (domain match + contacts + tech stack). Each run is capped with `maxTotalChargeUsd`.",
        "height": 320,
        "width": 600,
        "color": 5
      },
      "id": "32e4a436-462b-5f0b-8f14-4a1f97199c6e",
      "name": "Setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -40,
        -80
      ]
    }
  ],
  "connections": {
    "Company list form": {
      "main": [
        [
          {
            "node": "Build input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build input": {
      "main": [
        [
          {
            "node": "Find company domains",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find company domains": {
      "main": [
        [
          {
            "node": "Matched domains",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Matched domains": {
      "main": [
        [
          {
            "node": "Find emails and phones",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find emails and phones": {
      "main": [
        [
          {
            "node": "Detect tech stack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Detect tech stack": {
      "main": [
        [
          {
            "node": "Join by domain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Join by domain": {
      "main": [
        [
          {
            "node": "Upsert HubSpot contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}