Enrich new leads with company info → HubSpot
AI reads the lead's company website and saves what they do, industry and size to HubSpot.
How it works
- Receive the lead's name and work email.
- Skip free email providers; otherwise take the company domain.
- Fetch the company homepage and let AI summarise what they do, industry and size.
- Create or update the contact in HubSpot with the summary.
Diagram
Code
JavaScript used in the Code step — already included in the template below.
// Mode: Run Once for Each Item
// Gets the company website from a work email. Free email providers are skipped.
const FREE = ["gmail.com", "yahoo.com", "hotmail.com", "outlook.com", "icloud.com", "live.com", "aol.com", "proton.me"];
const lead = $json.body || {};
const domain = String(lead.email || "").split("@")[1]?.toLowerCase() || "";
return {
json: {
...lead,
domain,
hasCompanySite: Boolean(domain) && !FREE.includes(domain),
},
};Build it
Pick your tool — same automation, step by step.
Copy and paste straight into an n8n canvas (Ctrl+V), or download and use Import from File. Then connect your own credentials and replace every YOUR_… placeholder. AI steps use a Claude model node — swap it for OpenAI, Gemini or Ollama if you prefer.
Show code (263 lines)
{
"name": "Enrich new leads with company info → HubSpot (Flowngn)",
"nodes": [
{
"parameters": {
"content": "## Enrich new leads with company info → HubSpot\nAI reads the lead's company website and saves what they do, industry and size to HubSpot.\n\n**Setup**\n1. Open each node and connect your own credentials.\n2. Replace every YOUR_… placeholder.\n3. Test once, then activate.\n\nFree template from Flowngn",
"height": 260,
"width": 340
},
"id": "310bce97-ca1c-4fa1-afb0-742e29aedd75",
"name": "Setup notes",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-420,
-60
]
},
{
"parameters": {
"httpMethod": "POST",
"path": "lead-enrich",
"options": {}
},
"id": "310bce97-ca1c-4fa1-afb0-742e29aedd75",
"name": "New lead",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
0,
0
],
"webhookId": "310bce97-ca1c-4fa1-afb0-742e29aedd75"
},
{
"parameters": {
"jsCode": "// Mode: Run Once for Each Item\n// Gets the company website from a work email. Free email providers are skipped.\nconst FREE = [\"gmail.com\", \"yahoo.com\", \"hotmail.com\", \"outlook.com\", \"icloud.com\", \"live.com\", \"aol.com\", \"proton.me\"];\nconst lead = $json.body || {};\nconst domain = String(lead.email || \"\").split(\"@\")[1]?.toLowerCase() || \"\";\n\nreturn {\n json: {\n ...lead,\n domain,\n hasCompanySite: Boolean(domain) && !FREE.includes(domain),\n },\n};",
"mode": "runOnceForEachItem"
},
"id": "310bce97-ca1c-4fa1-afb0-742e29aedd75",
"name": "Find company site",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
300,
0
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "loose"
},
"conditions": [
{
"id": "c1",
"leftValue": "={{ $json.hasCompanySite }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "310bce97-ca1c-4fa1-afb0-742e29aedd75",
"name": "Work email?",
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
600,
0
]
},
{
"parameters": {
"url": "=https://{{ $json.domain }}",
"options": {}
},
"id": "310bce97-ca1c-4fa1-afb0-742e29aedd75",
"name": "Fetch company site",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
900,
0
],
"onError": "continueRegularOutput"
},
{
"parameters": {
"operation": "extractHtmlContent",
"extractionValues": {
"values": [
{
"key": "text",
"cssSelector": "body"
}
]
},
"options": {
"trimValues": true,
"cleanUpText": true
}
},
"id": "310bce97-ca1c-4fa1-afb0-742e29aedd75",
"name": "Extract page text",
"type": "n8n-nodes-base.html",
"typeVersion": 1.2,
"position": [
1200,
0
]
},
{
"parameters": {
"promptType": "define",
"text": "=From this homepage text, write: what the company does (1 sentence), likely industry, and approximate size (small/medium/large) if you can tell — say 'unknown' if not.\n\n{{ ($json.text || '').slice(0, 5000) }}"
},
"id": "310bce97-ca1c-4fa1-afb0-742e29aedd75",
"name": "Summarize company",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"typeVersion": 1.5,
"position": [
1500,
0
]
},
{
"parameters": {
"model": {
"__rl": true,
"value": "claude-sonnet-5",
"mode": "list"
},
"options": {}
},
"id": "310bce97-ca1c-4fa1-afb0-742e29aedd75",
"name": "Claude model",
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"typeVersion": 1.3,
"position": [
1500,
220
]
},
{
"parameters": {
"authentication": "appToken",
"resource": "contact",
"operation": "upsert",
"email": "={{ $('Find company site').item.json.email }}",
"additionalFields": {
"firstName": "={{ $('Find company site').item.json.name }}",
"website": "=https://{{ $('Find company site').item.json.domain }}",
"message": "={{ $json.text }}"
}
},
"id": "310bce97-ca1c-4fa1-afb0-742e29aedd75",
"name": "Save to HubSpot",
"type": "n8n-nodes-base.hubspot",
"typeVersion": 2.1,
"position": [
1800,
0
]
}
],
"connections": {
"New lead": {
"main": [
[
{
"node": "Find company site",
"type": "main",
"index": 0
}
]
]
},
"Find company site": {
"main": [
[
{
"node": "Work email?",
"type": "main",
"index": 0
}
]
]
},
"Work email?": {
"main": [
[
{
"node": "Fetch company site",
"type": "main",
"index": 0
}
]
]
},
"Fetch company site": {
"main": [
[
{
"node": "Extract page text",
"type": "main",
"index": 0
}
]
]
},
"Extract page text": {
"main": [
[
{
"node": "Summarize company",
"type": "main",
"index": 0
}
]
]
},
"Summarize company": {
"main": [
[
{
"node": "Save to HubSpot",
"type": "main",
"index": 0
}
]
]
},
"Claude model": {
"ai_languageModel": [
[
{
"node": "Summarize company",
"type": "ai_languageModel",
"index": 0
}
]
]
}
},
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"meta": {
"templateCredsSetupCompleted": false
},
"tags": []
}In Make, create a new scenario and add these modules in order:
- Webhooks › Custom webhook
- Tools › Set variable / Iterator + Array aggregator (same logic as the Code step)
- Filter on the next route: “Work email?”
- If yesHTTP › Make a request
- If yesText parser › HTML to text (or Match pattern)
- If yesAnthropic Claude › Create a Prompt (or OpenAI › Create a Completion)
- If yesHubSpot CRM › Create/Update a Contact
- Every module run uses Make operations — the free plan includes a monthly quota.
- Make's built-in functions (map, sum, formatDate…) can replace most Code steps; for complex logic use a code module.
- Module and step names can differ slightly as Make and Zapier update their apps.
In Zapier, create a new Zap and add these steps in order:
- Webhooks by Zapier — Catch Hook
- Code by Zapier — Run JavaScript (paste the code from the Code section)
- Filter by Zapier: “Work email?”
- If yesWebhooks by Zapier — GET
- If yesFormatter by Zapier — Text › Extract
- If yesAnthropic (Claude) — Send Message (or ChatGPT — Conversation)
- If yesHubSpot — Create or Update Contact
- Zaps with more than two steps need a paid Zapier plan.
- Webhooks, Filters/Paths and Code by Zapier are premium features on some Zapier plans.
- Code by Zapier runs JavaScript: reuse the code shown above, reading inputs from inputData instead of $json.
- Module and step names can differ slightly as Make and Zapier update their apps.
Tips
- Add a lead-score step after the summary to prioritise the best fits.
Related flows
AI lead qualifier
AI scores each new lead and fast-tracks the hot ones to your sales team.
Automatic meeting prep brief
When a meeting is booked, get a short AI brief about the company you're meeting.
AI spam filter for contact forms
AI checks every form message and only real inquiries reach your team.