Enrich new leads with company info → HubSpot

AI reads the lead's company website and saves what they do, industry and size to HubSpot.

Advanced Saves ~8 hours/month Sales & CRMBy Flowngn team

Works with n8n · Make · Zapier

How it works

Trigger: Webhook — new lead from your form
  1. Receive the lead's name and work email.
  2. Skip free email providers; otherwise take the company domain.
  3. Fetch the company homepage and let AI summarise what they do, industry and size.
  4. Create or update the contact in HubSpot with the summary.

Diagram

trueNew leadWebhook{ }Find company siteCode⑂Work email?IfFetch company siteHTTP Request</>Extract page textHTMLSummarize companyBasic LLM ChainClaude modelAnthropic Chat Mo…HSave to HubSpotHubSpot
Trigger App Logic Code AI

Code

JavaScript used in the Code step — already included in the template below.

Find company site · Code node
// 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.

Workflow JSON
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": []
}

Open in the playground to edit →

Tips

  • Add a lead-score step after the summary to prioritise the best fits.

Related flows