{
  "name": "Scrape B2B leads from Apollo, generate Groq AI emails, and send via Gmail",
  "nodes": [
    {
      "id": "7d7490a0-d44e-44f2-a794-81f581707b34",
      "name": "Parse Email JSON",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2144,
        864
      ]
    },
    {
      "id": "c1483978-9b8c-4dfa-b224-b3faf673e708",
      "name": "Filter Pending Leads",
      "type": "n8n-nodes-base.if",
      "position": [
        1552,
        704
      ]
    },
    {
      "id": "3dde7c70-e762-4b8c-ab2c-d21b858c54e9",
      "name": "AI Cold Email Writer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2000,
        656
      ]
    },
    {
      "id": "59dab260-3e2c-48d0-be54-f5c823d25e1b",
      "name": "Groq LLM (Fast AI)",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        2000,
        864
      ]
    },
    {
      "id": "79a4f3fc-0a6d-4a6c-b86c-b713052a5866",
      "name": "Save Email to Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2352,
        656
      ]
    },
    {
      "id": "5db70332-f89a-4dfd-a41c-f0376c4a3784",
      "name": "Apollo — Search Leads",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -320,
        1328
      ]
    },
    {
      "id": "cfbd6839-323b-425a-8a6f-654c388b172a",
      "name": "Apollo — Enrich Lead Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1808,
        1280
      ]
    },
    {
      "id": "d0e5d3d8-9800-4a72-9600-3beb170208fc",
      "name": "Format & Clean Lead Data",
      "type": "n8n-nodes-base.code",
      "position": [
        2032,
        1280
      ]
    },
    {
      "id": "f67ebebf-3686-4b51-b99f-d31305d3103f",
      "name": "Save Leads to Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2256,
        1360
      ]
    },
    {
      "id": "04b41b53-8a87-4c59-a904-96a7f0a091ef",
      "name": "Fetch Leads from Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1328,
        704
      ]
    },
    {
      "id": "2cbc42cd-ac15-4d44-9c44-256fc2ad46cd",
      "name": "Extract People Data",
      "type": "n8n-nodes-base.code",
      "position": [
        -96,
        1328
      ]
    },
    {
      "id": "1345a443-3a7c-47a3-a0d2-a83665a24883",
      "name": "Skip Duplicates",
      "type": "n8n-nodes-base.if",
      "position": [
        1296,
        1280
      ]
    },
    {
      "id": "fffee28e-4576-46af-a852-72f907cedd5e",
      "name": "Fetch Existing Lead IDs",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        576,
        1328
      ]
    },
    {
      "id": "5651f559-a244-4a6a-83e4-305433b76e50",
      "name": "Merge for Dedup Check",
      "type": "n8n-nodes-base.merge",
      "position": [
        784,
        1248
      ]
    },
    {
      "id": "1adc479f-f521-446f-ada1-68152b222c7f",
      "name": "Deduplicate Leads",
      "type": "n8n-nodes-base.code",
      "position": [
        1040,
        1280
      ]
    },
    {
      "id": "868b04b4-f9b4-47c4-86fa-58f0cef5f4ef",
      "name": "Process Each Lead",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        128,
        1328
      ]
    },
    {
      "id": "a4e420a7-09c6-4871-9e69-302870757580",
      "name": "Lead Generation Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -512,
        1328
      ]
    },
    {
      "id": "3371908a-881a-446b-b9a7-bbaf4cd0e771",
      "name": "Email Generation Loop",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1776,
        704
      ]
    },
    {
      "id": "90fd6eba-0057-4adf-a278-393bb3c71a06",
      "name": "Wait — Email Cooldown (4s)",
      "type": "n8n-nodes-base.wait",
      "position": [
        2576,
        768
      ]
    },
    {
      "id": "225282e1-c035-484c-9271-1db9197a0296",
      "name": "Wait — Apollo Cooldown (2s)",
      "type": "n8n-nodes-base.wait",
      "position": [
        1584,
        1280
      ]
    },
    {
      "id": "7e350226-331c-4fd4-8ea6-eac956f6f33a",
      "name": "Send Cold Email via Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2992,
        160
      ]
    },
    {
      "id": "f2c7e6f6-8ec7-4781-9099-91acb782e1df",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2768,
        176
      ]
    },
    {
      "id": "6dfab97b-dd54-4e5a-a80f-ce3ce9797e54",
      "name": "Update the Outreach Status",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3216,
        160
      ]
    },
    {
      "id": "52bbc219-6de7-4617-bdc9-48c932e28f0f",
      "name": "Filter1",
      "type": "n8n-nodes-base.filter",
      "position": [
        2544,
        176
      ]
    },
    {
      "id": "2f2d4586-d06f-4b6a-9ddc-bba53e74d351",
      "name": "Wait — Email Cooldown (60s)",
      "type": "n8n-nodes-base.wait",
      "position": [
        3440,
        176
      ]
    },
    {
      "id": "c896a808-c8d3-4277-9abc-f40c2624c4aa",
      "name": "Fetch Leads for Mail",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2128,
        176
      ]
    },
    {
      "id": "05e90a43-fc5f-4db2-a2e7-54c9501c7c4f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        640
      ],
      "parameters": {
        "width": 1104,
        "height": 576,
        "content": "## Scrape leads from Apollo and send AI-powered cold emails — Full B2B Outreach Automation\n\nOVERVIEW\nTwo triggers for complete control over your outreach pipeline.\n\nTRIGGER 1 — LEAD SCRAPER (Form Trig"
      }
    },
    {
      "id": "8b9c804a-e440-4b75-a37b-4cc165c05819",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        1488
      ],
      "parameters": {
        "width": 368,
        "height": 144,
        "content": "## Trigger 1 —Lead Input Form\n\nUser submits job title, location and \nnumber of leads required. This triggers \nthe workflow automatically."
      }
    },
    {
      "id": "74c038b1-a187-41a4-afd5-e1f0e14ca8de",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        1616
      ],
      "parameters": {
        "width": 528,
        "height": 192,
        "content": "## Lead Discovery and Enrichment\n\nApollo searches for matching leads based \non form input. Each lead is enriched with \nemail, phone number, LinkedIn URL and \ncompany information."
      }
    },
    {
      "id": "5c7a3393-bbe4-40b1-b0c8-3d6cd6f38ff3",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        1008
      ],
      "parameters": {
        "width": 416,
        "height": 176,
        "content": "## Duplicate Prevention\n\nEach lead is checked against existing \nrecords in the Google Sheet. Duplicate \nleads are automatically skipped to avoid \nredundant outreach."
      }
    },
    {
      "id": "5db27cae-6198-43fd-8d0a-4d7cf7bb63aa",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1936,
        1072
      ],
      "parameters": {
        "width": 336,
        "height": 144,
        "content": "## Save Leads\n\nAll enriched and verified leads are saved \nto the Google Sheet with outreach status \nset to Pending."
      }
    },
    {
      "id": "b333df1a-6671-47bd-b881-0439016119e8",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2144,
        384
      ],
      "parameters": {
        "width": 336,
        "height": 176,
        "content": "## AI Email Generation\n\nGroq LLM generates a personalized cold \nemail for each lead based on their job \ntitle, company and industry. Subject and \nbody are saved back to the sheet."
      }
    },
    {
      "id": "62b69105-1e1f-4ddf-90b0-ef1119f2b11d",
      "name": "Remove Duplicates",
      "type": "n8n-nodes-base.removeDuplicates",
      "position": [
        2336,
        176
      ]
    },
    {
      "id": "f8dcde96-44f3-4799-9a08-8a52d0fc7efd",
      "name": "When clicking Execute Workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        1104,
        704
      ]
    },
    {
      "id": "d113f0b6-cb1c-4390-a045-7717f4c0e001",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1104,
        448
      ],
      "parameters": {
        "width": 512,
        "height": 192,
        "content": "## Trigger 2 — Email Generator and Sender\n\nRun manually when ready to generate and \nsend emails. Generates AI cold emails for \nall Pending leads then sends to all Mail \nGenerated leads via Gmail."
      }
    }
  ],
  "connections": {
    "Filter1": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Send Cold Email via Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Skip Duplicates": {
      "main": [
        [
          {
            "node": "Wait — Apollo Cooldown (2s)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Process Each Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Email JSON": {
      "ai_outputParser": [
        [
          {
            "node": "AI Cold Email Writer",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Deduplicate Leads": {
      "main": [
        [
          {
            "node": "Skip Duplicates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Each Lead": {
      "main": [
        [],
        [
          {
            "node": "Merge for Dedup Check",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Existing Lead IDs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicates": {
      "main": [
        [
          {
            "node": "Filter1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq LLM (Fast AI)": {
      "ai_languageModel": [
        [
          {
            "node": "AI Cold Email Writer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Extract People Data": {
      "main": [
        [
          {
            "node": "Process Each Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Email to Sheet": {
      "main": [
        [
          {
            "node": "Wait — Email Cooldown (4s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Leads to Sheet": {
      "main": [
        [
          {
            "node": "Process Each Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Cold Email Writer": {
      "main": [
        [
          {
            "node": "Save Email to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Leads for Mail": {
      "main": [
        [
          {
            "node": "Remove Duplicates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Pending Leads": {
      "main": [
        [
          {
            "node": "Email Generation Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lead Generation Form": {
      "main": [
        [
          {
            "node": "Apollo — Search Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Generation Loop": {
      "main": [
        [
          {
            "node": "Fetch Leads for Mail",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Cold Email Writer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge for Dedup Check": {
      "main": [
        [
          {
            "node": "Deduplicate Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Leads from Sheet": {
      "main": [
        [
          {
            "node": "Filter Pending Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apollo — Search Leads": {
      "main": [
        [
          {
            "node": "Extract People Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Existing Lead IDs": {
      "main": [
        [
          {
            "node": "Merge for Dedup Check",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Format & Clean Lead Data": {
      "main": [
        [
          {
            "node": "Save Leads to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Cold Email via Gmail": {
      "main": [
        [
          {
            "node": "Update the Outreach Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update the Outreach Status": {
      "main": [
        [
          {
            "node": "Wait — Email Cooldown (60s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apollo — Enrich Lead Data": {
      "main": [
        [
          {
            "node": "Format & Clean Lead Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait — Email Cooldown (4s)": {
      "main": [
        [
          {
            "node": "Email Generation Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait — Apollo Cooldown (2s)": {
      "main": [
        [
          {
            "node": "Apollo — Enrich Lead Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait — Email Cooldown (60s)": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking Execute Workflow": {
      "main": [
        [
          {
            "node": "Fetch Leads from Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}