{"id": "cQAILffOajE9n2cf", "name": "Generate Leads with Google Maps - AlexK1919", "nodes": [{"id": "edc9d8f5-e1f4-48e2-b7f7-36e53674d5b3", "name": "When clicking \"Execute Workflow\"", "type": "n8n-nodes-base.manualTrigger", "position": [-1080, 540], "parameters": {}, "typeVersion": 1}, {"id": "b761e882-298f-454e-8c21-f77b336ce54e", "name": "Run workflow every hours", "type": "n8n-nodes-base.scheduleTrigger", "disabled": true, "position": [-1080, 360], "parameters": {"rule": {"interval": [{"field": "minutes", "minutesInterval": 15}]}}, "typeVersion": 1.1}, {"id": "63d30ea8-1e31-47d2-8f3a-6757f438ab8a", "name": "Execute Workflow Trigger", "type": "n8n-nodes-base.executeWorkflowTrigger", "disabled": true, "position": [-1080, 200], "parameters": {}, "typeVersion": 1}, {"id": "10f40f60-c29f-47db-a4d1-3d0b8e8363d7", "name": "Check Max Retries1", "type": "n8n-nodes-base.if", "position": [1680, 740], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "51e191cb-af20-423b-9303-8523caa4ae0d", "operator": {"type": "number", "operation": "gt"}, "leftValue": "={{ $('Exponential Backoff').item.json[\"retryCount\"] }}", "rightValue": 10}]}}, "typeVersion": 2.2}, {"id": "6665de66-8e00-4a45-b26a-93be044e9b8d", "name": "Stop and Error1", "type": "n8n-nodes-base.stopAndError", "position": [1880, 740], "parameters": {"errorMessage": "Google Sheets API Limit has been triggered and the workflow has stopped"}, "typeVersion": 1}, {"id": "f0b15937-3734-4cdf-9256-ae36e39a2046", "name": "GMaps API", "type": "n8n-nodes-base.httpRequest", "position": [80, 680], "parameters": {"url": "https://places.googleapis.com/v1/places:searchText", "method": "POST", "options": {"response": {"response": {"fullResponse": true}}}, "sendBody": true, "sendHeaders": true, "authentication": "predefinedCredentialType", "bodyParameters": {"parameters": [{"name": "textQuery", "value": "={{ $('Subcategory').item.json.Subcategory }} {{ $json.zip }}"}]}, "headerParameters": {"parameters": [{"name": "X-Goog-FieldMask", "value": "places.id,places.displayName,places.addressComponents,places.formattedAddress,places.primaryType,places.primaryTypeDisplayName,places.types,places.location,places.nationalPhoneNumber,places.rating,places.userRatingCount,places.websiteUri,places.editorialSummary,places.reviews,places.attributions,places.userRatingCount"}]}, "nodeCredentialType": "googleOAuth2Api"}, "credentials": {"googleOAuth2Api": {"id": "mfmC5Vkz0fz2YJ77", "name": "KBB Google OAuth"}}, "typeVersion": 4.2}, {"id": "539bb125-173a-45b8-a6fc-0b755a013525", "name": "Update Status to Success", "type": "n8n-nodes-base.googleSheets", "onError": "continueErrorOutput", "position": [1520, 1160], "parameters": {"columns": {"value": {"zip": "={{ $('Set Zip').first().json.zip }}", "status": "scraped", "subcat": "={{ $('Subcategory').first().json.Subcategory }}"}, "schema": [{"id": "zip", "type": "string", "display": true, "removed": false, "required": false, "displayName": "zip", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "status", "type": "string", "display": true, "removed": false, "required": false, "displayName": "status", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "subcat", "type": "string", "display": true, "removed": false, "required": false, "displayName": "subcat", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "row_number", "type": "string", "display": true, "removed": false, "readOnly": true, "required": false, "displayName": "row_number", "defaultMatch": false, "canBeUsedToMatch": true}], "mappingMode": "defineBelow", "matchingColumns": ["zip"]}, "options": {}, "operation": "update", "sheetName": {"__rl": true, "mode": "name", "value": "={{ $('Settings').first().json.sheet }}"}, "documentId": {"__rl": true, "mode": "url", "value": "={{ $('Settings').first().json.gs_url }}"}}, "credentials": {"googleSheetsOAuth2Api": {"id": "OnIKN60kSWkHVPHx", "name": "Google Sheets - KBB"}}, "executeOnce": true, "typeVersion": 4.2, "alwaysOutputData": true}, {"id": "848b71e5-7ff5-4fb5-aad3-33b630ee42c8", "name": "Add rows in Google Sheets", "type": "n8n-nodes-base.googleSheets", "onError": "continueErrorOutput", "position": [1080, 740], "parameters": {"columns": {"value": {"type": "={{ $('Subcategory').item.json.Subcategory }}", "phone": "={{ $json.place.nationalPhoneNumber }}", "title": "={{ $json.place.displayName.text }}", "types": "={{ $json.place.types }}", "rating": "={{ $json.place.rating }}", "address": "={{ $json.place.formattedAddress }}", "reviews": "={{ $json.place.reviews }}", "website": "={{ $json.place.websiteUri }}", "place_id": "={{ $json.place.id }}", "gps_coordinates": "={\"latitude\":{{ $json.place.location.latitude }},\"longitude\":{{ $json.place.location.longitude }}}"}, "schema": [{"id": "ACTION", "type": "string", "display": true, "required": false, "displayName": "ACTION", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "STATUS", "type": "string", "display": true, "required": false, "displayName": "STATUS", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "title", "type": "string", "display": true, "required": false, "displayName": "title", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "email", "type": "string", "display": true, "required": false, "displayName": "email", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "name", "type": "string", "display": true, "required": false, "displayName": "name", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "firstname", "type": "string", "display": true, "required": false, "displayName": "firstname", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "lastname", "type": "string", "display": true, "required": false, "displayName": "lastname", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "phone", "type": "string", "display": true, "required": false, "displayName": "phone", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "clean url", "type": "string", "display": true, "required": false, "displayName": "clean url", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "website", "type": "string", "display": true, "required": false, "displayName": "website", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "WP API", "type": "string", "display": true, "required": false, "displayName": "WP API", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "WP", "type": "string", "display": true, "required": false, "displayName": "WP", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "facebook", "type": "string", "display": true, "required": false, "displayName": "facebook", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "instagram", "type": "string", "display": true, "required": false, "displayName": "instagram", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "youtube", "type": "string", "display": true, "required": false, "displayName": "youtube", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "tiktok", "type": "string", "display": true, "required": false, "displayName": "tiktok", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "twitter", "type": "string", "display": true, "required": false, "displayName": "twitter", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "linkedin", "type": "string", "display": true, "required": false, "displayName": "linkedin", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "pinterest", "type": "string", "display": true, "required": false, "displayName": "pinterest", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "reddit", "type": "string", "display": true, "required": false, "displayName": "reddit", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "rating", "type": "string", "display": true, "required": false, "displayName": "rating", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "reviews", "type": "string", "display": true, "required": false, "displayName": "reviews", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "type", "type": "string", "display": true, "required": false, "displayName": "type", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "address", "type": "string", "display": true, "required": false, "displayName": "address", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "price", "type": "string", "display": true, "required": false, "displayName": "price", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "place_id", "type": "string", "display": true, "removed": false, "required": false, "displayName": "place_id", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "position", "type": "string", "display": true, "required": false, "displayName": "position", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "data_id", "type": "string", "display": true, "required": false, "displayName": "data_id", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "data_cid", "type": "string", "display": true, "required": false, "displayName": "data_cid", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "reviews_link", "type": "string", "display": true, "required": false, "displayName": "reviews_link", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "photos_link", "type": "string", "display": true, "required": false, "displayName": "photos_link", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "gps_coordinates", "type": "string", "display": true, "required": false, "displayName": "gps_coordinates", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "place_id_search", "type": "string", "display": true, "required": false, "displayName": "place_id_search", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "provider_id", "type": "string", "display": true, "required": false, "displayName": "provider_id", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "types", "type": "string", "display": true, "required": false, "displayName": "types", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "open_state", "type": "string", "display": true, "required": false, "displayName": "open_state", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "hours", "type": "string", "display": true, "required": false, "displayName": "hours", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "operating_hours", "type": "string", "display": true, "required": false, "displayName": "operating_hours", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "description", "type": "string", "display": true, "required": false, "displayName": "description", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "service_options", "type": "string", "display": true, "required": false, "displayName": "service_options", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "order_online", "type": "string", "display": true, "required": false, "displayName": "order_online", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "thumbnail", "type": "string", "display": true, "required": false, "displayName": "thumbnail", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "editorial_reviews", "type": "string", "display": true, "required": false, "displayName": "editorial_reviews", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "unclaimed_listing", "type": "string", "display": true, "required": false, "displayName": "unclaimed_listing", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "reserve_a_table", "type": "string", "display": true, "required": false, "displayName": "reserve_a_table", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "user_review", "type": "string", "display": true, "required": false, "displayName": "user_review", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "amenities", "type": "string", "display": true, "required": false, "displayName": "amenities", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "book_online", "type": "string", "display": true, "required": false, "displayName": "book_online", "defaultMatch": false, "canBeUsedToMatch": true}], "mappingMode": "defineBelow", "matchingColumns": ["place_id"]}, "options": {}, "operation": "appendOrUpdate", "sheetName": {"__rl": true, "mode": "name", "value": "=Results"}, "documentId": {"__rl": true, "mode": "url", "value": "={{ $('Settings').item.json.gs_url }}"}}, "credentials": {"googleSheetsOAuth2Api": {"id": "OnIKN60kSWkHVPHx", "name": "Google Sheets - KBB"}}, "typeVersion": 4.2, "alwaysOutputData": true}, {"id": "4e1e9438-8091-4cf6-8a99-179960a35eae", "name": "Set Row Number", "type": "n8n-nodes-base.set", "position": [80, 80], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "4c5ad6be-28aa-455f-8ee2-edce1ab1bdbb", "name": "row_number", "type": "number", "value": "={{ $json.row_number }}"}]}, "includeOtherFields": true}, "typeVersion": 3.4}, {"id": "a1939e46-7a56-4e41-9f12-86e784acd044", "name": "Set Zip", "type": "n8n-nodes-base.set", "position": [-120, 680], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "7b1629c5-cbfe-4769-8286-66b46c51cd7e", "name": "zip", "type": "number", "value": "={{ $('Loop Zips').first().json.zip }}"}]}, "includeOtherFields": true}, "typeVersion": 3.4}, {"id": "062d2c9f-f957-43ee-9fc2-2a8600828b58", "name": "Set Place ID", "type": "n8n-nodes-base.set", "position": [680, 740], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "758ff896-7cd8-4f72-bfbb-e64583c5937c", "name": "places.id", "type": "string", "value": "={{ $json.place.id }}"}]}, "includeOtherFields": true}, "typeVersion": 3.4}, {"id": "0e3f4e19-0067-4233-afa8-1b9dd0a6bf30", "name": "Exponential Backoff", "type": "n8n-nodes-base.code", "position": [1280, 740], "parameters": {"mode": "runOnceForEachItem", "jsCode": "// Define the retry count (coming from a previous node or set manually)\nconst retryCount = $json[\"retryCount\"]