{
  "id": "mRgXdEjoP0AtgLpC",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Find Similar Companies to your Best Customers with CompanyEnrich",
  "tags": [],
  "nodes": [
    {
      "id": "1b41631b-802b-4165-80e6-0e6b63d1c8a1",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        224,
        416
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d377c0b5-0e05-49fd-ad9c-3bf0b6634e0d",
      "name": "Read Source List",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        448,
        416
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/148uMDDvJLyCKwgClg8tdaMDwxYPXPxsv6EWCyH11R4s/edit#gid=0",
          "cachedResultName": "Source List"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "148uMDDvJLyCKwgClg8tdaMDwxYPXPxsv6EWCyH11R4s",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/148uMDDvJLyCKwgClg8tdaMDwxYPXPxsv6EWCyH11R4s/edit?usp=drivesdk",
          "cachedResultName": "Find Company Lookalikes"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "e72e4a93-080d-4764-84cc-41843e8a2337",
      "name": "Fetch Similar Companies",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        688,
        304
      ],
      "parameters": {
        "url": "https://api.companyenrich.com/companies/similar",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "domain",
              "value": "={{ $json.Domain }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "fefc9918-e47c-486c-b32b-5e8521e82887",
      "name": "Merge Source & API",
      "type": "n8n-nodes-base.merge",
      "position": [
        928,
        416
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3
    },
    {
      "id": "5d30848c-8e23-4fda-9f4d-f772c6f3593a",
      "name": "Split Out Items",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1152,
        416
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "items"
      },
      "typeVersion": 1
    },
    {
      "id": "a2bcde30-9417-4cca-85c8-15b4e9427144",
      "name": "Write Results",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1376,
        416
      ],
      "parameters": {
        "columns": {
          "value": {
            "Added Date": "={{ $now }}",
            "Source Domain": "={{ $json.Domain }}",
            "Similar Domain": "={{ $json.items.domain }}",
            "Similarity Score": "={{ $json.metadata.scores[$json.items.id] }}",
            "Similar Company Name": "={{ $json.items.name }}"
          },
          "schema": [
            {
              "id": "Source Domain",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Source Domain",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Similar Company Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Similar Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Similar Domain",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Similar Domain",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Similarity Score",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Similarity Score",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Added Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Added Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1540563700,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/148uMDDvJLyCKwgClg8tdaMDwxYPXPxsv6EWCyH11R4s/edit#gid=1540563700",
          "cachedResultName": "Lookalike Results"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "148uMDDvJLyCKwgClg8tdaMDwxYPXPxsv6EWCyH11R4s",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/148uMDDvJLyCKwgClg8tdaMDwxYPXPxsv6EWCyH11R4s/edit?usp=drivesdk",
          "cachedResultName": "Find Company Lookalikes"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "69d92bb2-9852-4233-88d7-8adfd799ec98",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        -256
      ],
      "parameters": {
        "width": 608,
        "height": 864,
        "content": "## How it works\nThis workflow expands your target list by finding companies similar to your existing leads.\n1. **Reads Data:** It grabs a list of domains from your Google Sheet.\n2. **Enriches:** It queries the CompanyEnrich API to find \"lookalike\" companies for each domain.\n3. **Formats:** It processes the JSON response to separate individual company results into rows.\n4. **Saves:** Finally, it appends the new company details (Name, Domain, Similarity Score) to your results sheet.\n\n## Setup steps\n1. **Google Sheets:** Create a spreadsheet. In the first tab, create a column named `Domain` and list your target websites. Create a second empty tab for the results.\n2. **Configure Sheets Nodes:** Open the \"Read Source List\" and \"Write Results\" nodes. Select your specific spreadsheet and the respective tabs.\n3. **API Key:** Open the \"Fetch Similar Companies\" node. In the Headers section, replace the placeholder in `Authorization` with your actual CompanyEnrich API Key (Bearer Token).\n\n## Beginner Guide\nYou can watch the quick guide to get started @[youtube](guD5yxlKm0o)"
      },
      "typeVersion": 1
    },
    {
      "id": "e09f73b8-de32-46fb-94a6-5a6ea01a0022",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        320
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 288,
        "content": "## 1. Get Input Data\nThis section triggers the workflow and reads the list of target domains from your Google Sheet."
      },
      "typeVersion": 1
    },
    {
      "id": "fb01cc46-baca-4fb2-bb78-afc7309a04ab",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        208
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 400,
        "content": "## 2. Enrich & Process\nQueries the API to find lookalikes, merges the results with the original data, and splits the list so each similar company gets its own row."
      },
      "typeVersion": 1
    },
    {
      "id": "274b4530-bd73-483c-90fe-67a08e071a64",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        304
      ],
      "parameters": {
        "color": 7,
        "width": 288,
        "height": 304,
        "content": "## 3. Save Results\nWrites the newly discovered companies, their domains, and similarity scores into your destination sheet."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "saveExecutionProgress": true,
    "saveDataErrorExecution": "all",
    "saveDataSuccessExecution": "all"
  },
  "versionId": "c773b703-dbfe-47af-b6dd-daabf1b443af",
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Read Source List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Items": {
      "main": [
        [
          {
            "node": "Write Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Source List": {
      "main": [
        [
          {
            "node": "Fetch Similar Companies",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge Source & API",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge Source & API": {
      "main": [
        [
          {
            "node": "Split Out Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Similar Companies": {
      "main": [
        [
          {
            "node": "Merge Source & API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}