{
  "id": "LFP3MXxMct1PkZeO",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Google Map Scraper",
  "tags": [
    {
      "id": "1Ub6auawM61rJ4PA",
      "name": "tutorials",
      "createdAt": "2025-04-26T03:07:52.593Z",
      "updatedAt": "2025-04-26T03:07:52.593Z"
    }
  ],
  "nodes": [
    {
      "id": "2ec7af37-3960-49d3-8401-7a2ee1a55d3e",
      "name": "Call APIFY Actor",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -320,
        -40
      ],
      "parameters": {
        "url": "https://api.apify.com/v2/acts/compass~crawler-google-places/run-sync-get-dataset-items",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"includeWebResults\": false,\n    \"language\": \"en\",\n    \"locationQuery\": \"{{ $json.City }},{{ $json.Country }} \",\n    \"maxCrawledPlacesPerSearch\": 25,\n    \"maxImages\": 0,\n    \"maximumLeadsEnrichmentRecords\": 0,\n    \"scrapeContacts\": true,\n    \"scrapeDirectories\": false,\n    \"scrapeImageAuthors\": false,\n    \"scrapePlaceDetailPage\": false,\n    \"scrapeReviewsPersonalData\": true,\n    \"scrapeTableReservationProvider\": false,\n    \"searchStringsArray\": [\n        \"{{ $json['Search Query'] }}\"\n    ],\n    \"skipClosedPlaces\": false,\n    \"website\": \"withWebsite\"\n} ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "368d2b5c-01b0-4bf6-b188-e03139804716",
      "name": "Filter Entries With Emails",
      "type": "n8n-nodes-base.filter",
      "position": [
        -100,
        -40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "ddb43b31-a96f-4415-8ad3-373a12271ba0",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.emails }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "85117f2d-9169-4d73-b501-9797d7e967b4",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        120,
        -40
      ],
      "parameters": {
        "options": {
          "fileName": "contacts.csv",
          "delimiter": ",",
          "headerRow": true
        },
        "binaryPropertyName": "contacts"
      },
      "typeVersion": 1.1
    },
    {
      "id": "34ad4761-dbd5-4a12-9e12-abb82aaa35f5",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -540,
        -40
      ],
      "parameters": {
        "options": {},
        "formTitle": "Google Maps Scraper",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Search Query",
              "requiredField": true
            },
            {
              "fieldLabel": "City",
              "requiredField": true
            },
            {
              "fieldLabel": "Country",
              "requiredField": true
            },
            {
              "fieldLabel": "Your Email"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "92109cc0-6d94-4c67-8f4a-ebe1c1134d53",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -840,
        -400
      ],
      "parameters": {
        "width": 720,
        "height": 180,
        "content": "Google Maps Lead Scraper\n\nThis workflow collects business leads from Google Maps using APIFY, filters businesses with email addresses, and emails the results as CSV.\nRequired: APIFY API Key, Gmail Account\nAPIFY Documentation: https://apify.com/\nHere is a video tutorial on how this automation works: [https://www.youtube.com/watch?v=Kz_Gfx7OH6o](Build Google Maps Scraper with n8n to Auto-Collect Business Leads via Email)"
      },
      "typeVersion": 1
    },
    {
      "id": "169fef09-8f71-40a2-a615-f6c709f33bcd",
      "name": "Send Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        340,
        -40
      ],
      "parameters": {
        "sendTo": "={{ $node['On form submission'].json['Your Email'] }}",
        "message": "Please find the attached leads",
        "options": {
          "attachmentsUi": {
            "attachmentsBinary": [
              {
                "property": "contacts"
              }
            ]
          },
          "appendAttribution": false
        },
        "subject": "Your Google Maps Leads Are Here"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e4606ba6-a497-43d4-9499-9a3296e67485",
  "connections": {
    "Convert to File": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call APIFY Actor": {
      "main": [
        [
          {
            "node": "Filter Entries With Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Call APIFY Actor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Entries With Emails": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}