{
  "id": "9eHLrZ1UTA4digag",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Company Lead List Building and Deep Company Enrich",
  "tags": [],
  "nodes": [
    {
      "id": "b060d9f8-6975-45da-8856-bd4b4614de41",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3088,
        960
      ],
      "parameters": {
        "width": 480,
        "height": 688,
        "content": "## Company Lead List Building and Deep Company Enrich\n\n### How it works\n\n1. Initializes the process from a search form for company criteria.\n2. Fetches companies from an API based on the search criteria.\n3. Filters data by revenue and processes each company in batches.\n4. Enriches each company's data through an API.\n5. Filters and checks for duplicates before inserting the data.\n\n### Setup steps\n\n- [ ] Set up API credentials for https://api.companyenrich.com\n- [ ] Configure the search form with criteria fields\n- [ ] Define data table structure for storing results\n\n### Customization\n\nThe workflow can be customized to include additional API calls or different filtering criteria based on business needs."
      },
      "typeVersion": 1
    },
    {
      "id": "32dd8f39-79fa-42d4-8b2b-af18b0dcae2a",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2528,
        1008
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 384,
        "content": "## Initialize search criteria\n\nBegins the workflow with a search criteria form to trigger the search process for companies."
      },
      "typeVersion": 1
    },
    {
      "id": "e65ecc33-4194-4ce7-9d7e-0058ec8e07b5",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2048,
        1104
      ],
      "parameters": {
        "color": 7,
        "width": 784,
        "height": 272,
        "content": "## Company search and extraction\n\nFetches companies using an API and splits the results for filtering by revenue."
      },
      "typeVersion": 1
    },
    {
      "id": "3c4b5c09-a6c6-495b-8501-e8225a8d1b5f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1168,
        960
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 512,
        "content": "## Batch processing and rate limiting\n\nProcesses companies in batches and applies a delay to handle API rate limits."
      },
      "typeVersion": 1
    },
    {
      "id": "095f95af-843a-454d-bcc9-cb3417025f0f",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        1248
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 304,
        "content": "## Enrich and filter data\n\nEnriches company data using another API call and filters the enriched data."
      },
      "typeVersion": 1
    },
    {
      "id": "124ee7ae-294a-4990-9210-933fecd50c11",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        1232
      ],
      "parameters": {
        "color": 7,
        "width": 624,
        "height": 320,
        "content": "## Check duplicates and store data\n\nChecks for duplicates before inserting the final enriched data into a data table."
      },
      "typeVersion": 1
    },
    {
      "id": "f79690f0-cc75-41b4-9dea-963178815156",
      "name": "Batch Process Companies",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1120,
        1216
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "fadb5d8b-eafa-4db0-a410-783e9a0a1642",
      "name": "Trigger Search Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -2480,
        1216
      ],
      "parameters": {
        "options": {
          "appendAttribution": false
        },
        "formTitle": "Company Search",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Describe in plain english",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Enter criteria to find and enrich companies"
      },
      "typeVersion": 2.3
    },
    {
      "id": "ada5698d-b758-4536-ae32-db456f417eeb",
      "name": "Post to Company Search API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2000,
        1216
      ],
      "parameters": {
        "url": "https://api.companyenrich.com/companies/search",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "semanticQuery",
              "value": "={{ $json['Describe in plain english'] }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "df117c81-2c72-4540-bb60-2912ec5ba41c",
      "name": "Split Company Listings",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -1664,
        1216
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "items"
      },
      "typeVersion": 1
    },
    {
      "id": "bb90e339-1ce6-4535-8761-a1038185ead6",
      "name": "Post to Company Enrich API",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        -672,
        1376
      ],
      "parameters": {
        "url": "https://api.companyenrich.com/companies/enrich",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "linkedinUrl",
              "value": "={{ $('Filter by Company Revenue').item.json.socials.linkedin_url }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "b481a172-23fd-47a1-95d9-140fd515dbbb",
      "name": "Wait 1 Second",
      "type": "n8n-nodes-base.wait",
      "position": [
        -912,
        1296
      ],
      "parameters": {
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "7bff9515-2f63-4eeb-9fb7-ea2a20a1b8be",
      "name": "If Company Duplicate Exists",
      "type": "n8n-nodes-base.if",
      "position": [
        48,
        1376
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "778c21ee-8365-4da6-8069-ca73f797a0a2",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $json?.fields?.['Company Name'] ? true : false }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "ab8c62ef-83d3-4135-8051-30ee3c6ddf82",
      "name": "Skip Processing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -928,
        1088
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "36798f5b-4f9d-46d7-b061-f6fe71ed4394",
      "name": "Filter Enriched Companies",
      "type": "n8n-nodes-base.filter",
      "position": [
        -416,
        1376
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f5952e81-bc08-4a4a-ad2c-edae872a4fe1",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.name }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "06a8c640-d46a-4d56-851c-a73ddc0fa6ba",
      "name": "Add Company to Table",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        272,
        1360
      ],
      "parameters": {
        "columns": {
          "value": {
            "Domain": "={{ $('Post to Company Enrich API').item.json.domain }}",
            "Address": "={{ $('Post to Company Enrich API').item.json.location.address }}",
            "Country": "={{ $('Post to Company Enrich API').item.json.location.country.name }}",
            "Revenue": "={{ $('Post to Company Enrich API').item.json.revenue }}",
            "Website": "={{ $('Post to Company Enrich API').item.json.website }}",
            "Industry": "={{ $('Post to Company Enrich API').item.json.industry }}",
            "Discription": "={{ $('Post to Company Enrich API').item.json.description }}",
            "Company_Name": "={{ $('Post to Company Enrich API').item.json.name }}",
            "LinkedIn_url": "={{ $('Post to Company Enrich API').item.json.socials.linkedin_url }}",
            "Phone_number": "={{ $('Post to Company Enrich API').item.json.location.phone }}",
            "founded_year": "={{ $('Post to Company Enrich API').item.json.founded_year }}",
            "Total_funding": "={{ $('Post to Company Enrich API').item.json.financial.total_funding }}",
            "nb_of_employees": "={{ $('Post to Company Enrich API').item.json.employees }}"
          },
          "schema": [
            {
              "id": "Company_Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Company_Name",
              "defaultMatch": false
            },
            {
              "id": "Discription",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Discription",
              "defaultMatch": false
            },
            {
              "id": "Domain",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Domain",
              "defaultMatch": false
            },
            {
              "id": "Website",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Website",
              "defaultMatch": false
            },
            {
              "id": "Industry",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Industry",
              "defaultMatch": false
            },
            {
              "id": "nb_of_employees",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "nb_of_employees",
              "defaultMatch": false
            },
            {
              "id": "Revenue",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Revenue",
              "defaultMatch": false
            },
            {
              "id": "founded_year",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "founded_year",
              "defaultMatch": false
            },
            {
              "id": "Country",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Country",
              "defaultMatch": false
            },
            {
              "id": "Address",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Address",
              "defaultMatch": false
            },
            {
              "id": "Phone_number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Phone_number",
              "defaultMatch": false
            },
            {
              "id": "LinkedIn_url",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "LinkedIn_url",
              "defaultMatch": false
            },
            {
              "id": "Total_funding",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Total_funding",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "4k77KyqABryWNCqH",
          "cachedResultUrl": "/projects/dWzMD7m5v6h7eU4n/datatables/4k77KyqABryWNCqH",
          "cachedResultName": "Company Lead List & Company Enrichment"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "a67cca8a-6006-4bc1-86a5-2d012228a5f3",
      "name": "Verify Company Entry",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -160,
        1376
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "Company_Name",
              "keyValue": "={{ $json.name }}"
            }
          ]
        },
        "operation": "rowExists",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "4k77KyqABryWNCqH",
          "cachedResultUrl": "/projects/dWzMD7m5v6h7eU4n/datatables/4k77KyqABryWNCqH",
          "cachedResultName": "Company Lead List & Company Enrichment"
        }
      },
      "typeVersion": 1.1,
      "alwaysOutputData": true
    },
    {
      "id": "91eebed1-778a-4c4e-84bf-1f2b291c96b0",
      "name": "Filter by Company Revenue",
      "type": "n8n-nodes-base.filter",
      "position": [
        -1408,
        1216
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d7b45125-6a6e-40ca-b847-7b1f0776faac",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.revenue }}",
              "rightValue": "1m-10m"
            }
          ]
        }
      },
      "typeVersion": 2.2
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "b464972a-da61-4183-a6a7-6700fc7fce1f",
  "connections": {
    "Wait 1 Second": {
      "main": [
        [
          {
            "node": "Post to Company Enrich API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger Search Form": {
      "main": [
        [
          {
            "node": "Post to Company Search API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Company to Table": {
      "main": [
        [
          {
            "node": "Batch Process Companies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify Company Entry": {
      "main": [
        [
          {
            "node": "If Company Duplicate Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Company Listings": {
      "main": [
        [
          {
            "node": "Filter by Company Revenue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Batch Process Companies": {
      "main": [
        [
          {
            "node": "Skip Processing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 1 Second",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Enriched Companies": {
      "main": [
        [
          {
            "node": "Verify Company Entry",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter by Company Revenue": {
      "main": [
        [
          {
            "node": "Batch Process Companies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Company Enrich API": {
      "main": [
        [
          {
            "node": "Filter Enriched Companies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Company Search API": {
      "main": [
        [
          {
            "node": "Split Company Listings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Company Duplicate Exists": {
      "main": [
        [
          {
            "node": "Add Company to Table",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Batch Process Companies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}