AutomationFlowsData & Sheets › Turn Closed-won Hubspot Deals Into Lookalike Prospects with Companyenrich

Turn Closed-won Hubspot Deals Into Lookalike Prospects with Companyenrich

ByCompanyEnrich @companyenrich on n8n.io

This n8n template automates turning your Closed-Won HubSpot deals into lookalike prospects using the CompanyEnrich Similar Companies API.

Cron / scheduled trigger★★★★☆ complexity13 nodesHubSpotHTTP RequestGoogle Sheets
Data & Sheets Trigger: Cron / scheduled Nodes: 13 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #12227 — we link there as the canonical source.

This workflow follows the Google Sheets → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "aV5QPamKOio5d9Mw",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Turn Closed-Won Deals in HubSpot into Lookalike Prospects with CompanyEnrich",
  "tags": [],
  "nodes": [
    {
      "id": "8ffe9d28-e2ac-4944-8a3e-a4885d59570d",
      "name": "HubSpot Get Companies",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        784,
        0
      ],
      "parameters": {
        "options": {},
        "resource": "company",
        "operation": "getAll",
        "returnAll": true,
        "authentication": "appToken"
      },
      "credentials": {
        "hubspotAppToken": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "48c631ab-0c40-432a-9a3f-64145715599d",
      "name": "Extract Domain",
      "type": "n8n-nodes-base.function",
      "position": [
        1072,
        0
      ],
      "parameters": {
        "functionCode": "return items.map(item => {\n  const p = item.json.properties || {};\n  const domain =\n    p.domain?.value ||\n    p.website?.value ||\n    \"\";\n\n  return {\n    json: {\n      domain: domain\n    }\n  };\n});\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c24adfbd-c9cd-44e1-b4de-74fd9777c39d",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1408,
        16
      ],
      "parameters": {
        "url": "https://api.companyenrich.com/companies/similar",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"domain\": \"{{$json.domain}}\"\n}\n",
        "sendBody": true,
        "sendQuery": true,
        "jsonHeaders": "{\n  \"Authorization\": \"Bearer YOUR_TOKEN_HERE\",\n  \"Content-Type\": \"application/json\",\n  \"Accept\": \"application/json\"\n}\n",
        "sendHeaders": true,
        "specifyBody": "json",
        "specifyHeaders": "json",
        "queryParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "49d30f0e-9c71-4827-b4ac-1a655740b434",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1216,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "a643226b-e609-479e-ae05-c6300a28f1d4",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1552,
        16
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "items"
      },
      "typeVersion": 1
    },
    {
      "id": "f27db202-e1a4-4a93-a1f5-8ce1b65064b5",
      "name": "Edit Fields1",
      "type": "n8n-nodes-base.set",
      "position": [
        1696,
        16
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{\n  JSON.stringify(\n    Object.fromEntries(\n      Object.entries({\n        id: $json.id,\n        name: $json.name,\n        domain: $json.domain,\n        website: $json.website,\n        type: $json.type,\n        industry: $json.industry,\n        industries: $json.industries,\n        categories: $json.categories,\n        employees: $json.employees,\n        revenue: $json.revenue,\n        description: $json.description,\n        keywords: $json.keywords,\n        technologies: $json.technologies,\n        founded_year: $json.founded_year,\n        naics_codes: $json.naics_codes,\n        address: $json.address,\n        city: $json.city,\n        state: $json.state,\n        country: $json.country,\n        postal_code: $json.postal_code,\n        phone: $json.phone,\n        linkedin: $json.linkedin,\n        twitter: $json.twitter,\n        facebook: $json.facebook,\n        instagram: $json.instagram,\n        youtube: $json.youtube,\n        crunchbase: $json.crunchbase,\n        angellist: $json.angellist,\n        g2: $json.g2,\n        stock_symbol: $json.stock_symbol,\n        stock_exchange: $json.stock_exchange,\n        total_funding: $json.total_funding,\n        funding_stage: $json.funding_stage,\n        logo_url: $json.logo_url,\n        page_rank: $json.page_rank,\n        seo_description: $json.seo_description,\n        updated_at: $json.updated_at\n      }).map(([k, v]) => [\n        k,\n        typeof v === \"string\" ? v.replace(/\\n/g, \" \") : v\n      ])\n    ),\n    null,\n    2\n  )\n}}\n"
      },
      "typeVersion": 3.4
    },
    {
      "id": "987d2638-b3b6-450c-9be2-9f71d6b145c9",
      "name": "Append or update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1840,
        16
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "domain",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "domain",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "website",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "type",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "industry",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "industry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "industries",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "industries",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "categories",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "categories",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "employees",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "employees",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "revenue",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "revenue",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "description",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "keywords",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "keywords",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "technologies",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "technologies",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "founded_year",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "founded_year",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "naics_codes",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "naics_codes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "logo_url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "logo_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "page_rank",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "page_rank",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seo_description",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "seo_description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "updated_at",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "updated_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [
            "domain"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1enX_G1yJQm-JYrYN93gGMFAYtkeOovsjGdHuQuH_r9I/edit#gid=0",
          "cachedResultName": "Sayfa1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1enX_G1yJQm-JYrYN93gGMFAYtkeOovsjGdHuQuH_r9I",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1enX_G1yJQm-JYrYN93gGMFAYtkeOovsjGdHuQuH_r9I/edit?usp=drivesdk",
          "cachedResultName": "Similar companies"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "ccdbd7ea-211d-46e4-9417-ec9b34058d54",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -464
      ],
      "parameters": {
        "color": 2,
        "width": 512,
        "height": 656,
        "content": "## Turn Closed-Won Deals in HubSpot into Lookalike Prospects with CompanyEnrich\n\n### \ud83d\udccc How This Workflow Works?\n1. **Schedule Trigger:** Executes the workflow start of every week and get your best customers from hubspot crm \n2. **Extract Domain:** Extracts the domain seeds of the companies for CompanyEnrich lookalike companies API.\n3. **Append or Update sheet:** Adds newfound similar companies to your google sheet\n\n### \ud83d\udee0\ufe0f Before using\n\u2714 Create an Hubspot private app with company read and write scopes, add your app's credentials to the hubspot node.  \n\u2714 Ensure companies have a valid domain (required for enrichment)  \n\u2714 Create an Company Enrich account and enter your api key to HTTP Request node's header where it says `YOUR_API_KEY`.  \n\u2714 Create a google sheet with a column named 'domain' and connect your google account to the google sheet node. Choose sheet within document as your resource, choose your sheet name for document and for sheet choose a page of the sheet that you writed domain in a column\n\n### CUSTOMIZATION\n1. **Filters:** Change the Top percent value to an another percent.  \n2. **Schedule:** Change the interval the workflow gets executed\n\n\nFor more customization instructions, check the respective node\u2019s sticky notes."
      },
      "typeVersion": 1
    },
    {
      "id": "bc2225e0-ed12-4af2-9969-94de6e0f2199",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        624,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5a933ec5-2103-430f-aaef-6984d9aadd26",
      "name": "Filter Best",
      "type": "n8n-nodes-base.function",
      "position": [
        928,
        0
      ],
      "parameters": {
        "functionCode": "const TOP_PERCENT = 5;\nconst companies = items.map(i => i.json);\n\n\ncompanies.sort((a, b) => {\n  const revA = parseFloat(a.properties?.annualrevenue || 0);\n  const revB = parseFloat(b.properties?.annualrevenue || 0);\n  return revB - revA;\n});\n\nconst count = Math.max(1, Math.floor(companies.length * (TOP_PERCENT / 100)));\n\nconst topCompanies = companies.slice(0, count);\nreturn topCompanies.map(c => ({ json: c }));\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0c94989f-669a-4f2a-a63c-f6c43089b0e3",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1552,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 384,
        "height": 352,
        "content": "## Update Sheet\n\n### \u26a0\ufe0f Avoid Duplicates \nYour sheet must contain a column named: domain\nThe workflow uses this column to detect existing companies"
      },
      "typeVersion": 1
    },
    {
      "id": "f401e45d-9fd5-4a49-a7f0-e24b752c5952",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        -192
      ],
      "parameters": {
        "color": 7,
        "width": 544,
        "height": 384,
        "content": "## Schedule Trigger and Filter\n\n1. Change the interval at which the workflow runs inside schedule trigger node.\n2. Adjust the **Top_Percent** value in the Filter node code:\n   - Use higher values (10\u201320%) if you have fewer companies\n   - Use lower values (around 1%) if you have many companies\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5d925dfd-84eb-4ff7-9c44-c1aa807731aa",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1216,
        -144
      ],
      "parameters": {
        "color": 7,
        "width": 288,
        "height": 336,
        "content": "## Enrichment Loop\n\nEnter your CompanyEnrich API key in the **HTTP Request** node where it says `YOUR_API_KEY`.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b04aafa9-5057-4c93-a044-1600881c62b8",
  "connections": {
    "Split Out": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Best": {
      "main": [
        [
          {
            "node": "Extract Domain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Domain": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "HubSpot Get Companies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HubSpot Get Companies": {
      "main": [
        [
          {
            "node": "Filter Best",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append or update row in sheet": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n template automates turning your Closed-Won HubSpot deals into lookalike prospects using the CompanyEnrich Similar Companies API.

Source: https://n8n.io/workflows/12227/ — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

This workflow automates video distribution to 9 social platforms simultaneously using Blotato's API. It includes both a scheduled publisher (checks Google Sheets for videos marked "Ready") and a subwo

Google Sheets, HTTP Request, Form Trigger +2
Data & Sheets

YogiAI. Uses googleSheets, googleSheetsTool, httpRequest, stopAndError. Scheduled trigger; 61 nodes.

Google Sheets, Google Sheets Tool, HTTP Request +1
Data & Sheets

This workflow monitors Google Calendar for events indicating that a customer will visit the company today or the next day, retrieves the required details, and sends reminder notifications to the relev

Google Calendar, Google Sheets, HTTP Request +1
Data & Sheets

ofn hook v0.24.0 beta. Uses start, httpRequest, functionItem, itemLists. Scheduled trigger; 42 nodes.

Start, HTTP Request, Function Item +3
Data & Sheets

Security teams, DevOps engineers, vulnerability analysts, and automation builders who want to eliminate repetitive Nessus scan parsing, AI-based risk triage, and manual reporting. Designed for orgs fo

Email Send, HTTP Request, Google Sheets +1