{
  "name": "Bulk Data Enrichment with Lusha",
  "nodes": [
    {
      "id": "eff84dbb-8333-4b82-9045-ace5385530c0",
      "name": "\ud83d\udccb Bulk Data Enrichment",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        -440
      ],
      "parameters": {
        "width": 860,
        "height": 420,
        "content": "## Bulk Data Enrichment with Lusha\n\n**Who it's for:** Marketing Ops & RevOps teams preparing campaign lists\n\n**What it does:** Upload campaign lists or CSV files, enrich them in batch with Lusha, and export records with emails, phones, and confidence scores.\n\n### How it works\n1. Trigger manually or on a schedule\n2. Read contacts from a spreadsheet/CSV\n3. Batch contacts into groups of up to 100\n4. Send each batch to Lusha Bulk Enrichment API\n5. Merge results and write enriched CSV\n\n### Setup\n1. Install the Lusha community node\n2. Add your Lusha API credentials\n3. Place your CSV/XLSX file in the configured path\n4. Run manually or set a schedule"
      },
      "typeVersion": 1
    },
    {
      "id": "2982ba81-2735-4a87-91ee-362ca34f123d",
      "name": "\ud83d\udce5 1. Read & Batch Input",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -30,
        30
      ],
      "parameters": {
        "color": 7,
        "width": 500,
        "height": 270,
        "content": "Trigger the workflow manually, read your CSV file, and split contacts into batches of 100 for efficient API usage.\n\n**Nodes:** Manual Trigger \u2192 Read CSV \u2192 Split In Batches\n\n\ud83d\udca1 Place your CSV file with an `email` column in the configured path before running."
      },
      "typeVersion": 1
    },
    {
      "id": "32464ea9-acda-4bc3-bf80-0faeeb951f0f",
      "name": "\ud83d\udd04 2. Bulk Enrich with Lusha",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        30
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 270,
        "content": "Each batch is formatted into the Lusha Bulk Enrichment API payload and sent as a single call. Returns phone, email, job title, seniority, and company firmographics.\n\n**Nodes:** Format Batch \u2192 Lusha Bulk Enrich\n\n\ud83d\udcd6 [Lusha API docs](https://www.lusha.com/docs/)"
      },
      "typeVersion": 1
    },
    {
      "id": "5157216a-d957-40de-b632-d033b91b5b32",
      "name": "\ud83d\udce4 3. Format & Export CSV",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1270,
        30
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 270,
        "content": "Enriched results are flattened into a clean tabular format and exported as a new CSV file.\n\n**Nodes:** Format Results \u2192 Export CSV\n\nThe output file `enriched_contacts.csv` contains: name, email, phone, title, seniority, company, industry, size, revenue."
      },
      "typeVersion": 1
    },
    {
      "id": "d9946b52-821d-4f9a-824b-7fba030bdebe",
      "name": "Start Manually",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        300
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "5d7f0fdb-cc4b-4d0a-8a17-305eee22f68d",
      "name": "Read CSV File",
      "type": "n8n-nodes-base.spreadsheetFile",
      "position": [
        280,
        300
      ],
      "parameters": {
        "options": {},
        "fileFormat": "csv"
      },
      "typeVersion": 2
    },
    {
      "id": "521d495f-214f-43c5-aeea-afaa13a32035",
      "name": "Batch into Groups of 100",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        560,
        300
      ],
      "parameters": {
        "options": {},
        "batchSize": 100
      },
      "typeVersion": 3
    },
    {
      "id": "876357b7-31a6-4071-87a2-317f26cc3a98",
      "name": "Format Batch for Lusha",
      "type": "n8n-nodes-base.code",
      "position": [
        840,
        300
      ],
      "parameters": {
        "jsCode": "// Format contacts for Lusha Bulk Enrichment API\n// Builds the full payload: { contacts: [...], metadata: {} }\nconst items = $input.all();\nlet contactIdCounter = 1;\n\nconst contacts = items\n  .filter(item => item.json.email)\n  .map(item => ({\n    contactId: String(contactIdCounter++),\n    email: item.json.email\n  }));\n\nconst payload = {\n  contacts,\n  metadata: {}\n};\n\nreturn [{ json: { contactsPayload: JSON.stringify(payload) } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "2d7f7382-0135-4d4e-986c-82f7d1dbd881",
      "name": "Enrich contacts in bulk",
      "type": "@lusha-org/n8n-nodes-lusha.lusha",
      "position": [
        1120,
        300
      ],
      "parameters": {
        "bulkType": "json",
        "operation": "enrichBulk",
        "contactsPayloadJson": "={{ $json.contactsPayload }}",
        "contactBulkAdditionalOptions": {}
      },
      "credentials": {
        "lushaApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6791b3ec-76a1-4f7e-ada7-8f4c8184f7f8",
      "name": "Format Enriched Results",
      "type": "n8n-nodes-base.code",
      "position": [
        1400,
        300
      ],
      "parameters": {
        "jsCode": "// Flatten enriched results into rows for CSV export\nconst items = $input.all();\nconst results = [];\n\nfor (const item of items) {\n  const d = item.json;\n  results.push({\n    json: {\n      firstName: d.firstName || '',\n      lastName: d.lastName || '',\n      email: d.primaryEmail || '',\n      emailType: d.primaryEmailType || '',\n      phone: d.primaryPhone || '',\n      phoneType: d.primaryPhoneType || '',\n      jobTitle: d.jobTitle || '',\n      seniority: d.seniority || '',\n      company: d.companyName || '',\n      companyDomain: d.companyDomain || '',\n      industry: d.companyMainIndustry || '',\n      companySize: d.companySize || '',\n      revenueRange: d.revenueRange || '',\n      location: d.companyLocation || '',\n      enrichedAt: new Date().toISOString()\n    }\n  });\n}\n\nreturn results;"
      },
      "typeVersion": 2
    },
    {
      "id": "047b6211-af42-4620-ba13-53abc785dcec",
      "name": "Export Enriched CSV",
      "type": "n8n-nodes-base.spreadsheetFile",
      "position": [
        1680,
        300
      ],
      "parameters": {
        "options": {
          "fileName": "enriched_contacts.csv"
        },
        "operation": "toFile",
        "fileFormat": "csv"
      },
      "typeVersion": 2
    }
  ],
  "connections": {
    "Read CSV File": {
      "main": [
        [
          {
            "node": "Batch into Groups of 100",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Manually": {
      "main": [
        [
          {
            "node": "Read CSV File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Batch for Lusha": {
      "main": [
        [
          {
            "node": "Enrich contacts in bulk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enrich contacts in bulk": {
      "main": [
        [
          {
            "node": "Format Enriched Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Enriched Results": {
      "main": [
        [
          {
            "node": "Export Enriched CSV",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Batch into Groups of 100": {
      "main": [
        [
          {
            "node": "Format Batch for Lusha",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}