{
  "name": "Generate scored B2B leads from Google Maps websites to Google Sheets",
  "nodes": [
    {
      "id": "41259296-ec07-4167-a1c2-d7307fc4499c",
      "name": "Loop over queries",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        912,
        688
      ]
    },
    {
      "id": "67ca1049-b28e-41ec-bb86-d23ab4bec479",
      "name": "Search Google Maps with query",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1232,
        704
      ]
    },
    {
      "id": "0cddbb70-a8eb-4e97-8ebd-101e745517e4",
      "name": "Run workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        688,
        688
      ]
    },
    {
      "id": "473f6344-a1bc-4721-a9f4-4ffee8a5bc5f",
      "name": "Extract Places Data",
      "type": "n8n-nodes-base.set",
      "position": [
        2112,
        752
      ]
    },
    {
      "id": "ea0dbc01-474d-42ee-917a-b13a533d4b6b",
      "name": "Check if Website Exists",
      "type": "n8n-nodes-base.if",
      "position": [
        2736,
        944
      ]
    },
    {
      "id": "c861ccaa-2318-46ee-b830-4e6035624c8d",
      "name": "Check for Next Page Token",
      "type": "n8n-nodes-base.code",
      "position": [
        1552,
        688
      ]
    },
    {
      "id": "f2929d01-3781-4ba8-a759-5f0754000c6a",
      "name": "Has Next Page?",
      "type": "n8n-nodes-base.if",
      "position": [
        1856,
        736
      ]
    },
    {
      "id": "70c3a947-403f-4698-989d-a2f376c39ac6",
      "name": "Merge Emails with Business Data",
      "type": "n8n-nodes-base.merge",
      "position": [
        6128,
        640
      ]
    },
    {
      "id": "2ff082fb-27f6-4e6e-919c-e5a24f570ec7",
      "name": "Merge All Businesses",
      "type": "n8n-nodes-base.merge",
      "position": [
        6352,
        960
      ]
    },
    {
      "id": "185fa4e8-5162-4d8a-80e6-9e62e6d7a8b0",
      "name": "Split Out Places",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2352,
        752
      ]
    },
    {
      "id": "9c0020e6-dd29-49bf-b801-71794fe40386",
      "name": "Filter Operational Businesses",
      "type": "n8n-nodes-base.filter",
      "position": [
        2592,
        752
      ]
    },
    {
      "id": "d599c3a4-28f0-4a65-bdec-1664952e088f",
      "name": "Fetch Website HTML",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2928,
        816
      ]
    },
    {
      "id": "0d0a8bf0-b3b3-413a-8f7a-7ee4b0a4db9f",
      "name": "Extract Emails from HTML",
      "type": "n8n-nodes-base.code",
      "position": [
        4384,
        784
      ]
    },
    {
      "id": "f326a102-87c7-4c22-a476-0b0f720605cb",
      "name": "Filter Valid Emails",
      "type": "n8n-nodes-base.filter",
      "position": [
        4640,
        784
      ]
    },
    {
      "id": "79fc536e-709a-492a-b494-86dd62d4085a",
      "name": "Append to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        6912,
        960
      ]
    },
    {
      "id": "6ee08a6f-f4ee-40d0-87a1-8b42d82705e8",
      "name": "Extract Contact Links",
      "type": "n8n-nodes-base.code",
      "position": [
        3216,
        880
      ]
    },
    {
      "id": "305994a9-dc4b-4174-af52-b39037b1b02d",
      "name": "Filter Contact Links",
      "type": "n8n-nodes-base.filter",
      "position": [
        3472,
        880
      ]
    },
    {
      "id": "a5bb802b-e446-454d-b823-376bab92b602",
      "name": "Fetch Contact Page HTML",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3728,
        880
      ]
    },
    {
      "id": "3fc0737f-9453-44ba-8cb7-1ea6f77716b1",
      "name": "Remove Duplicate Businesses",
      "type": "n8n-nodes-base.removeDuplicates",
      "position": [
        6640,
        960
      ]
    },
    {
      "id": "9bff479f-b55f-4f78-877d-cbfa2de9ba40",
      "name": "Combine Homepage and Contact HTML",
      "type": "n8n-nodes-base.code",
      "position": [
        4032,
        784
      ]
    },
    {
      "id": "340da66a-cf7b-4aae-aa4e-e199bca9b4a1",
      "name": "Remove Duplicate Emails",
      "type": "n8n-nodes-base.removeDuplicates",
      "position": [
        5872,
        784
      ]
    },
    {
      "id": "b510e4cb-fd35-42de-9d71-0732454402b6",
      "name": "Score and Rank Emails",
      "type": "n8n-nodes-base.code",
      "position": [
        5168,
        784
      ]
    },
    {
      "id": "01be1b17-7fc3-48e5-b8c7-82ec4c543fea",
      "name": "Sort by Email Quality",
      "type": "n8n-nodes-base.sort",
      "position": [
        5424,
        784
      ]
    },
    {
      "id": "60c2b837-1b12-4202-8a88-18fc57777fb4",
      "name": "Keep Best Email Only",
      "type": "n8n-nodes-base.limit",
      "position": [
        5648,
        784
      ]
    },
    {
      "id": "b941abc6-cfb5-4698-8396-bdb057a0e8c3",
      "name": "Group by Business",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        4896,
        784
      ]
    },
    {
      "id": "31691192-c241-447e-9aad-83dedad59d9e",
      "name": "📋 Overview: B2B Lead Generation Scraper",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        -384
      ],
      "parameters": {
        "width": 352,
        "height": 768,
        "content": "## B2B Lead Generation Scraper\n\nThis workflow automates lead discovery and qualification from Google Maps. It searches for businesses, scrapes their websites for contact emails, scores email quality, "
      }
    },
    {
      "id": "9c7113ab-8389-4266-a74e-269ef72e2937",
      "name": "Stage 1: Google Maps Search",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        528
      ],
      "parameters": {
        "width": 832,
        "height": 640,
        "content": "## Stage 1: Google Maps Search\n\nLoops through search queries, fetches all matching businesses from Google Maps, handles pagination automatically, and filters for operational businesses only."
      }
    },
    {
      "id": "bf4a9c62-21c2-4f0a-87c5-927d46f43c7a",
      "name": "Stage 2: Website Scraping",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1488,
        528
      ],
      "parameters": {
        "width": 2784,
        "height": 640,
        "content": "## Stage 2: Website Scraping\n\nVisits business websites and contact pages to extract all available email addresses. Handles both homepage and dedicated contact page scraping."
      }
    },
    {
      "id": "fadc94fd-fc55-4ae7-8978-418d2c743578",
      "name": "Stage 3: Email Quality Control",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4272,
        528
      ],
      "parameters": {
        "width": 1744,
        "height": 640,
        "content": "## Stage 3: Email Quality Control\n\nScores emails by quality (+30 domain match, +20 personal names, -40 generic prefixes, -25 free providers). Keeps only the best email per business."
      }
    },
    {
      "id": "3cb35ee5-bff7-487e-8fb7-4c6d3d54bac9",
      "name": "Stage 4: Final Output",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6000,
        528
      ],
      "parameters": {
        "width": 1104,
        "height": 640,
        "content": "## Stage 4: Final Output & Deduplication\n\nMerges email data with business info, removes duplicate businesses, and exports clean leads to Google Sheets."
      }
    }
  ],
  "connections": {
    "Run workflow": {
      "main": [
        [
          {
            "node": "Loop over queries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has Next Page?": {
      "main": [
        [
          {
            "node": "Search Google Maps with query",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract Places Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Places": {
      "main": [
        [
          {
            "node": "Filter Operational Businesses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group by Business": {
      "main": [
        [
          {
            "node": "Score and Rank Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop over queries": {
      "main": [
        [],
        [
          {
            "node": "Search Google Maps with query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Website HTML": {
      "main": [
        [
          {
            "node": "Extract Contact Links",
            "type": "main",
            "index": 0
          },
          {
            "node": "Combine Homepage and Contact HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Places Data": {
      "main": [
        [
          {
            "node": "Split Out Places",
            "type": "main",
            "index": 0
          },
          {
            "node": "Loop over queries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Valid Emails": {
      "main": [
        [
          {
            "node": "Group by Business",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Contact Links": {
      "main": [
        [
          {
            "node": "Fetch Contact Page HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keep Best Email Only": {
      "main": [
        [
          {
            "node": "Remove Duplicate Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge All Businesses": {
      "main": [
        [
          {
            "node": "Remove Duplicate Businesses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Contact Links": {
      "main": [
        [
          {
            "node": "Filter Contact Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Score and Rank Emails": {
      "main": [
        [
          {
            "node": "Sort by Email Quality",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort by Email Quality": {
      "main": [
        [
          {
            "node": "Keep Best Email Only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append to Google Sheets": {
      "main": [
        [
          {
            "node": "Loop over queries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if Website Exists": {
      "main": [
        [
          {
            "node": "Fetch Website HTML",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge All Businesses",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Fetch Contact Page HTML": {
      "main": [
        [
          {
            "node": "Combine Homepage and Contact HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicate Emails": {
      "main": [
        [
          {
            "node": "Merge Emails with Business Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Extract Emails from HTML": {
      "main": [
        [
          {
            "node": "Filter Valid Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for Next Page Token": {
      "main": [
        [
          {
            "node": "Has Next Page?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicate Businesses": {
      "main": [
        [
          {
            "node": "Append to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Operational Businesses": {
      "main": [
        [
          {
            "node": "Check if Website Exists",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge Emails with Business Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Google Maps with query": {
      "main": [
        [
          {
            "node": "Check for Next Page Token",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop over queries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Emails with Business Data": {
      "main": [
        [
          {
            "node": "Merge All Businesses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine Homepage and Contact HTML": {
      "main": [
        [
          {
            "node": "Extract Emails from HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}