{
  "name": "Local Business Lead Finder - Google Places API",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        320,
        464
      ],
      "id": "70de0347-05a6-41e3-a95a-a3c7351314f5",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "inputSource": "passthrough"
      },
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.2,
      "position": [
        320,
        32
      ],
      "id": "38019a58-2d88-45b9-8b0b-fd8fa084046b",
      "name": "When Executed by Another Workflow",
      "disabled": true
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 15
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        320,
        272
      ],
      "id": "636b2238-f01c-4184-9b8a-24b0979859a9",
      "name": "Run Workflow every hour",
      "disabled": true
    },
    {
      "parameters": {
        "content": "Trigger Nodes\n",
        "height": 1264,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        256,
        -64
      ],
      "id": "d419389a-d06f-49c6-9230-3cd743efa19b",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "87272541-ebcd-4e80-8ccd-931c83c7db11",
              "name": "gs_url",
              "value": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID_HERE/edit?gid=0#gid=0",
              "type": "string"
            },
            {
              "id": "5211fc9c-4845-4647-a2d3-7e5d76317acd",
              "name": "sheet",
              "value": "AZ Zips",
              "type": "string"
            },
            {
              "id": "9ee3d153-ae16-4676-a270-0fea9fedf0c8",
              "name": "catSheet",
              "value": "Google Maps Categories",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        624,
        272
      ],
      "id": "95f15af1-5223-4f1c-9a55-20020f50c58d",
      "name": "Settings"
    },
    {
      "parameters": {
        "content": "Settings",
        "height": 1264,
        "color": "#4A1717"
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        560,
        -64
      ],
      "id": "1a7c6818-07be-42d8-afaf-730eb8c89a8a",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "YOUR_GOOGLE_SHEET_ID_HERE",
          "mode": "list",
          "cachedResultName": "Lead Gen - Google Maps",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID_HERE/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "AZ Zips",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID_HERE/edit#gid=0"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        896,
        64
      ],
      "id": "70efcd50-2bed-4a6f-a3f0-3b1f8fa53bb2",
      "name": "GS - Get Zip Codes",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "d5f48208-2b73-45f6-b637-173a585037b9",
              "name": "zip",
              "value": "={{ $json.zip }}",
              "type": "number"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1072,
        64
      ],
      "id": "ac4701d7-5ac4-49c6-a708-9cf1f13e7152",
      "name": "Zips"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "a739d2bc-40a1-455e-b6d9-80bd3a35ff26",
              "leftValue": "={{ $json.status }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.3,
      "position": [
        1280,
        64
      ],
      "id": "0ba434b7-0eda-4429-8d83-9cc3e0630887",
      "name": "Filter Zips"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "909f29bf-ea38-47c9-89c9-b84332272126",
              "name": "row_number",
              "value": "={{ $('Zips').item.json.row_number }}",
              "type": "number"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1440,
        64
      ],
      "id": "1ad4d357-a10d-4ba7-aff3-9d918df32ae7",
      "name": "Set Row Number"
    },
    {
      "parameters": {
        "fieldToSplitOut": "row_number",
        "include": "allOtherFields",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        1664,
        64
      ],
      "id": "a8c512b3-c325-42f1-b674-e86b7e79f653",
      "name": "Split Out"
    },
    {
      "parameters": {
        "maxItems": 10000
      },
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        1872,
        64
      ],
      "id": "5a43b3b2-dea9-4dd5-a6d0-ce8a90a532da",
      "name": "Limit"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "YOUR_GOOGLE_SHEET_ID_HERE",
          "mode": "list",
          "cachedResultName": "Lead Gen - Google Maps",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID_HERE/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 794228591,
          "mode": "list",
          "cachedResultName": "Google Maps Categories",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID_HERE/edit#gid=794228591"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1200,
        368
      ],
      "id": "c30ed729-3113-4d9b-925d-6c2dec8b0460",
      "name": "Get row(s) in sheet",
      "executeOnce": false,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "1f97f104-7fe5-4d7b-b720-9840084f6612",
              "leftValue": "={{ $json.STATUS }}",
              "rightValue": "ignore",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.3,
      "position": [
        1408,
        368
      ],
      "id": "7fef280a-5416-4f52-918f-21137e4c4bd3",
      "name": "FiFilter Subcategories"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "bae5948e-b6a3-4e76-a310-23742a99bd45",
              "name": "Subcategory",
              "value": "={{ $json.Subcategory }}",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1616,
        368
      ],
      "id": "06a7e113-1e65-4f4c-92e4-7d9affc30ef0",
      "name": "Subcategory"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        976,
        640
      ],
      "id": "98465f33-19ab-4f52-8a9f-385f36187193",
      "name": "Loop Subcats"
    },
    {
      "parameters": {
        "content": "Data Prep",
        "height": 608,
        "width": 1488,
        "color": "#132D10"
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        864,
        -64
      ],
      "id": "5fdb4d07-f64c-4cad-8e50-0171a4e58f46",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        992,
        272
      ],
      "id": "93f8b794-6cee-4028-89b4-76e52f508c71",
      "name": "Loop Zips"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "87a0bace-f9d5-4bd7-b686-ae9014b25625",
              "name": "zip",
              "value": "={{ $('Loop Zips').item.json.zip }}",
              "type": "number"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1168,
        816
      ],
      "id": "744537cf-b6ce-4c3e-9887-ac67d8b4a215",
      "name": "Set Zip"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://places.googleapis.com/v1/places:searchText",
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Goog-FieldMask",
              "value": "places.id,places.displayName,places.formattedAddress,places.nationalPhoneNumber,places.rating,places.userRatingCount,places.websiteUri,places.location"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "textQuery",
              "value": "=={{ $('Subcategory').item.json.Subcategory }} {{ $('Loop Zips').item.json.Zip }}"
            },
            {
              "name": "regionCode",
              "value": "US"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        1344,
        816
      ],
      "id": "5677a854-945e-4b81-ba49-17675178632a",
      "name": "GMaps API",
      "credentials": {
        "googleOAuth2Api": {
          "name": "<your credential>"
        },
        "oAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const places = items[0]?.json?.places || [];\nlet output = [];\nfor (let i = 0; i < places.length; i++) {\n  output.push({\n    json: {\n      place: places[i]\n    }\n  });\n}\nreturn output;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1520,
        816
      ],
      "id": "433fe62b-d629-4a77-9e67-196f22391d6e",
      "name": "Place Array"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "dfbc2a7c-a098-475e-9444-4f7c9357d73a",
              "name": "places.id",
              "value": "={{ $json.place.id }}",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1936,
        816
      ],
      "id": "16f2e17a-cb75-4433-90a9-841715468beb",
      "name": "Set Place ID"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "7f597e2e-f5d0-4e4f-b2e7-ab8057028a5b",
              "leftValue": "={{ $json.place.userRatingCount }}",
              "rightValue": 10,
              "operator": {
                "type": "number",
                "operation": "lt"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.3,
      "position": [
        1728,
        816
      ],
      "id": "5a65a104-1d65-4da6-9c6e-c4f946b43b1b",
      "name": "Filter Low Visibilty"
    },
    {
      "parameters": {
        "content": "LOW REVIEW ",
        "height": 624,
        "width": 1472
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        880,
        576
      ],
      "id": "b1ed44c1-e3c0-4468-a664-ec707b739fa4",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "YOUR_GOOGLE_SHEET_ID_HERE",
          "mode": "list",
          "cachedResultName": "Lead Gen - Google Maps",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID_HERE/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "AZ Zips",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID_HERE/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "row_number": "={{ $('Loop Zips').item.json.row_number }}",
            "status": "DONE"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "zip",
              "displayName": "zip",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "status",
              "displayName": "status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        960,
        464
      ],
      "id": "92a34475-5a2f-4901-b789-f1f4f4f77628",
      "name": "Mark Zip Processed",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "YOUR_GOOGLE_SHEET_ID_HERE",
          "mode": "list",
          "cachedResultName": "Lead Gen - Google Maps",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID_HERE/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 2023916190,
          "mode": "list",
          "cachedResultName": "Results",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID_HERE/edit#gid=2023916190"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "name": "={{ $json.place.displayName.text }}",
            " phone": "={{ $json.place.nationalPhoneNumber }}",
            "address": "={{ $json.place.formattedAddress }}",
            "rating": "={{ $json.place.rating }}",
            "reviews": "={{ $json.place.userRatingCount }}",
            "website": "={{ $json.place.websiteUri }}",
            "place_id": "={{ $json.places.id }}"
          },
          "matchingColumns": [
            "place_id"
          ],
          "schema": [
            {
              "id": "name",
              "displayName": "name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": " phone",
              "displayName": " phone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "address",
              "displayName": "address",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "rating",
              "displayName": "rating",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "reviews",
              "displayName": "reviews",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "website",
              "displayName": "website",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "place_id",
              "displayName": "place_id",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        2144,
        816
      ],
      "id": "43deb60b-e256-47dd-9c66-123aec78cf2d",
      "name": "Generating Leads",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Run Workflow every hour": {
      "main": [
        [
          {
            "node": "Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Settings": {
      "main": [
        [
          {
            "node": "GS - Get Zip Codes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GS - Get Zip Codes": {
      "main": [
        [
          {
            "node": "Zips",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Zips": {
      "main": [
        [
          {
            "node": "Filter Zips",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Zips": {
      "main": [
        [
          {
            "node": "Set Row Number",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Row Number": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Loop Zips",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "FiFilter Subcategories",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FiFilter Subcategories": {
      "main": [
        [
          {
            "node": "Subcategory",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Subcats": {
      "main": [
        [
          {
            "node": "Mark Zip Processed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set Zip",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Subcategory": {
      "main": [
        [
          {
            "node": "Loop Subcats",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Zips": {
      "main": [
        [],
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Zip": {
      "main": [
        [
          {
            "node": "GMaps API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GMaps API": {
      "main": [
        [
          {
            "node": "Place Array",
            "type": "main",
            "index": 0
          },
          {
            "node": "Loop Subcats",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Place Array": {
      "main": [
        [
          {
            "node": "Filter Low Visibilty",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Low Visibilty": {
      "main": [
        [
          {
            "node": "Set Place ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Place ID": {
      "main": [
        [
          {
            "node": "Generating Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark Zip Processed": {
      "main": [
        [
          {
            "node": "Loop Zips",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generating Leads": {
      "main": [
        [
          {
            "node": "Loop Subcats",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "b70c7944-8102-4c29-bf83-09bb3d69ee14",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "nodeGroups": [],
  "id": "0OgTHuTd9dw637vv",
  "tags": []
}