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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "Scrapping_Leads",
|
| 3 |
+
"nodes": [
|
| 4 |
+
{
|
| 5 |
+
"parameters": {
|
| 6 |
+
"content": "## π― COMPLETE BUSINESS LEAD GENERATOR\n**ALL FEATURES INCLUDED**\n\n## β
Form trigger\n## β
Coordinate extraction\n## β
SerpAPI pagination\n## β
Lead scoring & sorting\n## β
Social media extraction\n## β
Google Sheets export\n## β
Complete IF conditions\n## β
No duplicates\n\n## **Replace 4 credential IDs and test!**",
|
| 7 |
+
"height": 640,
|
| 8 |
+
"width": 740,
|
| 9 |
+
"color": 7
|
| 10 |
+
},
|
| 11 |
+
"id": "09d4350f-ed2c-4200-91b1-3bcff05faecc",
|
| 12 |
+
"name": "π Complete Workflow",
|
| 13 |
+
"type": "n8n-nodes-base.stickyNote",
|
| 14 |
+
"typeVersion": 1,
|
| 15 |
+
"position": [
|
| 16 |
+
-2500,
|
| 17 |
+
20
|
| 18 |
+
]
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"parameters": {
|
| 22 |
+
"path": "complete-lead-generator",
|
| 23 |
+
"formTitle": "π― Complete Business Lead Generator",
|
| 24 |
+
"formDescription": "Generate business leads with full pagination and scoring.",
|
| 25 |
+
"formFields": {
|
| 26 |
+
"values": [
|
| 27 |
+
{
|
| 28 |
+
"fieldLabel": "business_type",
|
| 29 |
+
"placeholder": "e.g., dentists, restaurants, hotels, gyms",
|
| 30 |
+
"requiredField": true
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"fieldLabel": "city",
|
| 34 |
+
"placeholder": "e.g., Meknes, Paris, New York, London",
|
| 35 |
+
"requiredField": true
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"fieldLabel": "country",
|
| 39 |
+
"fieldType": "dropdown",
|
| 40 |
+
"fieldOptions": {
|
| 41 |
+
"values": [
|
| 42 |
+
{
|
| 43 |
+
"option": "Morocco"
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"option": "France"
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"option": "Spain"
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"option": "United States"
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"option": "United Kingdom"
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"option": "Germany"
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"option": "Italy"
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"option": "Canada"
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"option": "UAE"
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"option": "Australia"
|
| 71 |
+
}
|
| 72 |
+
]
|
| 73 |
+
},
|
| 74 |
+
"requiredField": true
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"fieldLabel": "max_leads",
|
| 78 |
+
"fieldType": "number",
|
| 79 |
+
"placeholder": "How many leads? (e.g., 24, 44, 60, 100)",
|
| 80 |
+
"requiredField": true
|
| 81 |
+
}
|
| 82 |
+
]
|
| 83 |
+
},
|
| 84 |
+
"options": {}
|
| 85 |
+
},
|
| 86 |
+
"id": "8bc91f1a-b393-4991-b4d2-222fc996c18b",
|
| 87 |
+
"name": "π Lead Request Form",
|
| 88 |
+
"type": "n8n-nodes-base.formTrigger",
|
| 89 |
+
"typeVersion": 2.1,
|
| 90 |
+
"position": [
|
| 91 |
+
-1680,
|
| 92 |
+
480
|
| 93 |
+
],
|
| 94 |
+
"webhookId": "complete-lead-generator"
|
| 95 |
+
},
|
| 96 |
+
{
|
| 97 |
+
"parameters": {
|
| 98 |
+
"assignments": {
|
| 99 |
+
"assignments": [
|
| 100 |
+
{
|
| 101 |
+
"id": "query",
|
| 102 |
+
"name": "query",
|
| 103 |
+
"value": "={{ $json.business_type }}",
|
| 104 |
+
"type": "string"
|
| 105 |
+
},
|
| 106 |
+
{
|
| 107 |
+
"id": "city",
|
| 108 |
+
"name": "city",
|
| 109 |
+
"value": "={{ $json.city }}",
|
| 110 |
+
"type": "string"
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"id": "country",
|
| 114 |
+
"name": "country",
|
| 115 |
+
"value": "={{ $json.country }}",
|
| 116 |
+
"type": "string"
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"id": "max_leads",
|
| 120 |
+
"name": "max_leads",
|
| 121 |
+
"value": "={{ parseInt($json.max_leads) }}",
|
| 122 |
+
"type": "number"
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"id": "search_location",
|
| 126 |
+
"name": "search_location",
|
| 127 |
+
"value": "={{ $json.city }}, {{ $json.country }}",
|
| 128 |
+
"type": "string"
|
| 129 |
+
},
|
| 130 |
+
{
|
| 131 |
+
"id": "all_leads",
|
| 132 |
+
"name": "all_leads",
|
| 133 |
+
"value": [],
|
| 134 |
+
"type": "array"
|
| 135 |
+
}
|
| 136 |
+
]
|
| 137 |
+
},
|
| 138 |
+
"options": {}
|
| 139 |
+
},
|
| 140 |
+
"id": "b14f2536-6277-4e35-820d-27a6b2681472",
|
| 141 |
+
"name": "Setup Parameters",
|
| 142 |
+
"type": "n8n-nodes-base.set",
|
| 143 |
+
"typeVersion": 3.4,
|
| 144 |
+
"position": [
|
| 145 |
+
-1380,
|
| 146 |
+
480
|
| 147 |
+
]
|
| 148 |
+
},
|
| 149 |
+
{
|
| 150 |
+
"parameters": {
|
| 151 |
+
"q": "={{ $json.search_location }} coordinates",
|
| 152 |
+
"additionalFields": {
|
| 153 |
+
"num": 1
|
| 154 |
+
},
|
| 155 |
+
"requestOptions": {}
|
| 156 |
+
},
|
| 157 |
+
"id": "ea8d6afb-3c4d-4e90-b69b-341edd3d3c44",
|
| 158 |
+
"name": "Find Coordinates",
|
| 159 |
+
"type": "n8n-nodes-serpapi.serpApi",
|
| 160 |
+
"typeVersion": 1,
|
| 161 |
+
"position": [
|
| 162 |
+
-1080,
|
| 163 |
+
480
|
| 164 |
+
],
|
| 165 |
+
"credentials": {
|
| 166 |
+
"serpApi": {
|
| 167 |
+
"id": "RV7uy4j6c8AGccaI",
|
| 168 |
+
"name": "SerpAPI account"
|
| 169 |
+
}
|
| 170 |
+
}
|
| 171 |
+
},
|
| 172 |
+
{
|
| 173 |
+
"parameters": {
|
| 174 |
+
"jsCode": "// Extract coordinates for search location\nconst searchData = $('Setup Parameters').first().json;\nconst kg = $input.first().json.knowledge_graph || {};\nconst answer = $input.first().json.answer_box || {};\n\n// Try to get coordinates from SerpAPI response\nlet lat, lng;\n\nif (kg.coordinates) {\n lat = kg.coordinates.latitude;\n lng = kg.coordinates.longitude;\n} else if (answer.answer && answer.answer.includes('Β°')) {\n const match = answer.answer.match(/(-?\\d+\\.\\d+)Β°?\\s*([NS]),?\\s*(-?\\d+\\.\\d+)Β°?\\s*([EW])/);\n if (match) {\n lat = parseFloat(match[1]);\n lng = parseFloat(match[3]);\n if (match[2] === 'S') lat = -lat;\n if (match[4] === 'W') lng = -lng;\n }\n}\n\n// Comprehensive fallback coordinates for major cities\nif (!lat || !lng) {\n const fallbacks = {\n 'Casablanca, Morocco': [33.5731, -7.5898],\n 'Rabat, Morocco': [34.0209, -6.8416],\n 'Meknes, Morocco': [33.8675, -5.5382],\n 'Fez, Morocco': [34.0181, -5.0078],\n 'Marrakech, Morocco': [31.6295, -7.9811],\n 'Paris, France': [48.8566, 2.3522],\n 'Lyon, France': [45.7640, 4.8357],\n 'Marseille, France': [43.2965, 5.3698],\n 'Nice, France': [43.7102, 7.2620],\n 'Madrid, Spain': [40.4168, -3.7038],\n 'Barcelona, Spain': [41.3851, 2.1734],\n 'Valencia, Spain': [39.4699, -0.3763],\n 'Seville, Spain': [37.3891, -5.9845],\n 'New York, United States': [40.7128, -74.0060],\n 'Los Angeles, United States': [34.0522, -118.2437],\n 'Chicago, United States': [41.8781, -87.6298],\n 'Miami, United States': [25.7617, -80.1918],\n 'London, United Kingdom': [51.5074, -0.1278],\n 'Manchester, United Kingdom': [53.4808, -2.2426],\n 'Birmingham, United Kingdom': [52.4862, -1.8904],\n 'Liverpool, United Kingdom': [53.4084, -2.9916],\n 'Berlin, Germany': [52.5200, 13.4050],\n 'Munich, Germany': [48.1351, 11.5820],\n 'Hamburg, Germany': [53.5511, 9.9937],\n 'Frankfurt, Germany': [50.1109, 8.6821],\n 'Rome, Italy': [41.9028, 12.4964],\n 'Milan, Italy': [45.4642, 9.1900],\n 'Naples, Italy': [40.8518, 14.2681],\n 'Florence, Italy': [43.7696, 11.2558],\n 'Toronto, Canada': [43.6532, -79.3832],\n 'Vancouver, Canada': [49.2827, -123.1207],\n 'Montreal, Canada': [45.5017, -73.5673],\n 'Calgary, Canada': [51.0447, -114.0719],\n 'Dubai, UAE': [25.2048, 55.2708],\n 'Abu Dhabi, UAE': [24.4539, 54.3773],\n 'Sydney, Australia': [-33.8688, 151.2093],\n 'Melbourne, Australia': [-37.8136, 144.9631]\n };\n \n const coords = fallbacks[searchData.search_location] || [40.7128, -74.0060];\n lat = coords[0];\n lng = coords[1];\n}\n\nreturn {\n ...searchData,\n coordinates_string: `@${lat},${lng},13z`\n};"
|
| 175 |
+
},
|
| 176 |
+
"id": "c1c874d4-f7de-4865-9ea0-85adb33a29d4",
|
| 177 |
+
"name": "Extract Coordinates",
|
| 178 |
+
"type": "n8n-nodes-base.code",
|
| 179 |
+
"typeVersion": 2,
|
| 180 |
+
"position": [
|
| 181 |
+
-780,
|
| 182 |
+
480
|
| 183 |
+
]
|
| 184 |
+
},
|
| 185 |
+
{
|
| 186 |
+
"parameters": {
|
| 187 |
+
"operation": "google_maps",
|
| 188 |
+
"q": "={{ $json.query }}",
|
| 189 |
+
"ll": "={{ $json.coordinates_string }}",
|
| 190 |
+
"additionalFields": {
|
| 191 |
+
"hl": "en",
|
| 192 |
+
"start": 0
|
| 193 |
+
},
|
| 194 |
+
"requestOptions": {}
|
| 195 |
+
},
|
| 196 |
+
"id": "9323f556-08a5-46e9-b16a-3fd56f04a1eb",
|
| 197 |
+
"name": "SerpAPI Google Maps Search",
|
| 198 |
+
"type": "n8n-nodes-serpapi.serpApi",
|
| 199 |
+
"typeVersion": 1,
|
| 200 |
+
"position": [
|
| 201 |
+
-480,
|
| 202 |
+
480
|
| 203 |
+
],
|
| 204 |
+
"credentials": {
|
| 205 |
+
"serpApi": {
|
| 206 |
+
"id": "RV7uy4j6c8AGccaI",
|
| 207 |
+
"name": "SerpAPI account"
|
| 208 |
+
}
|
| 209 |
+
}
|
| 210 |
+
},
|
| 211 |
+
{
|
| 212 |
+
"parameters": {
|
| 213 |
+
"jsCode": "// This code processes both initial and paginated results.\n\n// Get static parameters\nconst searchDataFromSetup = $('Setup Parameters').first().json;\nconst maxDesired = searchDataFromSetup.max_leads;\nconst query = searchDataFromSetup.query;\nconst search_location = searchDataFromSetup.search_location;\nconst coordinates_string = $('Extract Coordinates').first().json.coordinates_string;\n\n// Get API results from the node's direct input\nconst mapResults = $input.first().json;\nconst results = mapResults.local_results || [];\n\n// Get previously collected leads.\n// The data comes from the node before the HTTP Request that might have lost it.\n// If that node hasn't run yet, it means this is the first execution, so we have no existing leads.\nlet existingLeads = [];\ntry {\n existingLeads = $('Continue or Finalize?').first().json.all_leads || [];\n} catch (e) {\n // 'Continue or Finalize?' has not run yet. This is expected on the first pass.\n existingLeads = [];\n}\n\nconsole.log(`=== PROCESSING RESULTS ===`);\nconsole.log(`Found ${results.length} new results`);\nconsole.log(`Existing leads: ${existingLeads.length}`);\nconsole.log(`Target: ${maxDesired}`);\n\n// Process each business with complete data extraction\nconst newLeads = results.map((business, index) => {\n const businessName = business.title || 'Unknown';\n const website = business.website || '';\n const phone = business.phone ? \"'\" + business.phone.replace(/[^\\d\\+\\-\\(\\)\\s]/g, '') : '';\n const rating = business.rating || 0;\n const reviews = business.reviews || 0;\n \n // Generate email from website domain\n let email = '';\n if (website) {\n try {\n const domain = website.replace(/^https?:\\/\\//, '').replace(/\\/.*$/, '').replace(/^www\\./, '');\n email = `info@${domain}`;\n } catch (e) {\n email = '';\n }\n }\n \n // Extract social media links from business data\n const links = business.links || {};\n let facebook = '', instagram = '', linkedin = '', twitter = '';\n \n Object.values(links).forEach(link => {\n const url = typeof link === 'string' ? link : (link.link || '');\n if (url.includes('facebook.com')) facebook = url;\n if (url.includes('instagram.com')) instagram = url;\n if (url.includes('linkedin.com')) linkedin = url;\n if (url.includes('twitter.com') || url.includes('x.com')) twitter = url;\n });\n \n // Generate probable social media if not found but we have website\n if (website && businessName && !facebook) {\n const cleanName = businessName.toLowerCase().replace(/[^a-z0-9]/g, '').substring(0, 15);\n if (cleanName.length > 3) {\n facebook = `https://facebook.com/${cleanName}`;\n instagram = `https://instagram.com/${cleanName}`;\n }\n }\n \n // Enhanced lead scoring algorithm (0-100 points)\n let leadScore = 15; // Base score\n if (website) {\n leadScore += 35;\n if (website.includes('https://')) leadScore += 5;\n }\n if (phone && phone !== \"'\") leadScore += 20;\n if (reviews > 0) {\n leadScore += 10;\n if (rating >= 4.5) leadScore += 15;\n else if (rating >= 4.0) leadScore += 10;\n else if (rating >= 3.5) leadScore += 5;\n }\n if (business.hours) leadScore += 5;\n if (business.address && business.address.length > 10) leadScore += 5;\n if (reviews >= 100) leadScore += 5;\n else if (reviews >= 50) leadScore += 3;\n \n leadScore = Math.min(leadScore, 100);\n \n // Quality tier based on lead score\n let qualityTier = 'Poor';\n if (leadScore >= 85) qualityTier = 'Excellent';\n else if (leadScore >= 70) qualityTier = 'Good';\n else if (leadScore >= 55) qualityTier = 'Average';\n \n return {\n business_name: businessName,\n phone: phone,\n website: website,\n email: email,\n address: business.address || '',\n rating: rating,\n reviews: reviews,\n hours: business.hours || '',\n google_maps_link: business.place_id ? \n `https://www.google.com/maps/place/?q=place_id:${business.place_id}` :\n `https://www.google.com/maps/search/${encodeURIComponent(businessName)}`,\n lead_score: leadScore,\n quality_tier: qualityTier,\n facebook: facebook,\n instagram: instagram,\n linkedin: linkedin,\n twitter: twitter,\n category: business.type || query,\n search_query: query,\n search_location: search_location,\n place_id: business.place_id || '',\n position: existingLeads.length + index + 1\n };\n});\n\n// Remove duplicates and combine\nconst allLeadsMap = new Map();\nexistingLeads.forEach(lead => {\n const key = `${lead.business_name}|${lead.address}`.toLowerCase();\n allLeadsMap.set(key, lead);\n});\nnewLeads.forEach(lead => {\n const key = `${lead.business_name}|${lead.address}`.toLowerCase();\n if (!allLeadsMap.has(key)) {\n allLeadsMap.set(key, lead);\n }\n});\nconst allLeads = Array.from(allLeadsMap.values());\nconst totalCollected = allLeads.length;\n\n// Check SerpAPI pagination for next page\nconst paginationInfo = mapResults.serpapi_pagination || {};\nconst nextPageUrl = paginationInfo.next || '';\nconst hasMorePages = !!nextPageUrl;\n\nconsole.log(`Total collected: ${totalCollected}/${maxDesired}`);\nconsole.log(`Has more pages: ${hasMorePages}`);\n\n// Decision logic for pagination\nconst needMoreLeads = totalCollected < maxDesired;\nconst shouldContinue = needMoreLeads && hasMorePages && results.length > 0;\n\nconsole.log(`Should continue: ${shouldContinue}`);\n\nif (shouldContinue) {\n // Return single object for pagination continuation\n return {\n // Pass along all necessary data for the loop\n query: query,\n city: searchDataFromSetup.city,\n country: searchDataFromSetup.country,\n max_leads: maxDesired,\n search_location: search_location,\n all_leads: allLeads, // <-- This is the crucial state being passed\n next_page_url: nextPageUrl,\n continue_search: true,\n coordinates_string: coordinates_string,\n progress: `Collected ${totalCollected}/${maxDesired} leads`\n };\n} else {\n // Search complete - return final results as array\n const finalLeads = allLeads\n .sort((a, b) => b.lead_score - a.lead_score)\n .slice(0, maxDesired);\n \n console.log(`=== SEARCH COMPLETE ===`);\n console.log(`Returning ${finalLeads.length} leads`);\n \n return finalLeads;\n}"
|
| 214 |
+
},
|
| 215 |
+
"id": "200b5685-ef4c-44cb-aa88-08e0841c0c1f",
|
| 216 |
+
"name": "Process and Paginate Results",
|
| 217 |
+
"type": "n8n-nodes-base.code",
|
| 218 |
+
"typeVersion": 2,
|
| 219 |
+
"position": [
|
| 220 |
+
-120,
|
| 221 |
+
480
|
| 222 |
+
],
|
| 223 |
+
"notes": "This node processes results from both the initial search and all subsequent paginated fetches. It consolidates leads, handles duplicates, and determines if another page is needed."
|
| 224 |
+
},
|
| 225 |
+
{
|
| 226 |
+
"parameters": {
|
| 227 |
+
"rules": {
|
| 228 |
+
"values": [
|
| 229 |
+
{
|
| 230 |
+
"conditions": {
|
| 231 |
+
"options": {
|
| 232 |
+
"caseSensitive": true,
|
| 233 |
+
"leftValue": "",
|
| 234 |
+
"typeValidation": "strict",
|
| 235 |
+
"version": 2
|
| 236 |
+
},
|
| 237 |
+
"conditions": [
|
| 238 |
+
{
|
| 239 |
+
"id": "5ea1bba2-aec8-4a99-b49f-4569729a0a98",
|
| 240 |
+
"leftValue": "={{ $json.continue_search }}",
|
| 241 |
+
"rightValue": "true",
|
| 242 |
+
"operator": {
|
| 243 |
+
"type": "boolean",
|
| 244 |
+
"operation": "true",
|
| 245 |
+
"singleValue": true
|
| 246 |
+
}
|
| 247 |
+
}
|
| 248 |
+
],
|
| 249 |
+
"combinator": "and"
|
| 250 |
+
},
|
| 251 |
+
"renameOutput": true,
|
| 252 |
+
"outputKey": "Continue "
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"conditions": {
|
| 256 |
+
"options": {
|
| 257 |
+
"caseSensitive": true,
|
| 258 |
+
"leftValue": "",
|
| 259 |
+
"typeValidation": "strict",
|
| 260 |
+
"version": 2
|
| 261 |
+
},
|
| 262 |
+
"conditions": [
|
| 263 |
+
{
|
| 264 |
+
"id": "09beb580-fa5f-4ef5-b5ad-cca932ba41e2",
|
| 265 |
+
"leftValue": "={{ $json.continue_search }}",
|
| 266 |
+
"rightValue": "",
|
| 267 |
+
"operator": {
|
| 268 |
+
"type": "boolean",
|
| 269 |
+
"operation": "empty",
|
| 270 |
+
"singleValue": true
|
| 271 |
+
}
|
| 272 |
+
}
|
| 273 |
+
],
|
| 274 |
+
"combinator": "and"
|
| 275 |
+
},
|
| 276 |
+
"renameOutput": true,
|
| 277 |
+
"outputKey": "Finalize"
|
| 278 |
+
}
|
| 279 |
+
]
|
| 280 |
+
},
|
| 281 |
+
"options": {}
|
| 282 |
+
},
|
| 283 |
+
"id": "6266d0ec-3279-4281-bde5-10a0969e9cf7",
|
| 284 |
+
"name": "Continue or Finalize?",
|
| 285 |
+
"type": "n8n-nodes-base.switch",
|
| 286 |
+
"typeVersion": 3.2,
|
| 287 |
+
"position": [
|
| 288 |
+
320,
|
| 289 |
+
480
|
| 290 |
+
]
|
| 291 |
+
},
|
| 292 |
+
{
|
| 293 |
+
"parameters": {
|
| 294 |
+
"url": "={{ $json.next_page_url }}",
|
| 295 |
+
"authentication": "predefinedCredentialType",
|
| 296 |
+
"nodeCredentialType": "serpApi",
|
| 297 |
+
"options": {
|
| 298 |
+
"response": {
|
| 299 |
+
"response": {
|
| 300 |
+
"responseFormat": "json"
|
| 301 |
+
}
|
| 302 |
+
}
|
| 303 |
+
}
|
| 304 |
+
},
|
| 305 |
+
"id": "ae406d6b-757d-4cd1-bb8d-718a79e85384",
|
| 306 |
+
"name": "Fetch Next Page URL",
|
| 307 |
+
"type": "n8n-nodes-base.httpRequest",
|
| 308 |
+
"typeVersion": 4.2,
|
| 309 |
+
"position": [
|
| 310 |
+
500,
|
| 311 |
+
860
|
| 312 |
+
],
|
| 313 |
+
"credentials": {
|
| 314 |
+
"serpApi": {
|
| 315 |
+
"id": "RV7uy4j6c8AGccaI",
|
| 316 |
+
"name": "SerpAPI account"
|
| 317 |
+
}
|
| 318 |
+
}
|
| 319 |
+
},
|
| 320 |
+
{
|
| 321 |
+
"parameters": {
|
| 322 |
+
"amount": 2
|
| 323 |
+
},
|
| 324 |
+
"id": "cad517cf-dea7-4b1b-945f-1345884c1ee8",
|
| 325 |
+
"name": "Wait 2 Seconds",
|
| 326 |
+
"type": "n8n-nodes-base.wait",
|
| 327 |
+
"typeVersion": 1.1,
|
| 328 |
+
"position": [
|
| 329 |
+
-320,
|
| 330 |
+
760
|
| 331 |
+
],
|
| 332 |
+
"webhookId": "529a13ca-8879-406b-bcb6-38be300da2c9"
|
| 333 |
+
},
|
| 334 |
+
{
|
| 335 |
+
"parameters": {
|
| 336 |
+
"sortFieldsUi": {
|
| 337 |
+
"sortField": [
|
| 338 |
+
{
|
| 339 |
+
"fieldName": "lead_score"
|
| 340 |
+
}
|
| 341 |
+
]
|
| 342 |
+
},
|
| 343 |
+
"options": {}
|
| 344 |
+
},
|
| 345 |
+
"id": "3fe3548d-3d07-47dc-b5e2-44a5257d224b",
|
| 346 |
+
"name": "Sort by Lead Score",
|
| 347 |
+
"type": "n8n-nodes-base.sort",
|
| 348 |
+
"typeVersion": 1,
|
| 349 |
+
"position": [
|
| 350 |
+
640,
|
| 351 |
+
500
|
| 352 |
+
]
|
| 353 |
+
},
|
| 354 |
+
{
|
| 355 |
+
"parameters": {
|
| 356 |
+
"operation": "append",
|
| 357 |
+
"documentId": {
|
| 358 |
+
"__rl": true,
|
| 359 |
+
"value": "1IITc0seUBygoAfcmeylWISCDV_qsLJj9ZlASrY_iYzA",
|
| 360 |
+
"mode": "list",
|
| 361 |
+
"cachedResultName": "lead",
|
| 362 |
+
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1IITc0seUBygoAfcmeylWISCDV_qsLJj9ZlASrY_iYzA/edit?usp=drivesdk"
|
| 363 |
+
},
|
| 364 |
+
"sheetName": {
|
| 365 |
+
"__rl": true,
|
| 366 |
+
"value": 1723972879,
|
| 367 |
+
"mode": "list",
|
| 368 |
+
"cachedResultName": "lead.csv",
|
| 369 |
+
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1IITc0seUBygoAfcmeylWISCDV_qsLJj9ZlASrY_iYzA/edit#gid=1723972879"
|
| 370 |
+
},
|
| 371 |
+
"columns": {
|
| 372 |
+
"mappingMode": "defineBelow",
|
| 373 |
+
"value": {
|
| 374 |
+
"Business Name": "={{ $json.business_name }}",
|
| 375 |
+
"Phone": "={{ $json.phone }}",
|
| 376 |
+
"Website": "={{ $json.website }}",
|
| 377 |
+
"Email": "={{ $json.email }}",
|
| 378 |
+
"Address": "={{ $json.address }}",
|
| 379 |
+
"Rating": "={{ $json.rating }}",
|
| 380 |
+
"Reviews": "={{ $json.reviews }}",
|
| 381 |
+
"Hours": "={{ $json.hours }}",
|
| 382 |
+
"Google Maps Link": "={{ $json.google_maps_link }}",
|
| 383 |
+
"Lead Score": "={{ $json.lead_score }}",
|
| 384 |
+
"Quality Tier": "={{ $json.quality_tier }}",
|
| 385 |
+
"Facebook": "={{ $json.facebook }}",
|
| 386 |
+
"Instagram": "={{ $json.instagram }}",
|
| 387 |
+
"LinkedIn": "={{ $json.linkedin }}",
|
| 388 |
+
"Category": "={{ $json.category }}",
|
| 389 |
+
"Search Query": "={{ $json.search_query }}",
|
| 390 |
+
"Search Location": "={{ $json.search_location }}"
|
| 391 |
+
},
|
| 392 |
+
"matchingColumns": [],
|
| 393 |
+
"schema": [
|
| 394 |
+
{
|
| 395 |
+
"id": "Business Name",
|
| 396 |
+
"displayName": "Business Name",
|
| 397 |
+
"required": false,
|
| 398 |
+
"defaultMatch": false,
|
| 399 |
+
"display": true,
|
| 400 |
+
"type": "string",
|
| 401 |
+
"canBeUsedToMatch": true
|
| 402 |
+
},
|
| 403 |
+
{
|
| 404 |
+
"id": "Phone",
|
| 405 |
+
"displayName": "Phone",
|
| 406 |
+
"required": false,
|
| 407 |
+
"defaultMatch": false,
|
| 408 |
+
"display": true,
|
| 409 |
+
"type": "string",
|
| 410 |
+
"canBeUsedToMatch": true
|
| 411 |
+
},
|
| 412 |
+
{
|
| 413 |
+
"id": "Website",
|
| 414 |
+
"displayName": "Website",
|
| 415 |
+
"required": false,
|
| 416 |
+
"defaultMatch": false,
|
| 417 |
+
"display": true,
|
| 418 |
+
"type": "string",
|
| 419 |
+
"canBeUsedToMatch": true
|
| 420 |
+
},
|
| 421 |
+
{
|
| 422 |
+
"id": "Email",
|
| 423 |
+
"displayName": "Email",
|
| 424 |
+
"required": false,
|
| 425 |
+
"defaultMatch": false,
|
| 426 |
+
"display": true,
|
| 427 |
+
"type": "string",
|
| 428 |
+
"canBeUsedToMatch": true
|
| 429 |
+
},
|
| 430 |
+
{
|
| 431 |
+
"id": "Address",
|
| 432 |
+
"displayName": "Address",
|
| 433 |
+
"required": false,
|
| 434 |
+
"defaultMatch": false,
|
| 435 |
+
"display": true,
|
| 436 |
+
"type": "string",
|
| 437 |
+
"canBeUsedToMatch": true
|
| 438 |
+
},
|
| 439 |
+
{
|
| 440 |
+
"id": "Rating",
|
| 441 |
+
"displayName": "Rating",
|
| 442 |
+
"required": false,
|
| 443 |
+
"defaultMatch": false,
|
| 444 |
+
"display": true,
|
| 445 |
+
"type": "string",
|
| 446 |
+
"canBeUsedToMatch": true
|
| 447 |
+
},
|
| 448 |
+
{
|
| 449 |
+
"id": "Reviews",
|
| 450 |
+
"displayName": "Reviews",
|
| 451 |
+
"required": false,
|
| 452 |
+
"defaultMatch": false,
|
| 453 |
+
"display": true,
|
| 454 |
+
"type": "string",
|
| 455 |
+
"canBeUsedToMatch": true
|
| 456 |
+
},
|
| 457 |
+
{
|
| 458 |
+
"id": "Hours",
|
| 459 |
+
"displayName": "Hours",
|
| 460 |
+
"required": false,
|
| 461 |
+
"defaultMatch": false,
|
| 462 |
+
"display": true,
|
| 463 |
+
"type": "string",
|
| 464 |
+
"canBeUsedToMatch": true
|
| 465 |
+
},
|
| 466 |
+
{
|
| 467 |
+
"id": "Google Maps Link",
|
| 468 |
+
"displayName": "Google Maps Link",
|
| 469 |
+
"required": false,
|
| 470 |
+
"defaultMatch": false,
|
| 471 |
+
"display": true,
|
| 472 |
+
"type": "string",
|
| 473 |
+
"canBeUsedToMatch": true
|
| 474 |
+
},
|
| 475 |
+
{
|
| 476 |
+
"id": "Lead Score",
|
| 477 |
+
"displayName": "Lead Score",
|
| 478 |
+
"required": false,
|
| 479 |
+
"defaultMatch": false,
|
| 480 |
+
"display": true,
|
| 481 |
+
"type": "string",
|
| 482 |
+
"canBeUsedToMatch": true
|
| 483 |
+
},
|
| 484 |
+
{
|
| 485 |
+
"id": "Quality Tier",
|
| 486 |
+
"displayName": "Quality Tier",
|
| 487 |
+
"required": false,
|
| 488 |
+
"defaultMatch": false,
|
| 489 |
+
"display": true,
|
| 490 |
+
"type": "string",
|
| 491 |
+
"canBeUsedToMatch": true
|
| 492 |
+
},
|
| 493 |
+
{
|
| 494 |
+
"id": "Facebook",
|
| 495 |
+
"displayName": "Facebook",
|
| 496 |
+
"required": false,
|
| 497 |
+
"defaultMatch": false,
|
| 498 |
+
"display": true,
|
| 499 |
+
"type": "string",
|
| 500 |
+
"canBeUsedToMatch": true
|
| 501 |
+
},
|
| 502 |
+
{
|
| 503 |
+
"id": "Instagram",
|
| 504 |
+
"displayName": "Instagram",
|
| 505 |
+
"required": false,
|
| 506 |
+
"defaultMatch": false,
|
| 507 |
+
"display": true,
|
| 508 |
+
"type": "string",
|
| 509 |
+
"canBeUsedToMatch": true
|
| 510 |
+
},
|
| 511 |
+
{
|
| 512 |
+
"id": "LinkedIn",
|
| 513 |
+
"displayName": "LinkedIn",
|
| 514 |
+
"required": false,
|
| 515 |
+
"defaultMatch": false,
|
| 516 |
+
"display": true,
|
| 517 |
+
"type": "string",
|
| 518 |
+
"canBeUsedToMatch": true
|
| 519 |
+
},
|
| 520 |
+
{
|
| 521 |
+
"id": "Category",
|
| 522 |
+
"displayName": "Category",
|
| 523 |
+
"required": false,
|
| 524 |
+
"defaultMatch": false,
|
| 525 |
+
"display": true,
|
| 526 |
+
"type": "string",
|
| 527 |
+
"canBeUsedToMatch": true
|
| 528 |
+
},
|
| 529 |
+
{
|
| 530 |
+
"id": "Search Query",
|
| 531 |
+
"displayName": "Search Query",
|
| 532 |
+
"required": false,
|
| 533 |
+
"defaultMatch": false,
|
| 534 |
+
"display": true,
|
| 535 |
+
"type": "string",
|
| 536 |
+
"canBeUsedToMatch": true
|
| 537 |
+
},
|
| 538 |
+
{
|
| 539 |
+
"id": "Search Location",
|
| 540 |
+
"displayName": "Search Location",
|
| 541 |
+
"required": false,
|
| 542 |
+
"defaultMatch": false,
|
| 543 |
+
"display": true,
|
| 544 |
+
"type": "string",
|
| 545 |
+
"canBeUsedToMatch": true
|
| 546 |
+
}
|
| 547 |
+
],
|
| 548 |
+
"attemptToConvertTypes": false,
|
| 549 |
+
"convertFieldsToString": false
|
| 550 |
+
},
|
| 551 |
+
"options": {}
|
| 552 |
+
},
|
| 553 |
+
"id": "d2b4855e-b0f1-4c49-add1-9409cb3b2ee8",
|
| 554 |
+
"name": "Save to Google Sheets",
|
| 555 |
+
"type": "n8n-nodes-base.googleSheets",
|
| 556 |
+
"typeVersion": 4.5,
|
| 557 |
+
"position": [
|
| 558 |
+
920,
|
| 559 |
+
500
|
| 560 |
+
],
|
| 561 |
+
"credentials": {
|
| 562 |
+
"googleSheetsOAuth2Api": {
|
| 563 |
+
"id": "03CEMaGPaZ8zhwpp",
|
| 564 |
+
"name": "Google Sheets account"
|
| 565 |
+
}
|
| 566 |
+
}
|
| 567 |
+
},
|
| 568 |
+
{
|
| 569 |
+
"parameters": {
|
| 570 |
+
"content": "## β
COMPLETE SETUP\n\n**Replace these 4 IDs:**\n## 1. YOUR_SERPAPI_CREDENTIAL_ID (appears twice)\n## 2. YOUR_GOOGLE_SHEET_ID\n## 3. YOUR_SHEET_GID \n## 4. YOUR_GOOGLE_SHEETS_CREDENTIAL_ID\n\n**Test with:**\n- Business: dentists\n- City: Meknes\n- Country: Morocco\n- Leads: 44\n\n**Features:**\nβ
Complete coordinate extraction\nβ
Full SerpAPI pagination\nβ
Lead scoring & sorting\nβ
20 data columns\nβ
Social media extraction\nβ
No duplicates\n\n**This has EVERYTHING!**",
|
| 571 |
+
"height": 760,
|
| 572 |
+
"width": 540,
|
| 573 |
+
"color": 2
|
| 574 |
+
},
|
| 575 |
+
"id": "7d019cd8-571d-468a-b6f6-03108b2517a3",
|
| 576 |
+
"name": "β
Complete Setup Guide",
|
| 577 |
+
"type": "n8n-nodes-base.stickyNote",
|
| 578 |
+
"typeVersion": 1,
|
| 579 |
+
"position": [
|
| 580 |
+
-2020,
|
| 581 |
+
720
|
| 582 |
+
]
|
| 583 |
+
},
|
| 584 |
+
{
|
| 585 |
+
"parameters": {
|
| 586 |
+
"content": "## π PAGINATION CONTROL\n\n**Continuation Logic:**\n- Checks if continue_search = true\n- Verifies max_results limit not exceeded\n- Routes to either continue or finish\n\n**TRUE (Continue):**\n- More results needed\n- Routes to Wait node\n- Then back to SERPAPI search\n\n**FALSE (Finish):**\n- Max results reached\n- No more results available\n- Routes to sorting and saving\n\n**Safety Features:**\n- Prevents infinite loops\n- Rate limiting with delays\n- Progress tracking",
|
| 587 |
+
"height": 620,
|
| 588 |
+
"width": 420,
|
| 589 |
+
"color": 4
|
| 590 |
+
},
|
| 591 |
+
"id": "73901e3a-e415-4f90-8e7d-1de67d8ab1e8",
|
| 592 |
+
"name": "π Pagination Logic",
|
| 593 |
+
"type": "n8n-nodes-base.stickyNote",
|
| 594 |
+
"typeVersion": 1,
|
| 595 |
+
"position": [
|
| 596 |
+
-40,
|
| 597 |
+
660
|
| 598 |
+
]
|
| 599 |
+
},
|
| 600 |
+
{
|
| 601 |
+
"parameters": {
|
| 602 |
+
"content": "## π STEP 1: GET COORDINATES\n\n**Why this step is crucial:**\n- Converts city names to GPS coordinates\n- Ensures accurate location targeting\n- Prevents defaulting to US locations\n- Uses Google Search for coordinate lookup\n\n**SerpAPI Call:**\n- Engine: Google Search\n- Query: \"{city}, {country} coordinates\"\n- Results: Organic + Knowledge Graph\n\n**Handles:**\n- Major cities worldwide\n- Coordinate extraction from results\n- Fallback to predefined coordinates",
|
| 603 |
+
"height": 340,
|
| 604 |
+
"width": 320,
|
| 605 |
+
"color": 5
|
| 606 |
+
},
|
| 607 |
+
"id": "adb3d6de-6ab2-4e97-8a5c-8a63903f674d",
|
| 608 |
+
"name": "π Coordinates Lookup",
|
| 609 |
+
"type": "n8n-nodes-base.stickyNote",
|
| 610 |
+
"typeVersion": 1,
|
| 611 |
+
"position": [
|
| 612 |
+
-1180,
|
| 613 |
+
100
|
| 614 |
+
]
|
| 615 |
+
},
|
| 616 |
+
{
|
| 617 |
+
"parameters": {
|
| 618 |
+
"content": "## πΊοΈ STEP 2: GOOGLE MAPS SEARCH\n\n**SerpAPI Google Maps Engine:**\n- Uses exact GPS coordinates for targeting\n- Language: English (hl=en)\n- Pagination support with 'start' parameter\n- Returns comprehensive business data\n\n**Data Retrieved:**\n- Business name, address, phone\n- Website, rating, reviews, hours\n- GPS coordinates, place_id\n- Service options, categories\n- Direct business links\n\n**Pagination Logic:**\n- Fetches ~20 results per request\n- Continues until max_results reached\n- 2-second delay between requests",
|
| 619 |
+
"height": 400,
|
| 620 |
+
"width": 320,
|
| 621 |
+
"color": 3
|
| 622 |
+
},
|
| 623 |
+
"id": "2cca83da-87a7-4fab-bfc3-35816a314f6f",
|
| 624 |
+
"name": "πΊοΈ Maps Search",
|
| 625 |
+
"type": "n8n-nodes-base.stickyNote",
|
| 626 |
+
"typeVersion": 1,
|
| 627 |
+
"position": [
|
| 628 |
+
-580,
|
| 629 |
+
60
|
| 630 |
+
]
|
| 631 |
+
},
|
| 632 |
+
{
|
| 633 |
+
"parameters": {
|
| 634 |
+
"content": "## π§ SETUP INSTRUCTIONS\n\n**1. SerpAPI Credentials:**\n## - Go to serpapi.com\n## - Sign up for free account (100 searches/month)\n## - Get your API key from dashboard\n## - Add to n8n credentials as \"SerpAPI\"\n## - Paste API key in Authentication field\n\n## **2. Google Sheets Setup:**\n## - Create new Google Sheet\n## - Add \"Leads\" tab if needed\n## - Set up OAuth2 credentials in n8n\n## - Update sheet ID in Save node\n\n## **3. Form Access:**\n## - Webhook URL: your-n8n-url/webhook/lead-gen\n## - Share this URL for lead generation requests",
|
| 635 |
+
"height": 900,
|
| 636 |
+
"width": 560,
|
| 637 |
+
"color": 4
|
| 638 |
+
},
|
| 639 |
+
"id": "10bcf6c0-16b9-4812-9c45-b05439b8699d",
|
| 640 |
+
"name": "βοΈ Setup Instructions",
|
| 641 |
+
"type": "n8n-nodes-base.stickyNote",
|
| 642 |
+
"typeVersion": 1,
|
| 643 |
+
"position": [
|
| 644 |
+
-1420,
|
| 645 |
+
740
|
| 646 |
+
]
|
| 647 |
+
},
|
| 648 |
+
{
|
| 649 |
+
"parameters": {
|
| 650 |
+
"content": "## π GOOGLE SHEETS EXPORT\n\n**15 Rich Data Columns:**\n1. Business Name\n2. Phone (Excel-safe format)\n3. Website URL\n4. Email (estimated)\n5. Full Address\n6. Rating (1-5 stars)\n7. Review Count\n8. Operating Hours\n9. Google Maps Link (direct profile)\n10. Facebook Profile\n11. Instagram Profile\n12. LinkedIn Profile\n13. Business Category\n14. Search Query Used\n15. Search Location\n\n**Features:**\n- Appends to existing data\n- No duplicates (if using unique constraints)\n- Ready for CRM import\n- Perfect for sales outreach",
|
| 651 |
+
"height": 460,
|
| 652 |
+
"width": 360,
|
| 653 |
+
"color": 7
|
| 654 |
+
},
|
| 655 |
+
"id": "4885f342-da0d-4f62-8004-0707a4a3f891",
|
| 656 |
+
"name": "π Sheets Export",
|
| 657 |
+
"type": "n8n-nodes-base.stickyNote",
|
| 658 |
+
"typeVersion": 1,
|
| 659 |
+
"position": [
|
| 660 |
+
840,
|
| 661 |
+
0
|
| 662 |
+
]
|
| 663 |
+
}
|
| 664 |
+
],
|
| 665 |
+
"pinData": {},
|
| 666 |
+
"connections": {
|
| 667 |
+
"π Lead Request Form": {
|
| 668 |
+
"main": [
|
| 669 |
+
[
|
| 670 |
+
{
|
| 671 |
+
"node": "Setup Parameters",
|
| 672 |
+
"type": "main",
|
| 673 |
+
"index": 0
|
| 674 |
+
}
|
| 675 |
+
]
|
| 676 |
+
]
|
| 677 |
+
},
|
| 678 |
+
"Setup Parameters": {
|
| 679 |
+
"main": [
|
| 680 |
+
[
|
| 681 |
+
{
|
| 682 |
+
"node": "Find Coordinates",
|
| 683 |
+
"type": "main",
|
| 684 |
+
"index": 0
|
| 685 |
+
}
|
| 686 |
+
]
|
| 687 |
+
]
|
| 688 |
+
},
|
| 689 |
+
"Find Coordinates": {
|
| 690 |
+
"main": [
|
| 691 |
+
[
|
| 692 |
+
{
|
| 693 |
+
"node": "Extract Coordinates",
|
| 694 |
+
"type": "main",
|
| 695 |
+
"index": 0
|
| 696 |
+
}
|
| 697 |
+
]
|
| 698 |
+
]
|
| 699 |
+
},
|
| 700 |
+
"Extract Coordinates": {
|
| 701 |
+
"main": [
|
| 702 |
+
[
|
| 703 |
+
{
|
| 704 |
+
"node": "SerpAPI Google Maps Search",
|
| 705 |
+
"type": "main",
|
| 706 |
+
"index": 0
|
| 707 |
+
}
|
| 708 |
+
]
|
| 709 |
+
]
|
| 710 |
+
},
|
| 711 |
+
"SerpAPI Google Maps Search": {
|
| 712 |
+
"main": [
|
| 713 |
+
[
|
| 714 |
+
{
|
| 715 |
+
"node": "Process and Paginate Results",
|
| 716 |
+
"type": "main",
|
| 717 |
+
"index": 0
|
| 718 |
+
}
|
| 719 |
+
]
|
| 720 |
+
]
|
| 721 |
+
},
|
| 722 |
+
"Process and Paginate Results": {
|
| 723 |
+
"main": [
|
| 724 |
+
[
|
| 725 |
+
{
|
| 726 |
+
"node": "Continue or Finalize?",
|
| 727 |
+
"type": "main",
|
| 728 |
+
"index": 0
|
| 729 |
+
}
|
| 730 |
+
]
|
| 731 |
+
]
|
| 732 |
+
},
|
| 733 |
+
"Continue or Finalize?": {
|
| 734 |
+
"main": [
|
| 735 |
+
[
|
| 736 |
+
{
|
| 737 |
+
"node": "Fetch Next Page URL",
|
| 738 |
+
"type": "main",
|
| 739 |
+
"index": 0
|
| 740 |
+
}
|
| 741 |
+
],
|
| 742 |
+
[
|
| 743 |
+
{
|
| 744 |
+
"node": "Sort by Lead Score",
|
| 745 |
+
"type": "main",
|
| 746 |
+
"index": 0
|
| 747 |
+
}
|
| 748 |
+
]
|
| 749 |
+
]
|
| 750 |
+
},
|
| 751 |
+
"Fetch Next Page URL": {
|
| 752 |
+
"main": [
|
| 753 |
+
[
|
| 754 |
+
{
|
| 755 |
+
"node": "Wait 2 Seconds",
|
| 756 |
+
"type": "main",
|
| 757 |
+
"index": 0
|
| 758 |
+
}
|
| 759 |
+
]
|
| 760 |
+
]
|
| 761 |
+
},
|
| 762 |
+
"Wait 2 Seconds": {
|
| 763 |
+
"main": [
|
| 764 |
+
[
|
| 765 |
+
{
|
| 766 |
+
"node": "Process and Paginate Results",
|
| 767 |
+
"type": "main",
|
| 768 |
+
"index": 0
|
| 769 |
+
}
|
| 770 |
+
]
|
| 771 |
+
]
|
| 772 |
+
},
|
| 773 |
+
"Sort by Lead Score": {
|
| 774 |
+
"main": [
|
| 775 |
+
[
|
| 776 |
+
{
|
| 777 |
+
"node": "Save to Google Sheets",
|
| 778 |
+
"type": "main",
|
| 779 |
+
"index": 0
|
| 780 |
+
}
|
| 781 |
+
]
|
| 782 |
+
]
|
| 783 |
+
}
|
| 784 |
+
},
|
| 785 |
+
"active": false,
|
| 786 |
+
"settings": {
|
| 787 |
+
"executionOrder": "v1"
|
| 788 |
+
},
|
| 789 |
+
"versionId": "f3cac63b-2b1d-4a79-afb6-f87580371274",
|
| 790 |
+
"meta": {
|
| 791 |
+
"templateCredsSetupCompleted": true,
|
| 792 |
+
"instanceId": "cc8fbc6c0e10ac107523cabe2453f0b9216ff0ef0c1f112312039de381e2f175"
|
| 793 |
+
},
|
| 794 |
+
"id": "EDRiLgoTqfEn8L29",
|
| 795 |
+
"tags": []
|
| 796 |
+
}
|