Last active
September 13, 2025 14:59
-
-
Save anchildress1/cab1237affe75f0bed6629faeb940f2c to your computer and use it in GitHub Desktop.
This is the primary AI Agent workflow for the #n8nbrightdatachallenge challenge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "wf_maps_serp_backup_data", | |
| "nodes": [ | |
| { | |
| "parameters": { | |
| "workflowId": { | |
| "__rl": true, | |
| "value": "wRCvCmRGcILIoLjy", | |
| "mode": "list", | |
| "cachedResultName": "Underfoot — wf_error_notifications" | |
| }, | |
| "workflowInputs": { | |
| "mappingMode": "defineBelow", | |
| "value": { | |
| "json": "={{ { ...$input.all() } }}", | |
| "callingWorkflow": "={ name: {{$workflow.name}}, id: {{$execution.id}} }" | |
| }, | |
| "matchingColumns": ["json"], | |
| "schema": [ | |
| { | |
| "id": "json", | |
| "displayName": "json", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "object", | |
| "removed": false | |
| }, | |
| { | |
| "id": "callingWorkflow", | |
| "displayName": "callingWorkflow", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "object", | |
| "removed": false | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": true | |
| }, | |
| "options": { | |
| "waitForSubWorkflow": false | |
| } | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflow", | |
| "typeVersion": 1.2, | |
| "position": [1632, -448], | |
| "id": "60dbc180-14f5-42cd-94ef-393f688a4cbe", | |
| "name": "call_error_notifier", | |
| "retryOnFail": false | |
| }, | |
| { | |
| "parameters": { | |
| "method": "POST", | |
| "url": "https://api.brightdata.com/request", | |
| "authentication": "predefinedCredentialType", | |
| "nodeCredentialType": "brightdataApi", | |
| "sendHeaders": true, | |
| "headerParameters": { | |
| "parameters": [ | |
| { | |
| "name": "Content-Type", | |
| "value": "application/json" | |
| } | |
| ] | |
| }, | |
| "sendBody": true, | |
| "specifyBody": "json", | |
| "jsonBody": "={\n \"zone\": \"serp_api1\",\n \"url\": \"{{$json.url}}\",\n \"format\": \"raw\",\n \"headers\": {\n \"x-unblock-data-format\": \"parsed_light\"\n }\n}", | |
| "options": { | |
| "timeout": 10000 | |
| } | |
| }, | |
| "type": "n8n-nodes-base.httpRequest", | |
| "typeVersion": 4.2, | |
| "position": [736, -480], | |
| "id": "2b881369-048e-482f-91c5-c7ef5cbf096e", | |
| "name": "brightdata_serp_api", | |
| "executeOnce": false, | |
| "retryOnFail": true, | |
| "credentials": { | |
| "brightdataApi": { | |
| "id": "mPoDSDYWpK4VnaD4", | |
| "name": "brightdata_primary_api_token" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "inputSource": "jsonExample", | |
| "jsonExample": "{\n \"intent\": \"an interest\",\n \"location\": \"a place to look for events\"\n}" | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflowTrigger", | |
| "typeVersion": 1.1, | |
| "position": [64, -400], | |
| "id": "74f79f8d-6497-4bbe-affc-15fe82493c65", | |
| "name": "workflow_trigger", | |
| "alwaysOutputData": false | |
| }, | |
| { | |
| "parameters": { | |
| "jsCode": "// Code node — Run Once for All Items\n// Build a Google Maps search URL from intent + location, biasing by coordinates if available.\n// Input item shape supported:\n// { query: { intent, location, latitude, longitude } } OR flat { intent, location, latitude, longitude }\n// Output: ARRAY of { url }\n\nconst items = $input.all();\n\nconst norm = (s) => (s ?? \"\").toString().trim().replace(/\\s+/g, \" \");\n\nfunction buildMapsSearchURL({ intent, location, latitude, longitude }) {\n const i = norm(intent);\n const l = norm(location);\n const hasLatLng =\n Number.isFinite(latitude) && Number.isFinite(longitude);\n\n if (!i && !l && !hasLatLng) {\n throw new Error(\"Provide at least an intent, a location, or coordinates\");\n }\n\n // Prefer \"intent near lat,lng\" when coords exist; otherwise combine intent + location.\n let q = \"\";\n if (hasLatLng) q = i ? `${i} near ${latitude},${longitude}` : `${latitude},${longitude}`;\n else if (i && l) q = `${i} ${l}`;\n else q = i || l;\n\n return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(q)}`;\n}\n\nreturn items.map((item) => {\n const j = item.json ?? item;\n const src = j.query ?? j;\n const feature = j.features[0];\n\n const lat = Number(src.latitude ?? src.lat ?? src.coordinates?.lat);\n const lng = Number(src.longitude ?? src.lng ?? src.coordinates?.lng);\n\n return {\n url: buildMapsSearchURL({\n intent: $('workflow_trigger').first().json.intent,\n location: src.text ?? feature.properties.formatted,\n latitude: Number.isFinite(feature.properties.lat) ? feature.properties.lat : undefined,\n longitude: Number.isFinite(feature.properties.lon) ? feature.properties.lon : undefined,\n }),\n };\n});" | |
| }, | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [512, -400], | |
| "id": "12a68956-31fd-44f9-a28e-5a7ed09e8c93", | |
| "name": "format_search_url", | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "jsCode": "// Inputs:\n// - html body at $input.first().json.body (required)\n// - base_url at $json.base_url OR $input.first().json.url (optional but recommended)\n//\n// Output: [{ json: { structured, scraped_data } }]\n\nconst html = $input.first().json.body || \"\";\nconst baseUrl =\n $input.first().json.url ||\n \"\";\n\n// --- helpers ---\nfunction categorizeLink(url) {\n if (!url) return \"unknown\";\n const u = url.toLowerCase();\n if (u.startsWith(\"mailto:\") || u.startsWith(\"tel:\")) return \"contact\";\n if (u.includes(\"facebook\") || u.includes(\"linkedin\") || u.includes(\"pinterest\") || u.includes(\"youtube\") || u.includes(\"twitter\") || u.includes(\"x.com\") || u.includes(\"instagram\") || u.includes(\"tiktok\")) return \"social\";\n if (u.startsWith(\"/\")) return \"internal\";\n try {\n const abs = new URL(u, baseUrl);\n const base = new URL(baseUrl || abs.href);\n return abs.origin === base.origin ? \"internal\" : \"external\";\n } catch {\n return u.startsWith(\"http\") ? \"external\" : \"unknown\";\n }\n}\n\nfunction toAbs(u) {\n if (!u) return u;\n try { return new URL(u, baseUrl).href; } catch { return u; }\n}\n\n// very light HTML entity decode (good enough for headings/link text)\nfunction decodeHTML(str) {\n if (!str) return str;\n const map = { amp: \"&\", lt: \"<\", gt: \">\", quot: '\"', apos: \"'\" };\n return str.replace(/&(#\\d+|#x[0-9a-fA-F]+|[a-zA-Z]+);/g, (m, ent) => {\n if (ent[0] === \"#\") {\n const code = ent[1].toLowerCase() === \"x\" ? parseInt(ent.slice(2),16) : parseInt(ent.slice(1),10);\n return Number.isFinite(code) ? String.fromCharCode(code) : m;\n }\n return map[ent] ?? m;\n });\n}\n\nfunction textOnly(s) { return decodeHTML(s.replace(/<[^>]+>/g, \" \").replace(/\\s+/g, \" \").trim()); }\n\n// --- headings ---\nconst headings = [...html.matchAll(/<h([1-6])[^>]*>([\\s\\S]*?)<\\/h\\1>/gi)].map(m => {\n let inner = m[2];\n const spanMatch = inner.match(/<span[^>]*class=\"([^\"]*)\"[^>]*data-ux=\"([^\"]*)\"?[^>]*>([\\s\\S]*?)<\\/span>/i);\n if (spanMatch) inner = spanMatch[3];\n return { tag: m[1], text: textOnly(inner) };\n});\n\n// --- links (href + text) ---\nconst links = [...html.matchAll(/<a\\b([^>]*?)href=\"([^\"]+)\"([^>]*)>([\\s\\S]*?)<\\/a>/gi)].map(m => {\n const href = m[2];\n const text = textOnly(m[4]);\n const url = toAbs(href);\n return { url, text, category: categorizeLink(href) };\n});\n\n// --- images (src + alt) ---\nconst images = [...html.matchAll(/<img\\b([^>]*?)src=\"([^\"]+)\"([^>]*?)>/gi)].map(m => {\n const src = toAbs(m[2]);\n const altMatch = m[0].match(/\\balt=\"([^\"]*)\"/i);\n const alt = altMatch ? decodeHTML(altMatch[1]) : \"\";\n return { src, alt };\n});\n\n// --- css + js refs ---\nconst css = [...html.matchAll(/<link[^>]+href=\"([^\"]+\\.css(?:\\?[^\"]*)?)\"[^>]*>/gi)].map(m => toAbs(m[1]));\nconst js = [...html.matchAll(/<script[^>]+src=\"([^\"]+)\"[^>]*>\\s*<\\/script>/gi)].map(m => toAbs(m[1]));\n\n// --- meta tags ---\nconst title =\n html.match(/<title>([\\s\\S]*?)<\\/title>/i)?.[1]?.trim() ||\n html.match(/<meta[^>]+property=\"og:title\"[^>]+content=\"([^\"]*)\"/i)?.[1] ||\n html.match(/<meta[^>]+name=\"twitter:title\"[^>]+content=\"([^\"]*)\"/i)?.[1] ||\n \"\";\n\nconst description =\n html.match(/<meta[^>]+name=\"description\"[^>]+content=\"([^\"]*)\"/i)?.[1] ||\n html.match(/<meta[^>]+property=\"og:description\"[^>]+content=\"([^\"]*)\"/i)?.[1] ||\n html.match(/<meta[^>]+name=\"twitter:description\"[^>]+content=\"([^\"]*)\"/i)?.[1] ||\n \"\";\n\nconst canonical = toAbs(html.match(/<link[^>]+rel=\"canonical\"[^>]+href=\"([^\"]+)\"/i)?.[1] || \"\");\nconst robots = html.match(/<meta[^>]+name=\"robots\"[^>]+content=\"([^\"]*)\"/i)?.[1] || \"\";\n\nconst ogImage = toAbs(html.match(/<meta[^>]+property=\"og:image\"[^>]+content=\"([^\"]+)\"/i)?.[1] || \"\");\nconst twImage = toAbs(html.match(/<meta[^>]+name=\"twitter:image\"[^>]+content=\"([^\"]+)\"/i)?.[1] || \"\");\n\n// --- tables -> rows of cell text ---\nconst tables = [...html.matchAll(/<table[^>]*>([\\s\\S]*?)<\\/table>/gi)].map(t => {\n const tableHTML = t[1];\n const rows = [...tableHTML.matchAll(/<tr[^>]*>([\\s\\S]*?)<\\/tr>/gi)].map(r => {\n const rowHTML = r[1];\n const cells = [...rowHTML.matchAll(/<(td|th)[^>]*>([\\s\\S]*?)<\\/\\1>/gi)].map(c => textOnly(c[2]));\n return cells;\n });\n return { rows };\n});\n\n// --- structured payload ---\nconst structured = {\n base_url: baseUrl || null,\n meta: {\n title: decodeHTML(title),\n description: decodeHTML(description),\n canonical,\n robots,\n og_image: ogImage,\n twitter_image: twImage,\n },\n headings,\n links,\n images,\n css,\n js,\n tables,\n};\n\n// return both raw and stringified\nreturn [\n {\n json: {\n structured,\n scraped_data: JSON.stringify(structured, null, 2),\n },\n },\n];\n" | |
| }, | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [960, -592], | |
| "id": "4a5cceeb-6d65-4d08-a4ec-430b758e4dc6", | |
| "name": "normalize", | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "operation": "appendOrUpdate", | |
| "documentId": { | |
| "__rl": true, | |
| "value": "1yA7rRZkgJAGrs6SiGVqHJmwcORunAmM2Mw1KecXcS4A", | |
| "mode": "list", | |
| "cachedResultName": "underfoot_google_maps_serp_cache", | |
| "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1yA7rRZkgJAGrs6SiGVqHJmwcORunAmM2Mw1KecXcS4A/edit?usp=drivesdk" | |
| }, | |
| "sheetName": { | |
| "__rl": true, | |
| "value": "gid=0", | |
| "mode": "list", | |
| "cachedResultName": "Sheet1", | |
| "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1yA7rRZkgJAGrs6SiGVqHJmwcORunAmM2Mw1KecXcS4A/edit#gid=0" | |
| }, | |
| "columns": { | |
| "mappingMode": "autoMapInputData", | |
| "value": {}, | |
| "matchingColumns": ["url"], | |
| "schema": [ | |
| { | |
| "id": "url", | |
| "displayName": "url", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "title", | |
| "displayName": "title", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true | |
| }, | |
| { | |
| "id": "description", | |
| "displayName": "description", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true | |
| }, | |
| { | |
| "id": "rank", | |
| "displayName": "rank", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true | |
| }, | |
| { | |
| "id": "global_rank", | |
| "displayName": "global_rank", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true | |
| }, | |
| { | |
| "id": "query", | |
| "displayName": "query", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true | |
| }, | |
| { | |
| "id": "language", | |
| "displayName": "language", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true | |
| }, | |
| { | |
| "id": "location", | |
| "displayName": "location", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true | |
| }, | |
| { | |
| "id": "latitude", | |
| "displayName": "latitude", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "longitude", | |
| "displayName": "longitude", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "original_url", | |
| "displayName": "original_url", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true | |
| }, | |
| { | |
| "id": "cached_at", | |
| "displayName": "cached_at", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true | |
| }, | |
| { | |
| "id": "user_intent", | |
| "displayName": "user_intent", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "user_location", | |
| "displayName": "user_location", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": false | |
| }, | |
| "options": { | |
| "handlingExtraData": "ignoreIt", | |
| "useAppend": true | |
| } | |
| }, | |
| "type": "n8n-nodes-base.googleSheets", | |
| "typeVersion": 4.7, | |
| "position": [1408, -592], | |
| "id": "75ba4e97-b3cc-410d-9c2c-b14cdcc48293", | |
| "name": "update_cache", | |
| "retryOnFail": false, | |
| "credentials": { | |
| "googleSheetsOAuth2Api": { | |
| "id": "LlE3kL9RL6ALt0Sy", | |
| "name": "Google Sheets Primary" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "url": "=https://api.geoapify.com/v1/geocode/search", | |
| "authentication": "genericCredentialType", | |
| "genericAuthType": "httpQueryAuth", | |
| "sendQuery": true, | |
| "queryParameters": { | |
| "parameters": [ | |
| { | |
| "name": "text", | |
| "value": "={{ $json.location }}" | |
| } | |
| ] | |
| }, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.httpRequest", | |
| "typeVersion": 4.2, | |
| "position": [288, -400], | |
| "id": "fb5f1e60-8b0c-44a1-9e46-aeee3360a1fa", | |
| "name": "normalize_location_with_geoapify", | |
| "credentials": { | |
| "httpCustomAuth": { | |
| "id": "tFONdKuC2m4mZWzj", | |
| "name": "BRIGHTDATA_SERP_PROXY" | |
| }, | |
| "httpQueryAuth": { | |
| "id": "64boXnNUJyTXiROn", | |
| "name": "GEOAPIFY_API_KEY" | |
| } | |
| } | |
| }, | |
| { | |
| "parameters": { | |
| "useCustomSchema": true, | |
| "schema": "underfoot", | |
| "tableId": "scrape_results", | |
| "dataToSend": "autoMapInputData", | |
| "inputsToIgnore": "error" | |
| }, | |
| "type": "n8n-nodes-base.supabase", | |
| "typeVersion": 1, | |
| "position": [1184, -880], | |
| "id": "c0ff642c-7cc4-4548-8535-ddafbe2fd0c4", | |
| "name": "create_cache_rows", | |
| "credentials": { | |
| "supabaseApi": { | |
| "id": "dDCJFuMX57sfkIIp", | |
| "name": "supabase_secret_key" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "useCustomSchema": true, | |
| "schema": "underfoot", | |
| "operation": "update", | |
| "tableId": "scrape_results", | |
| "filters": { | |
| "conditions": [ | |
| { | |
| "keyName": "url", | |
| "condition": "eq", | |
| "keyValue": "={{ $json.url }}" | |
| } | |
| ] | |
| } | |
| }, | |
| "type": "n8n-nodes-base.supabase", | |
| "typeVersion": 1, | |
| "position": [1408, -784], | |
| "id": "626ef149-ed81-4a1d-840f-9556c570638f", | |
| "name": "update_existing_rows", | |
| "credentials": { | |
| "supabaseApi": { | |
| "id": "dDCJFuMX57sfkIIp", | |
| "name": "supabase_secret_key" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "authentication": "webhook", | |
| "content": "I think it passed....", | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.discord", | |
| "typeVersion": 2, | |
| "position": [1632, -864], | |
| "id": "dcdbc010-1339-40b8-b544-0327c37f5fe0", | |
| "name": "discord_notifier", | |
| "webhookId": "39a5530b-55ff-4146-bccf-da33d554b2e4", | |
| "credentials": { | |
| "discordWebhookApi": { | |
| "id": "5pDAAzSF5Ij45744", | |
| "name": "discord_hitl_notifier_webhook" | |
| } | |
| } | |
| } | |
| ], | |
| "pinData": { | |
| "workflow_trigger": [ | |
| { | |
| "json": { | |
| "intent": "spider monkey", | |
| "location": "United States" | |
| } | |
| } | |
| ] | |
| }, | |
| "connections": { | |
| "brightdata_serp_api": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "normalize", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "workflow_trigger": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "normalize_location_with_geoapify", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "call_error_notifier": { | |
| "main": [[]] | |
| }, | |
| "format_search_url": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "brightdata_serp_api", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "normalize": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "update_cache", | |
| "type": "main", | |
| "index": 0 | |
| }, | |
| { | |
| "node": "create_cache_rows", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "update_cache": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "discord_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "normalize_location_with_geoapify": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "format_search_url", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "create_cache_rows": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "discord_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "update_existing_rows", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "update_existing_rows": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "discord_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| } | |
| }, | |
| "active": false, | |
| "settings": { | |
| "executionOrder": "v1", | |
| "callerPolicy": "workflowsFromSameOwner", | |
| "errorWorkflow": "g0RA1ILyuSMHbt6q" | |
| }, | |
| "versionId": "c2a92acc-d2e6-4e94-8efd-ff44e191a668", | |
| "meta": { | |
| "templateCredsSetupCompleted": true, | |
| "instanceId": "ca38a51753a4eaa26e21803b676daa6c69ce9542656c83ba5959cacf3a748990" | |
| }, | |
| "id": "TjJFvBLuhBlEO3c8", | |
| "tags": [] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "wf_serp_search_tool", | |
| "nodes": [ | |
| { | |
| "parameters": { | |
| "inputSource": "jsonExample", | |
| "jsonExample": "{\n \"intent\": \"an interest\",\n \"location\": \"a place to look for events\"\n}" | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflowTrigger", | |
| "typeVersion": 1.1, | |
| "position": [-304, -288], | |
| "id": "02b0b089-f143-4659-9ee2-5ba00affb9c8", | |
| "name": "workflow_trigger", | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "workflowId": { | |
| "__rl": true, | |
| "value": "wRCvCmRGcILIoLjy", | |
| "mode": "list", | |
| "cachedResultName": "Underfoot — wf_error_notifications" | |
| }, | |
| "workflowInputs": { | |
| "mappingMode": "defineBelow", | |
| "value": { | |
| "callingWorkflow": "={{ $workflow }}", | |
| "input": "={{ $input.all() }}" | |
| }, | |
| "matchingColumns": [], | |
| "schema": [ | |
| { | |
| "id": "callingWorkflow", | |
| "displayName": "callingWorkflow", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "object" | |
| }, | |
| { | |
| "id": "input", | |
| "displayName": "input", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "array", | |
| "removed": false | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": true | |
| }, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflow", | |
| "typeVersion": 1.2, | |
| "position": [1488, -208], | |
| "id": "f167f2ba-cae4-4474-88a8-1b3a08000fce", | |
| "name": "trigger_discord_notifier" | |
| }, | |
| { | |
| "parameters": { | |
| "useCustomSchema": true, | |
| "schema": "underfoot", | |
| "operation": "getAll", | |
| "tableId": "google_geotarget_lookup", | |
| "limit": 1, | |
| "filters": { | |
| "conditions": [ | |
| { | |
| "keyName": "canonical_name", | |
| "condition": "ilike", | |
| "keyValue": "=*{{ $json.results[0].city }}*" | |
| }, | |
| { | |
| "keyName": "canonical_name", | |
| "condition": "ilike", | |
| "keyValue": "=*{{ $json.results[0].state }}*" | |
| }, | |
| { | |
| "keyName": "name", | |
| "condition": "ilike", | |
| "keyValue": "=*{{ $json.results[0].city }}*" | |
| }, | |
| { | |
| "keyName": "name", | |
| "condition": "ilike", | |
| "keyValue": "=*{{ $json.results[0].state }}*" | |
| } | |
| ] | |
| } | |
| }, | |
| "type": "n8n-nodes-base.supabase", | |
| "typeVersion": 1, | |
| "position": [144, -448], | |
| "id": "49959e20-5549-4362-a34a-68ba38577bfd", | |
| "name": "find_canonical_location", | |
| "alwaysOutputData": false, | |
| "credentials": { | |
| "supabaseApi": { | |
| "id": "dDCJFuMX57sfkIIp", | |
| "name": "supabase_secret_key" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "zone": { | |
| "__rl": true, | |
| "value": "unlocker_serp", | |
| "mode": "list", | |
| "cachedResultName": "unlocker_serp" | |
| }, | |
| "country": { | |
| "__rl": true, | |
| "mode": "list", | |
| "value": "us" | |
| }, | |
| "url": "=https://www.google.com/search?q={{ $json.intent }}&gl={{ $json.country_code }}&uule={{ $json.location }}&hl=en&num=10&tbs=qdr:w2&brd_json=1", | |
| "format": "json", | |
| "requestOptions": { | |
| "timeout": 1200000 | |
| } | |
| }, | |
| "type": "@brightdata/n8n-nodes-brightdata.brightData", | |
| "typeVersion": 1, | |
| "position": [592, -208], | |
| "id": "4c08c06c-1839-4345-846a-2cf3fbf1b992", | |
| "name": "google_serp_search", | |
| "credentials": { | |
| "brightdataApi": { | |
| "id": "mPoDSDYWpK4VnaD4", | |
| "name": "brightdata_primary_api_token" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "mode": "runOnceForEachItem", | |
| "jsCode": "const intent = encodeURI($('workflow_trigger').item.json.intent);\nconst location = $json.canonical_name || $json.query.text;\nconst country_code = $json.country_code || $json.results[0].country_code;\n\nreturn { intent, location: encodeURI(location), country_code: country_code.toLowerCase() };" | |
| }, | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [368, -208], | |
| "id": "c278437d-8509-42bb-ae97-2dc14e9b2f4c", | |
| "name": "generate_search_terms" | |
| }, | |
| { | |
| "parameters": { | |
| "url": "https://api.geoapify.com/v1/geocode/search", | |
| "authentication": "genericCredentialType", | |
| "genericAuthType": "httpQueryAuth", | |
| "sendQuery": true, | |
| "specifyQuery": "json", | |
| "jsonQuery": "={\n \"format\": \"json\",\n \"limit\": 1,\n \"text\": \"{{ $json.location }}\",\n \"lang\": \"en\"\n}", | |
| "options": { | |
| "timeout": 10000 | |
| } | |
| }, | |
| "type": "n8n-nodes-base.httpRequest", | |
| "typeVersion": 4.2, | |
| "position": [-80, -288], | |
| "id": "1963fc52-509a-40c9-9309-7b63e4da1997", | |
| "name": "call_geoapify_search", | |
| "credentials": { | |
| "httpQueryAuth": { | |
| "id": "64boXnNUJyTXiROn", | |
| "name": "GEOAPIFY_API_KEY" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "useCustomSchema": true, | |
| "schema": "underfoot", | |
| "tableId": "search_cache", | |
| "dataToSend": "autoMapInputData" | |
| }, | |
| "type": "n8n-nodes-base.supabase", | |
| "typeVersion": 1, | |
| "position": [1264, -48], | |
| "id": "f9ace4ba-d03a-47a6-a134-00d9d786f045", | |
| "name": "insert_rows", | |
| "credentials": { | |
| "supabaseApi": { | |
| "id": "dDCJFuMX57sfkIIp", | |
| "name": "supabase_secret_key" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "mode": "runOnceForEachItem", | |
| "jsCode": "return JSON.parse($json.body);" | |
| }, | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [816, -144], | |
| "id": "1ca6a0f2-65cd-4943-83b6-578339594351", | |
| "name": "parse_content_to_json", | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "jsCode": "const blockedResults = ['youtube'];\n\nreturn $input.all().map(input => {\n return input.json.organic.map(x => {\n return {\n title: x.link,\n description: x.description || '',\n source_type: $('workflow_trigger').context,\n url: x.link,\n created_at: $now.toISO(),\n latitude: null,\n longitude: null,\n user_intent: $('workflow_trigger').item.json.intent,\n user_location: $('workflow_trigger').item.json.location\n }; \n }).filter(x => !blockedResults.includes(x.url));\n}).flat();" | |
| }, | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [1040, -16], | |
| "id": "2efcdf42-1812-4607-814e-ba59a35d7e20", | |
| "name": "normalize_result_set", | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "jsCode": "return $input.all().map(resp => {\n return resp.json;\n}).flat();" | |
| }, | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [1488, 80], | |
| "id": "6e796bd4-153e-4a90-8042-75ac00bc5e66", | |
| "name": "format_for_hosted_chat_display" | |
| } | |
| ], | |
| "pinData": { | |
| "workflow_trigger": [ | |
| { | |
| "json": { | |
| "intent": "spider pigs", | |
| "location": "wisconsin, US" | |
| } | |
| }, | |
| { | |
| "json": { | |
| "intent": "hippie farm", | |
| "location": "Monroe, GA" | |
| } | |
| } | |
| ] | |
| }, | |
| "connections": { | |
| "workflow_trigger": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "call_geoapify_search", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "find_canonical_location": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "generate_search_terms", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "trigger_discord_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "google_serp_search": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "parse_content_to_json", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "trigger_discord_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "generate_search_terms": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "google_serp_search", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "call_geoapify_search": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "find_canonical_location", | |
| "type": "main", | |
| "index": 0 | |
| }, | |
| { | |
| "node": "generate_search_terms", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [] | |
| ] | |
| }, | |
| "insert_rows": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "format_for_hosted_chat_display", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "trigger_discord_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "parse_content_to_json": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "normalize_result_set", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "trigger_discord_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "normalize_result_set": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "insert_rows", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "trigger_discord_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| } | |
| }, | |
| "active": false, | |
| "settings": { | |
| "executionOrder": "v1", | |
| "callerPolicy": "workflowsFromSameOwner", | |
| "errorWorkflow": "g0RA1ILyuSMHbt6q" | |
| }, | |
| "versionId": "0f935829-3365-42e1-8308-e6ea488d7e02", | |
| "meta": { | |
| "templateCredsSetupCompleted": true, | |
| "instanceId": "ca38a51753a4eaa26e21803b676daa6c69ce9542656c83ba5959cacf3a748990" | |
| }, | |
| "id": "So4ty17033VQwdOO", | |
| "tags": [] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "wf_normalize_location", | |
| "nodes": [ | |
| { | |
| "parameters": { | |
| "workflowInputs": { | |
| "values": [ | |
| { | |
| "name": "location" | |
| } | |
| ] | |
| } | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflowTrigger", | |
| "typeVersion": 1.1, | |
| "position": [0, 0], | |
| "id": "f2b34493-bf4d-455b-a03b-c0adfa75ece3", | |
| "name": "workflow_trigger" | |
| }, | |
| { | |
| "parameters": { | |
| "url": "https://api.geoapify.com/v1/geocode/search", | |
| "authentication": "genericCredentialType", | |
| "genericAuthType": "httpQueryAuth", | |
| "sendQuery": true, | |
| "specifyQuery": "json", | |
| "jsonQuery": "={\n \"format\": \"json\",\n \"limit\": 1,\n \"text\": \"{{ $json.location }}\"\n}", | |
| "options": { | |
| "timeout": 10000 | |
| } | |
| }, | |
| "type": "n8n-nodes-base.httpRequest", | |
| "typeVersion": 4.2, | |
| "position": [208, 0], | |
| "id": "c3d31939-7021-43fd-9bf2-448e48e4599b", | |
| "name": "call_geoapify_search", | |
| "credentials": { | |
| "httpQueryAuth": { | |
| "id": "64boXnNUJyTXiROn", | |
| "name": "GEOAPIFY_API_KEY" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "workflowId": { | |
| "__rl": true, | |
| "value": "wRCvCmRGcILIoLjy", | |
| "mode": "list", | |
| "cachedResultName": "Underfoot — wf_error_notifications" | |
| }, | |
| "workflowInputs": { | |
| "mappingMode": "defineBelow", | |
| "value": { | |
| "json": "={{ $json }}", | |
| "callingWorkflow": "={{ $workflow }}" | |
| }, | |
| "matchingColumns": [], | |
| "schema": [ | |
| { | |
| "id": "json", | |
| "displayName": "json", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "object" | |
| }, | |
| { | |
| "id": "callingWorkflow", | |
| "displayName": "callingWorkflow", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "object" | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": true | |
| }, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflow", | |
| "typeVersion": 1.2, | |
| "position": [416, 96], | |
| "id": "07029db1-dcd4-4aee-af82-ee7512cfedbb", | |
| "name": "call_discord_notifier", | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "mode": "runOnceForEachItem", | |
| "jsCode": "const response = $json.map(item => {\n return {\n \"country_code\": item.country_code,\n \"name\": item.name,\n \"country\": item.country,\n \"state\": item.state,\n \"state_code\": item.state_code,\n \"latitude\": item.lat,\n \"longitude\": item.lon,\n \"result_type\": item.result_type,\n \"bbox\": item.bbox\n }\n})[0];\n\n const bestResult = response.results.reduce((best, curr) => {\n const currConfidence =\n curr.rank && typeof curr.rank.confidence === \"number\"\n ? curr.rank.confidence\n : 0;\n const bestConfidence =\n best.rank && typeof best.rank.confidence === \"number\"\n ? best.rank.confidence\n : 0;\n return currConfidence > bestConfidence ? curr : best;\n });\n\n return {\n country_code: bestResult.country_code || null,\n country: bestResult.country || null,\n state: bestResult.state || null,\n city: bestResult.city || null,\n latitude: typeof bestResult.lat === \"number\" ? bestResult.lat : null,\n longitude: typeof bestResult.lon === \"number\" ? bestResult.lon : null,\n name:\n bestResult.name ||\n bestResult.formatted ||\n bestResult.address_line1 ||\n null,\n };\n}\n\nreturn normalizeLocation(response);\n" | |
| }, | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [416, -96], | |
| "id": "b35ffa9e-4012-485d-9813-7498e6f741a4", | |
| "name": "pick_best_match" | |
| } | |
| ], | |
| "pinData": { | |
| "workflow_trigger": [ | |
| { | |
| "json": { | |
| "location": null | |
| } | |
| }, | |
| { | |
| "json": { | |
| "location": "101 Buncombe-Waco Rd, Waco GA" | |
| } | |
| }, | |
| { | |
| "json": { | |
| "location": "Orlando" | |
| } | |
| }, | |
| { | |
| "json": { | |
| "location": "Grundy, VA" | |
| } | |
| } | |
| ] | |
| }, | |
| "connections": { | |
| "workflow_trigger": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "call_geoapify_search", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "call_geoapify_search": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "pick_best_match", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_discord_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| } | |
| }, | |
| "active": false, | |
| "settings": { | |
| "executionOrder": "v1" | |
| }, | |
| "versionId": "6c11acad-0c98-435d-b7ea-41a3b62bc533", | |
| "meta": { | |
| "instanceId": "ca38a51753a4eaa26e21803b676daa6c69ce9542656c83ba5959cacf3a748990" | |
| }, | |
| "id": "97gX5INNSKK3MdYS", | |
| "tags": [] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "wf_error_notifications", | |
| "nodes": [ | |
| { | |
| "parameters": { | |
| "workflowInputs": { | |
| "values": [ | |
| { | |
| "name": "callingWorkflow", | |
| "type": "object" | |
| }, | |
| { | |
| "name": "input", | |
| "type": "array" | |
| } | |
| ] | |
| } | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflowTrigger", | |
| "typeVersion": 1.1, | |
| "position": [0, 0], | |
| "id": "215a81dd-2b93-42b9-b954-efd38caf0b8f", | |
| "name": "workflow_trigger", | |
| "alwaysOutputData": true, | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "authentication": "webhook", | |
| "content": "=🚨 An error occurred in {{ JSON.stringify($json.callingWorkflow) || $json.callingWorkflow.name }} at {{ $execution.id }} 🛑 ", | |
| "options": {}, | |
| "embeds": { | |
| "values": [ | |
| { | |
| "color": "#4E2ECF", | |
| "timestamp": "= {{ $now.setZone('America/New_York') }}", | |
| "title": "🚨 Error Underfoot 🚨", | |
| "url": "=https://checkmarkdevtools.app.n8n.cloud/workflow/{{ $json.callingWorkflow.id ?? '' }}" | |
| } | |
| ] | |
| } | |
| }, | |
| "type": "n8n-nodes-base.discord", | |
| "typeVersion": 2, | |
| "position": [224, 0], | |
| "id": "02090886-a74a-4ae1-a852-bff7c054d652", | |
| "name": "notify_discord_error", | |
| "webhookId": "e67a747d-2b3d-405e-a498-c4ec4543a8a9", | |
| "credentials": { | |
| "discordWebhookApi": { | |
| "id": "Ew7Osu6yW0GkKHcR", | |
| "name": "discord_error_notifier_webhook" | |
| } | |
| }, | |
| "onError": "continueRegularOutput" | |
| } | |
| ], | |
| "pinData": {}, | |
| "connections": { | |
| "workflow_trigger": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "notify_discord_error", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| } | |
| }, | |
| "active": false, | |
| "settings": { | |
| "executionOrder": "v1", | |
| "callerPolicy": "workflowsFromSameOwner", | |
| "errorWorkflow": "g0RA1ILyuSMHbt6q" | |
| }, | |
| "versionId": "55cabda2-c004-46e9-9068-8251549f1121", | |
| "meta": { | |
| "instanceId": "ca38a51753a4eaa26e21803b676daa6c69ce9542656c83ba5959cacf3a748990" | |
| }, | |
| "id": "wRCvCmRGcILIoLjy", | |
| "tags": [] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "ai_chat_agent", | |
| "nodes": [ | |
| { | |
| "parameters": { | |
| "promptType": "define", | |
| "text": "={{ $json.chatInput }}", | |
| "hasOutputParser": true, | |
| "needsFallback": true, | |
| "options": { | |
| "systemMessage": "<instructions>\n<persona>\nYou are Stonewalker: a mystical, concise, and helpful guide who uncovers hidden, interesting places. Speak with clarity, wisdom, and brevity.\n</persona>\n\n<goal>\nHelp the user discover unique places of interest using available tools. If the user’s input is incomplete or unnormalized, make an educated guess, normalize as needed, or ask a clarifying question if confidence is low. \nAlways output a persona-driven message to the user and a JSON array of relevant items, each with a decimal “Stonewalker Stars” rating (your confidence they’ll enjoy it).\n</goal>\n\n<steps>\n1. Assess if the input contains both a valid intent and a valid location (or if either must be guessed/clarified).\n - You may use your history as context to determine what the user is trying to communicate.\n2. Normalize both intent and location for tool use. \n - If you must guess, be explicit and acknowledge this in your response.\n3. Search using ALL available tools. \n - If no relevant results, inform the user and help broaden their search.\n4. For each result, assign a “Stonewalker Stars” score (0–1) using the official scoring formula.\n - Drop any result that scores 0 for relevance.\n5. Return all relevant data in the structured response. If one or more items do not apply, simply output an empty array, object, or empty string to ensure you pass validation.\n</steps>\n\n<tools class=\"constraints\">\nYou should always attempt to call every tool with a timeout set. Do not wait for an extended amount of time for results to return but you should at least try to retrieve some data from each tool.\n\nWhen outputting data from multiple tools, be sure that it is all in a single list. The results should be normalized so you can include the basic requirements and additional extras that are relevant.\n</tools>\n\n\n<user-input-normalization class=\"constraints\">\nNever pass user input directly to any tool. Always normalize first. \nIf intent is unclear, do your best but acknowledge the guess and ask for clarification.\nBe aware that intent and location may not always appear in the same order. The user may output location first and then intent. It is up to you to know which is which.\n</user-input-normalization>\n\n<intent-normalization class=\"constraints\">\nThe user’s “intent” may be any noun or adjective-noun (e.g., “mystical scary graveyards”). \n- Encourage unique and specific requests, but preserve their exact wording (adjectives and noun together as a single string).\n- Only modify to clarify or combine, never split into separate keywords.\n<example>\nUser: “mystical scary graveyards” \nNormalized: “mystical scary graveyards”\n</example>\n</intent-normalization>\n\n<location-normalization class=\"constraints\">\nNormalize any location input (city, region, or coordinates) to: `<city>, <state code>, <country>`. \nIf needed, infer from common abbreviations or misspellings.\n<example>\nUser: “Atl” \nNormalized: “Atlanta, GA, United States”\n</example>\n</location-normalization>\n\n<output class=\"constraints\">\nFollowing the structured output example, always output at minimum: \n1. Your concise, mystical message to the user (persona-driven) \n2. The user's 'intent' after you parsed so it can be stored in the cache\n3. The normalized 'location' given by the user to store in the cache.\n4. A JSON array of areas of interest as returned by the tool, each with a decimal `score` in [0,1] representing your “Stonewalker Stars” confidence in their fit for the user’s intent. Listed with most relevant first.\n\nYou must always return valid JSON fenced by a markdown code block. Do not return any additional text.\n<example-schema-return>\n```json\n{\n \"user_intent\": \"quiet, beach-like spots to sit by the water\",\n \"user_location\": \"Tallapoosa, GA\",\n \"response\": \"Tallapoosa isn’t coastal, but you’ve got mellow shorelines within a day-use drive. Try Yellowjacket Beach on West Point Lake for a true sand-under-toes vibe, or Lake Harding’s small sandy pull-offs for a quieter read-by-the-water afternoon. Pack snacks, bug spray, and cash for day-use where posted.\",\n \"places\": [\n {\n \"name\": \"Yellowjacket Beach, West Point Lake\",\n \"description\": \"Managed day-use area with a sandy swim beach, restrooms, and picnic tables on a large reservoir.\",\n \"address\": \"Yellowjacket Creek Recreation Area, LaGrange, GA 30240\",\n \"city\": \"LaGrange\",\n \"state\": \"GA\",\n \"country\": \"US\",\n \"coordinates\": { \"lat\": 32.935, \"lng\": -85.129 },\n \"url\": \"https://example.com/west-point-lake-yellowjacket\",\n \"tags\": [\"lake\", \"swim beach\", \"picnic\", \"family-friendly\"],\n \"stonewalker_stars\": 4.4,\n \"confidence\": 0.87,\n \"source\": \"google_places\",\n \"source_id\": \"west_point_yellowjacket_beach\",\n \"cached_at\": \"2025-09-01T01:10:00Z\"\n },\n {\n \"name\": \"Lake Harding (select sandy pull-offs)\",\n \"description\": \"Reservoir on the Chattahoochee with small informal sandy edges; good for low-key shoreline lounging.\",\n \"address\": \"Lake Harding, GA/AL border\",\n \"city\": \"Salem\",\n \"state\": \"AL\",\n \"country\": \"US\",\n \"coordinates\": { \"lat\": 32.682, \"lng\": -85.125 },\n \"url\": \"https://example.com/lake-harding-shore\",\n \"tags\": [\"lake\", \"quiet\", \"shore access\"],\n \"stonewalker_stars\": 3.9,\n \"confidence\": 0.78,\n \"source\": \"google_maps\",\n \"source_id\": \"lake_harding_misc_shore\",\n \"cached_at\": \"2025-09-01T01:10:00Z\"\n }\n ]\n}\n```\n</example-schema-return>\n</output>\n\n<stonewalker-scoring class=\"instructions\">\nUNDERFOOT SCORING (always run after retrieving items)\n- For each item, calculate a `score` in [0,1] using:\n - **relevance** ([0,1]): Text match to user intent + location in title/description/categories.\n - **distance_component** ([0,1]):\n - 0–5 miles: ~1.0\n - 5–15 miles: ~0.7\n - 15–35 miles: ~0.4\n - >35 miles: ~0.15\n - missing: 0.5\n - **app_fit** ([0,1]):\n - High (0.8–1.0): public, safe, experience-forward (tours, landmarks, museums, parks, historic sites, oddities, festivals, etc.)\n - Low (0–0.2): private, unsafe, services (funeral homes, hospitals, offices, explicit/adult, logistics, generic retail, etc.)\n - Special: Cemeteries medium if historic/tour; low otherwise.\n- Final: `score = clamp01(0.5*relevance + 0.2*distance_component + 0.3*app_fit)`\n- ALWAYS attach `score` to each item (do not invent items/fields, use URL as key).\n- Consistently apply rules and do not return results that score 0.\n</stonewalker-scoring>\n</instructions>\n", | |
| "maxIterations": 5, | |
| "returnIntermediateSteps": false | |
| } | |
| }, | |
| "type": "@n8n/n8n-nodes-langchain.agent", | |
| "typeVersion": 2.2, | |
| "position": [336, 960], | |
| "id": "0968cb4e-b08c-4ea0-8316-492b853dc8ee", | |
| "name": "chat_agent", | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "model": { | |
| "__rl": true, | |
| "value": "gpt-4.1-mini", | |
| "mode": "list", | |
| "cachedResultName": "gpt-4.1-mini" | |
| }, | |
| "options": { | |
| "maxTokens": 512, | |
| "temperature": 0.4 | |
| } | |
| }, | |
| "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", | |
| "typeVersion": 1.2, | |
| "position": [112, 1184], | |
| "id": "c8b14b74-d852-4452-91d3-e9eb0dd09b1e", | |
| "name": "gpt_4.1_mini", | |
| "credentials": { | |
| "openAiApi": { | |
| "id": "wu29aQSrIIZ9BvRS", | |
| "name": "openai_primary_api_key" | |
| } | |
| } | |
| }, | |
| { | |
| "parameters": { | |
| "message": "={{ $json.text }}\n", | |
| "waitUserReply": false, | |
| "options": { | |
| "memoryConnection": true | |
| } | |
| }, | |
| "type": "@n8n/n8n-nodes-langchain.chat", | |
| "typeVersion": 1, | |
| "position": [1568, 1056], | |
| "id": "268279a9-5f55-4737-a24e-5786bca7f3bd", | |
| "name": "respond_to_chat", | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "model": { | |
| "__rl": true, | |
| "value": "gpt-4.1", | |
| "mode": "list", | |
| "cachedResultName": "gpt-4.1" | |
| }, | |
| "options": { | |
| "maxTokens": 512, | |
| "temperature": 0.3 | |
| } | |
| }, | |
| "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", | |
| "typeVersion": 1.2, | |
| "position": [240, 1184], | |
| "id": "6d4b1c1b-6629-4e06-8b19-c20a10925e97", | |
| "name": "gpt_4.1_full", | |
| "credentials": { | |
| "openAiApi": { | |
| "id": "wu29aQSrIIZ9BvRS", | |
| "name": "openai_primary_api_key" | |
| } | |
| } | |
| }, | |
| { | |
| "parameters": { | |
| "workflowId": { | |
| "__rl": true, | |
| "value": "wRCvCmRGcILIoLjy", | |
| "mode": "list", | |
| "cachedResultName": "Underfoot — wf_error_notifications" | |
| }, | |
| "workflowInputs": { | |
| "mappingMode": "defineBelow", | |
| "value": { | |
| "json": "={{ $input.query }}", | |
| "callingFlow": "={{ `$$json.callingWorkflow.name: $execution.id` }}" | |
| }, | |
| "matchingColumns": [], | |
| "schema": [ | |
| { | |
| "id": "json", | |
| "displayName": "json", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "object" | |
| }, | |
| { | |
| "id": "callingFlow", | |
| "displayName": "callingFlow", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string" | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": true | |
| }, | |
| "options": { | |
| "waitForSubWorkflow": false | |
| } | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflow", | |
| "typeVersion": 1.2, | |
| "position": [1632, 864], | |
| "id": "59262f79-432b-403d-b51a-3265e55118f0", | |
| "name": "call_discord_error_notifier", | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "public": true, | |
| "initialMessages": "Welcome to Underfoot 🪨 Where are you headed and what do you hope to uncover there? The stones will tell us exactly where to go.", | |
| "options": { | |
| "inputPlaceholder": "I'd love to find the oldest grave that exists in Salem.", | |
| "subtitle": "Uncover hidden gems with the legendary Stonewalker", | |
| "title": "Underfoot", | |
| "responseMode": "responseNodes" | |
| } | |
| }, | |
| "type": "@n8n/n8n-nodes-langchain.chatTrigger", | |
| "typeVersion": 1.3, | |
| "position": [-336, 960], | |
| "id": "a982f942-cc47-466f-9a89-c710ed0244d6", | |
| "name": "hosted_chat_trigger", | |
| "webhookId": "d92bc454-8f78-4471-ae25-ffa0c9bb87b3", | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "description": "Use this tool to search Google for web pages, places, or events matching the user’s query. Provide only when the user requests information that can be found through a general web search (news, local businesses, things to do, etc.). Do not use for specialized databases or tasks requiring structured/official data.", | |
| "workflowId": { | |
| "__rl": true, | |
| "value": "So4ty17033VQwdOO", | |
| "mode": "list", | |
| "cachedResultName": "Underfoot — wf_serp_search_tool" | |
| }, | |
| "workflowInputs": { | |
| "mappingMode": "defineBelow", | |
| "value": { | |
| "intent": "={{ $fromAI('intent', `the thing or place the user wants info about`, 'string') }}", | |
| "location": "={{ $fromAI('location', `the city, state, and country to look for events in`, 'string') }}" | |
| }, | |
| "matchingColumns": [], | |
| "schema": [ | |
| { | |
| "id": "intent", | |
| "displayName": "intent", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string" | |
| }, | |
| { | |
| "id": "location", | |
| "displayName": "location", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string" | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": false | |
| } | |
| }, | |
| "type": "@n8n/n8n-nodes-langchain.toolWorkflow", | |
| "typeVersion": 2.2, | |
| "position": [496, 1184], | |
| "id": "32721a92-725d-4fb7-be5e-7af958305e87", | |
| "name": "call_google_serp" | |
| }, | |
| { | |
| "parameters": { | |
| "httpMethod": "POST", | |
| "path": "af58e54e-336c-4a32-bda0-430b6e447076", | |
| "responseMode": "responseNode", | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.webhook", | |
| "typeVersion": 2.1, | |
| "position": [-336, 528], | |
| "id": "ffbfbbc4-048f-45af-8db6-39891d4cb84a", | |
| "name": "webhook_trigger", | |
| "webhookId": "af58e54e-336c-4a32-bda0-430b6e447076", | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "respondWith": "json", | |
| "responseBody": "={{ $json.response }}", | |
| "options": { | |
| "responseCode": 200 | |
| } | |
| }, | |
| "type": "n8n-nodes-base.respondToWebhook", | |
| "typeVersion": 1.4, | |
| "position": [-112, 304], | |
| "id": "b21695e4-2b41-44c9-9ae3-7f819bbab2e1", | |
| "name": "respond_to_webhook" | |
| }, | |
| { | |
| "parameters": {}, | |
| "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow", | |
| "typeVersion": 1.3, | |
| "position": [368, 1184], | |
| "id": "4cba12d8-ccd9-4c83-9850-34bc6dc71c2a", | |
| "name": "agent_memory" | |
| }, | |
| { | |
| "parameters": { | |
| "jsCode": "// Code (Run Once for All Items)\n// Pretty-print normalized agent output into clean Markdown for the chat UI,\n// even when `places` is empty or the message still contains an embedded JSON blob.\n//\n// Expected input per item (from normalizer):\n// { message, intent, location, places, intermediateSteps? }\n// Output per item: { text: \"<markdown>\" }\n\nconst items = $input.all();\n\n// ---------- helpers ----------\nfunction extractFirstJsonBlock(text = \"\") {\n const s = String(text);\n const objStart = s.indexOf(\"{\");\n if (objStart === -1) return null;\n // find the last } and try to cut there (we're not parsing here—just removing blob from prose)\n const objEnd = s.lastIndexOf(\"}\");\n if (objEnd > objStart) return s.slice(objStart, objEnd + 1);\n return null;\n}\n\nfunction stripEmbeddedJson(text = \"\") {\n const block = extractFirstJsonBlock(text);\n if (!block) return text?.trim() ?? \"\";\n const start = text.indexOf(block);\n if (start === -1) return text?.trim() ?? \"\";\n const before = text.slice(0, start).trimEnd();\n const after = text.slice(start + block.length).trimStart();\n return (before || after || text).trim();\n}\n\nfunction fmtAddress(p) {\n const addr = [p.address, [p.city, p.state].filter(Boolean).join(\", \"), p.country]\n .filter(Boolean)\n .join(\", \");\n return addr || null;\n}\n\nfunction renderStars(score) {\n if (typeof score !== \"number\" || !isFinite(score)) return null;\n const five = Math.round(score * 5 * 10) / 10; // 0-5, 1 decimal\n const raw = Math.round(score * 100) / 100; // 0-1, 2 decimals\n return `⭐ ${five}/5 (Stonewalker ${raw})`;\n}\n\nfunction fmtPlace(p) {\n const name = p.url ? `[${p.name}](${p.url})` : `**${p.name}**`;\n const bits = [];\n\n if (p.description) bits.push(p.description);\n\n const addr = fmtAddress(p);\n if (addr) bits.push(addr);\n\n const stars = renderStars(p.stonewalker_stars ?? p.confidence);\n if (stars) bits.push(stars);\n\n if (Array.isArray(p.tags) && p.tags.length) bits.push(p.tags.map(t => `\\`${t}\\``).join(\" \"));\n\n return `- ${name}${bits.length ? \" — \" + bits.join(\" · \") : \"\"}`;\n}\n\nfunction makeTitle(intent, location) {\n const i = intent ? intent.charAt(0).toUpperCase() + intent.slice(1) : null;\n if (i && location) return `### ${i} in ${location}`;\n if (location) return `### Results for ${location}`;\n if (i) return `### ${i}`;\n return `### Result`;\n}\n\n// ---------- main ----------\nconst out = items.map((item) => {\n const src = item.json ?? item;\n\n const message = src.output.response;\n const intent = src.intent ?? src.user_intent ?? null;\n const location = src.location ?? src.user_location ?? null;\n const places = Array.isArray(src.output.places) ? src.output.places : [];\n\n let md = `${makeTitle(intent, location)}\\n\\n`;\n\n if (message) md += `${message}\\n\\n`;\n\n if (intent || location) {\n md += `**Intent:** ${intent ?? \"—\"} \\n**Location:** ${location ?? \"—\"}\\n\\n`;\n }\n\n if (places.length) {\n md += places.map(fmtPlace).join(\"\\n\");\n } else {\n md += `_No specific places were returned by the tools this round. Adjust the intent (e.g., “coffee shops” vs “coffee”), narrow or broaden the location, or run the search again to fetch venue details._`;\n }\n\n return { text: md };\n});\n\nreturn out;\n" | |
| }, | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [1344, 864], | |
| "id": "d95e7934-0947-4909-ab08-41922a2eaf61", | |
| "name": "pretty_print_results", | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "workflowId": { | |
| "__rl": true, | |
| "value": "IAKagbbjRUADr5n4", | |
| "mode": "list", | |
| "cachedResultName": "Underfoot — wf_update_all_caches" | |
| }, | |
| "workflowInputs": { | |
| "mappingMode": "defineBelow", | |
| "value": { | |
| "intent": "={{ $json.user_intent }}", | |
| "location": "={{ $json.user_location }}" | |
| }, | |
| "matchingColumns": [], | |
| "schema": [ | |
| { | |
| "id": "intent", | |
| "displayName": "intent", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string" | |
| }, | |
| { | |
| "id": "location", | |
| "displayName": "location", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string" | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": true | |
| }, | |
| "options": { | |
| "waitForSubWorkflow": false | |
| } | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflow", | |
| "typeVersion": 1.2, | |
| "position": [1344, 1104], | |
| "id": "6eb208f6-b242-4611-ad1b-070d56d8268d", | |
| "name": "send_off_whispers_in_the_ether", | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "jsonSchemaExample": "{\n \"user_intent\": \"quiet, beach-like spots to sit by the water\",\n \"user_location\": \"Tallapoosa, GA\",\n \"response\": \"Tallapoosa isn’t coastal, but you’ve got mellow shorelines within a day-use drive. Try Yellowjacket Beach on West Point Lake for a true sand-under-toes vibe, or Lake Harding’s small sandy pull-offs for a quieter read-by-the-water afternoon. Pack snacks, bug spray, and cash for day-use where posted.\",\n \"places\": [\n {\n \"name\": \"Yellowjacket Beach, West Point Lake\",\n \"description\": \"Managed day-use area with a sandy swim beach, restrooms, and picnic tables on a large reservoir.\",\n \"address\": \"Yellowjacket Creek Recreation Area, LaGrange, GA 30240\",\n \"city\": \"LaGrange\",\n \"state\": \"GA\",\n \"country\": \"US\",\n \"coordinates\": { \"lat\": 32.935, \"lng\": -85.129 },\n \"url\": \"https://example.com/west-point-lake-yellowjacket\",\n \"tags\": [\"lake\", \"swim beach\", \"picnic\", \"family-friendly\"],\n \"stonewalker_stars\": 4.4,\n \"confidence\": 0.87,\n \"source\": \"google_places\",\n \"source_id\": \"west_point_yellowjacket_beach\",\n \"cached_at\": \"2025-09-01T01:10:00Z\"\n },\n {\n \"name\": \"Lake Harding (select sandy pull-offs)\",\n \"description\": \"Reservoir on the Chattahoochee with small informal sandy edges; good for low-key shoreline lounging.\",\n \"address\": \"Lake Harding, GA/AL border\",\n \"city\": \"Salem\",\n \"state\": \"AL\",\n \"country\": \"US\",\n \"coordinates\": { \"lat\": 32.682, \"lng\": -85.125 },\n \"url\": \"https://example.com/lake-harding-shore\",\n \"tags\": [\"lake\", \"quiet\", \"shore access\"],\n \"stonewalker_stars\": 3.9,\n \"confidence\": 0.78,\n \"source\": \"google_maps\",\n \"source_id\": \"lake_harding_misc_shore\",\n \"cached_at\": \"2025-09-01T01:10:00Z\"\n }\n ]\n}", | |
| "autoFix": true, | |
| "customizeRetryPrompt": true, | |
| "prompt": "Instructions:\n--------------\n{instructions}\n--------------\nCompletion:\n--------------\n{completion}\n--------------\n\nAbove, the Completion did not satisfy the constraints given in the Instructions.\nError:\n--------------\n{error}\n--------------\n\nPlease try again. Please only respond with an answer that satisfies the constraints laid out in the Instructions:\nYou are an OCD organizer and love making sure everything in exactly where it's supposed to be. Nothing extra, nothing missing is your motto — no more, no less, but just right.\n\nYour goal is to format the input given to you identical to the example json format. Substituting empty arrays and objects in place of nulls. Use your best judgement to determine which field goes where and above all — return the format exactly as it is defined without modifications, parsing, encoding, or any other formatting. Simple data in, simple data out. Everyone is happy." | |
| }, | |
| "type": "@n8n/n8n-nodes-langchain.outputParserStructured", | |
| "typeVersion": 1.3, | |
| "position": [752, 1184], | |
| "id": "5b6d9803-5ef4-43e7-9545-b8450464f072", | |
| "name": "structured_optput" | |
| }, | |
| { | |
| "parameters": { | |
| "rules": { | |
| "values": [ | |
| { | |
| "conditions": { | |
| "options": { | |
| "caseSensitive": true, | |
| "leftValue": "", | |
| "typeValidation": "strict", | |
| "version": 2 | |
| }, | |
| "conditions": [ | |
| { | |
| "leftValue": "={{ $('set_self_hosted_chat').item }}", | |
| "rightValue": "self-hosted-checkmark-devtools", | |
| "operator": { | |
| "type": "object", | |
| "operation": "exists", | |
| "singleValue": true | |
| }, | |
| "id": "01c7d074-ad29-431e-adcd-e40fda30c58c" | |
| } | |
| ], | |
| "combinator": "and" | |
| }, | |
| "renameOutput": true, | |
| "outputKey": "checkmark-devtools" | |
| }, | |
| { | |
| "conditions": { | |
| "options": { | |
| "caseSensitive": true, | |
| "leftValue": "", | |
| "typeValidation": "strict", | |
| "version": 2 | |
| }, | |
| "conditions": [ | |
| { | |
| "id": "1e07c96a-a9f1-48bb-bea7-eef79095943e", | |
| "leftValue": "={{ $('set_src_sys_id_hosted_chat').item }}", | |
| "rightValue": "n8n-cloud-hosted", | |
| "operator": { | |
| "type": "object", | |
| "operation": "exists", | |
| "singleValue": true | |
| } | |
| } | |
| ], | |
| "combinator": "and" | |
| }, | |
| "renameOutput": true, | |
| "outputKey": "n8n-cloud-hosted" | |
| } | |
| ] | |
| }, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.switch", | |
| "typeVersion": 3.2, | |
| "position": [-336, 304], | |
| "id": "c4106aa4-4209-4004-9edd-5631fd3ea342", | |
| "name": "determine_return_method" | |
| }, | |
| { | |
| "parameters": { | |
| "assignments": { | |
| "assignments": [ | |
| { | |
| "id": "d31c30b9-76e3-4934-a4a2-a23c9faa8207", | |
| "name": "source_system", | |
| "value": "={{ \"self-hosted-checkmark-devtools\" }}", | |
| "type": "string" | |
| }, | |
| { | |
| "id": "f4e003de-9151-4158-9103-6c790a69db9b", | |
| "name": "sessionId", | |
| "value": "={{ $json.sessionId || uuid() }}", | |
| "type": "string" | |
| } | |
| ] | |
| }, | |
| "includeOtherFields": true, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.set", | |
| "typeVersion": 3.4, | |
| "position": [-112, 528], | |
| "id": "d606ed97-54dd-4aff-a2cd-8de35ebba64f", | |
| "name": "set_self_hosted_chat", | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "mode": "raw", | |
| "jsonOutput": "{\n \"src_system_id\": \"n8n-cloud-hosted\"\n}", | |
| "includeOtherFields": true, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.set", | |
| "typeVersion": 3.4, | |
| "position": [-112, 960], | |
| "id": "445d1bbb-6322-4c15-b87e-d176ab188e92", | |
| "name": "set_src_sys_id_hosted_chat", | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "conditions": { | |
| "options": { | |
| "caseSensitive": false, | |
| "leftValue": "", | |
| "typeValidation": "loose", | |
| "version": 2 | |
| }, | |
| "conditions": [ | |
| { | |
| "id": "b6a4f573-16d8-4a53-bc72-854789db1c94", | |
| "leftValue": "={{ $json.output.places }}", | |
| "rightValue": "", | |
| "operator": { | |
| "type": "number", | |
| "operation": "exists", | |
| "singleValue": true | |
| } | |
| }, | |
| { | |
| "id": "6e190d89-578e-424c-a222-bdec64903ca7", | |
| "leftValue": "={{ $json.output.places.length }}", | |
| "rightValue": 0, | |
| "operator": { | |
| "type": "number", | |
| "operation": "gt" | |
| } | |
| } | |
| ], | |
| "combinator": "and" | |
| }, | |
| "looseTypeValidation": true, | |
| "options": { | |
| "ignoreCase": true | |
| } | |
| }, | |
| "type": "n8n-nodes-base.if", | |
| "typeVersion": 2.2, | |
| "position": [1120, 960], | |
| "id": "53e6ae1b-3fa2-4921-9240-5c313a46d309", | |
| "name": "check_if_found", | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "model": { | |
| "__rl": true, | |
| "mode": "list", | |
| "value": "gpt-4.1-mini" | |
| }, | |
| "options": { | |
| "maxTokens": 256, | |
| "responseFormat": "json_object", | |
| "temperature": 0.1 | |
| } | |
| }, | |
| "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", | |
| "typeVersion": 1.2, | |
| "position": [832, 1392], | |
| "id": "3ed8935b-fb41-4839-95a7-6387d03f3cb8", | |
| "name": "gpt-4.1-mini", | |
| "credentials": { | |
| "openAiApi": { | |
| "id": "wu29aQSrIIZ9BvRS", | |
| "name": "openai_primary_api_key" | |
| } | |
| } | |
| }, | |
| { | |
| "parameters": { | |
| "useCustomSchema": true, | |
| "schema": "underfoot", | |
| "operation": "getAll", | |
| "tableId": "search_cache", | |
| "limit": 10, | |
| "filters": { | |
| "conditions": [ | |
| { | |
| "keyName": "title", | |
| "condition": "ilike", | |
| "keyValue": "=*{{ $fromAI('intent') }}*" | |
| }, | |
| { | |
| "keyName": "description", | |
| "condition": "ilike", | |
| "keyValue": "=*{{ $fromAI('intent') }}*" | |
| }, | |
| { | |
| "keyName": "user_intent", | |
| "condition": "ilike", | |
| "keyValue": "=*{{ $fromAI('intent') }}*" | |
| }, | |
| { | |
| "keyName": "user_location", | |
| "condition": "ilike", | |
| "keyValue": "=*{{ $fromAI('location') }}*" | |
| } | |
| ] | |
| } | |
| }, | |
| "type": "n8n-nodes-base.supabaseTool", | |
| "typeVersion": 1, | |
| "position": [624, 1184], | |
| "id": "0c92657d-0b31-41d7-a2fc-1cd8e09af8ac", | |
| "name": "search_cache", | |
| "credentials": { | |
| "supabaseApi": { | |
| "id": "dDCJFuMX57sfkIIp", | |
| "name": "supabase_secret_key" | |
| } | |
| } | |
| } | |
| ], | |
| "pinData": {}, | |
| "connections": { | |
| "chat_agent": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "check_if_found", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "gpt_4.1_mini": { | |
| "ai_languageModel": [ | |
| [ | |
| { | |
| "node": "chat_agent", | |
| "type": "ai_languageModel", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "gpt_4.1_full": { | |
| "ai_languageModel": [ | |
| [ | |
| { | |
| "node": "chat_agent", | |
| "type": "ai_languageModel", | |
| "index": 1 | |
| } | |
| ] | |
| ] | |
| }, | |
| "respond_to_chat": { | |
| "main": [[]] | |
| }, | |
| "hosted_chat_trigger": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "set_src_sys_id_hosted_chat", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "call_google_serp": { | |
| "ai_tool": [ | |
| [ | |
| { | |
| "node": "chat_agent", | |
| "type": "ai_tool", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "webhook_trigger": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "set_self_hosted_chat", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "agent_memory": { | |
| "ai_memory": [ | |
| [ | |
| { | |
| "node": "chat_agent", | |
| "type": "ai_memory", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "pretty_print_results": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "respond_to_chat", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_discord_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "send_off_whispers_in_the_ether": { | |
| "main": [ | |
| [], | |
| [ | |
| { | |
| "node": "call_discord_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "structured_optput": { | |
| "ai_outputParser": [ | |
| [ | |
| { | |
| "node": "chat_agent", | |
| "type": "ai_outputParser", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "determine_return_method": { | |
| "main": [ | |
| [], | |
| [ | |
| { | |
| "node": "respond_to_webhook", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "set_self_hosted_chat": { | |
| "main": [[]] | |
| }, | |
| "set_src_sys_id_hosted_chat": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "chat_agent", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "check_if_found": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "send_off_whispers_in_the_ether", | |
| "type": "main", | |
| "index": 0 | |
| }, | |
| { | |
| "node": "pretty_print_results", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "pretty_print_results", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "gpt-4.1-mini": { | |
| "ai_languageModel": [ | |
| [ | |
| { | |
| "node": "structured_optput", | |
| "type": "ai_languageModel", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "search_cache": { | |
| "ai_tool": [ | |
| [ | |
| { | |
| "node": "chat_agent", | |
| "type": "ai_tool", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| } | |
| }, | |
| "active": false, | |
| "settings": { | |
| "executionOrder": "v1", | |
| "callerPolicy": "workflowsFromSameOwner", | |
| "errorWorkflow": "g0RA1ILyuSMHbt6q" | |
| }, | |
| "versionId": "9100d552-745d-4e38-99a6-dfdd2d8a159c", | |
| "meta": { | |
| "templateCredsSetupCompleted": true, | |
| "instanceId": "ca38a51753a4eaa26e21803b676daa6c69ce9542656c83ba5959cacf3a748990" | |
| }, | |
| "id": "Yogrk8C57eV2wMpk", | |
| "tags": [ | |
| { | |
| "createdAt": "2025-08-29T04:02:35.168Z", | |
| "updatedAt": "2025-08-29T04:02:35.168Z", | |
| "id": "4g2r1ALvxirC7hxK", | |
| "name": "n8nbrightdatachallenge" | |
| }, | |
| { | |
| "createdAt": "2025-08-29T04:02:50.893Z", | |
| "updatedAt": "2025-08-29T04:02:50.893Z", | |
| "id": "Mx3hjhTFNPLHvKnk", | |
| "name": "devchallenge" | |
| } | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "wf_scraper_facebook_events", | |
| "nodes": [ | |
| { | |
| "parameters": { | |
| "jsCode": "// n8n Code node — Run Once for All Items\n// Takes an array of inputs like:\n// [\n// { \"intent\": \"music\", \"Location\": \"Atlanta, GA\" },\n// { \"intent\": \"outdoors\", \"Location\": \"Chicago, IL\" }\n// ]\n// Returns an array of objects with Facebook event search URLs\n\nconst results = $input.all().map(item => {\n const escapedIntent = encodeURIComponent(`${item.json.intent}`.replace(/\\s+/g, ' '));\n const escapedLocation = encodeURIComponent(`${item.json.location}`.replace(/\\s+/g, ' '));\n return {\n url: `https://www.facebook.com/events/search/?q=${escapedIntent}&location=${escapedLocation}`\n };\n});\n\nreturn {\n \"input\": results,\n \"custom_output_fields\": [\"url\",\"main_image\",\"event_date\",\"title\",\"people_responded\",\"location\",\"description\",\"longitude\",\"latitude\",\"event_timezone\"]\n};" | |
| }, | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [-192, 304], | |
| "id": "073c05ed-e8dc-4ed8-9ba1-9cba1d89ee5e", | |
| "name": "generate_search_urls", | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "operation": "appendOrUpdate", | |
| "documentId": { | |
| "__rl": true, | |
| "value": "1-Mmc5mC8CWyocEdRLPffSgJeA-ve4nkX2ol76f8o-ZQ", | |
| "mode": "list", | |
| "cachedResultName": "underfoot_facebook_events_cache", | |
| "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-Mmc5mC8CWyocEdRLPffSgJeA-ve4nkX2ol76f8o-ZQ/edit?usp=drivesdk" | |
| }, | |
| "sheetName": { | |
| "__rl": true, | |
| "value": "gid=0", | |
| "mode": "list", | |
| "cachedResultName": "Sheet1", | |
| "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-Mmc5mC8CWyocEdRLPffSgJeA-ve4nkX2ol76f8o-ZQ/edit#gid=0" | |
| }, | |
| "columns": { | |
| "mappingMode": "autoMapInputData", | |
| "value": { | |
| "url": "=" | |
| }, | |
| "matchingColumns": ["url"], | |
| "schema": [ | |
| { | |
| "id": "url", | |
| "displayName": "url", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "title", | |
| "displayName": "title", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "description", | |
| "displayName": "description", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "main_image", | |
| "displayName": "main_image", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "event_date", | |
| "displayName": "event_date", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "location", | |
| "displayName": "location", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "longitude", | |
| "displayName": "longitude", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "latitude", | |
| "displayName": "latitude", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "people_responded", | |
| "displayName": "people_responded", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "event_timezone", | |
| "displayName": "event_timezone", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "cached_at", | |
| "displayName": "cached_at", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "user_intent", | |
| "displayName": "user_intent", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "user_location", | |
| "displayName": "user_location", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": false | |
| }, | |
| "options": { | |
| "handlingExtraData": "insertInNewColumn" | |
| } | |
| }, | |
| "type": "n8n-nodes-base.googleSheets", | |
| "typeVersion": 4.7, | |
| "position": [1152, 656], | |
| "id": "803759e3-816d-4009-8667-536213eae5f7", | |
| "name": "update_fb_events_cache", | |
| "credentials": { | |
| "googleSheetsOAuth2Api": { | |
| "id": "LlE3kL9RL6ALt0Sy", | |
| "name": "Google Sheets Primary" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "workflowId": { | |
| "__rl": true, | |
| "value": "wRCvCmRGcILIoLjy", | |
| "mode": "list", | |
| "cachedResultName": "Underfoot — wf_error_notifications" | |
| }, | |
| "workflowInputs": { | |
| "mappingMode": "defineBelow", | |
| "value": { | |
| "json": "={{ $json }}", | |
| "callingFlow": "={{ $workflow.name }}" | |
| }, | |
| "matchingColumns": ["json"], | |
| "schema": [ | |
| { | |
| "id": "json", | |
| "displayName": "json", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "object", | |
| "removed": false | |
| }, | |
| { | |
| "id": "callingFlow", | |
| "displayName": "callingFlow", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string", | |
| "removed": false | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": true | |
| }, | |
| "mode": "each", | |
| "options": { | |
| "waitForSubWorkflow": false | |
| } | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflow", | |
| "typeVersion": 1.2, | |
| "position": [1376, 224], | |
| "id": "d6e3d5e0-8486-43ed-b2cc-97897c0ee518", | |
| "name": "call_error_notifications", | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "inputSource": "jsonExample", | |
| "jsonExample": "{\n \"intent\": \"an interest\",\n \"location\": \"a place to look for events\"\n}" | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflowTrigger", | |
| "typeVersion": 1.1, | |
| "position": [-416, 304], | |
| "id": "0cc09d5b-1f04-4f61-9e57-04e50b61c1b9", | |
| "name": "workflow_trigger", | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "method": "POST", | |
| "url": "=https://api.brightdata.com/datasets/v3/trigger", | |
| "authentication": "predefinedCredentialType", | |
| "nodeCredentialType": "brightdataApi", | |
| "sendQuery": true, | |
| "queryParameters": { | |
| "parameters": [ | |
| { | |
| "name": "=dataset_id", | |
| "value": "={{$vars.FACEBOOK_EVENTS_DATASET_ID}}" | |
| }, | |
| { | |
| "name": "include_errors", | |
| "value": "true" | |
| }, | |
| { | |
| "name": "type", | |
| "value": "discover_new" | |
| }, | |
| { | |
| "name": "discover_by", | |
| "value": "url" | |
| }, | |
| { | |
| "name": "limit_per_input", | |
| "value": "20" | |
| } | |
| ] | |
| }, | |
| "sendHeaders": true, | |
| "headerParameters": { | |
| "parameters": [ | |
| { | |
| "name": "Content-Type", | |
| "value": "application/json" | |
| } | |
| ] | |
| }, | |
| "sendBody": true, | |
| "specifyBody": "json", | |
| "jsonBody": "={{ $json }}", | |
| "options": { | |
| "timeout": 12000 | |
| } | |
| }, | |
| "type": "n8n-nodes-base.httpRequest", | |
| "typeVersion": 4.2, | |
| "position": [32, 368], | |
| "id": "5b943e47-6bed-4d78-bb5d-bae168500df8", | |
| "name": "trigger_fb_events_collection", | |
| "alwaysOutputData": false, | |
| "credentials": { | |
| "httpBearerAuth": { | |
| "id": "olJ8EsONUeKfeUR4", | |
| "name": "BrightData Bearer Auth" | |
| }, | |
| "brightdataApi": { | |
| "id": "mPoDSDYWpK4VnaD4", | |
| "name": "brightdata_primary_api_token" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "resource": "webScrapper", | |
| "operation": "downloadSnapshot", | |
| "snapshot_id": "={{ $json.snapshot_id }}", | |
| "requestOptions": { | |
| "timeout": 12000 | |
| } | |
| }, | |
| "type": "@brightdata/n8n-nodes-brightdata.brightData", | |
| "typeVersion": 1, | |
| "position": [704, 560], | |
| "id": "2bf5da51-fcdb-456e-878d-f0d811c6b1e0", | |
| "name": "download_snapshot", | |
| "credentials": { | |
| "brightdataApi": { | |
| "id": "mPoDSDYWpK4VnaD4", | |
| "name": "brightdata_primary_api_token" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "resource": "webScrapper", | |
| "operation": "monitorProgressSnapshot", | |
| "snapshot_id": "={{ $json.snapshot_id }}", | |
| "requestOptions": {} | |
| }, | |
| "type": "@brightdata/n8n-nodes-brightdata.brightData", | |
| "typeVersion": 1, | |
| "position": [256, 544], | |
| "id": "f69b8f12-cfc3-4f13-a5ad-23ee740a6a0b", | |
| "name": "check_snapshot_status", | |
| "credentials": { | |
| "brightdataApi": { | |
| "id": "mPoDSDYWpK4VnaD4", | |
| "name": "brightdata_primary_api_token" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "jsCode": "// Facebook Events → Cache rows (key = url)\n// Input: either one item whose .json is an array (your sample), or one item per event.\n// Output: one row per event with fields ready for your cache/table.\n\nconst events = $input.all();\nconst userInput = $(\"workflow_trigger\").first().json;\n\nconst toNum = (v) => {\n if (v === null || v === undefined || v === \"\") return null;\n const n = Number(v);\n return Number.isFinite(n) ? n : null;\n};\n\nconst nowISO = new Date().toISOString();\n\nconst rows = events\n .map(e => {\n const event = e.json;\n\n return {\n url: event.url,\n title: event.title,\n description: event.description.text,\n main_image: event.main_image,\n event_date: event.event_date,\n location: event.location?.address,\n latitude: event.latitude,\n longitude: event.longitude,\n people_respondeed: event.people_responded,\n event_timezone: event.event_timezone,\n cached_at: nowISO,\n user_intent: userInput.intent,\n user_location: userInput.location\n };\n });\n\nreturn rows.map(r => ({ json: r }));" | |
| }, | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [928, 656], | |
| "id": "6eadca21-71b7-4178-b446-2cad5ec3f2dd", | |
| "name": "normalize_fb_events", | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "rules": { | |
| "values": [ | |
| { | |
| "conditions": { | |
| "options": { | |
| "caseSensitive": true, | |
| "leftValue": "", | |
| "typeValidation": "strict", | |
| "version": 2 | |
| }, | |
| "conditions": [ | |
| { | |
| "leftValue": "={{ $json.status }}", | |
| "rightValue": "running", | |
| "operator": { | |
| "type": "string", | |
| "operation": "equals" | |
| }, | |
| "id": "5a6f220a-b5c7-483b-8f3d-35ec72223efd" | |
| } | |
| ], | |
| "combinator": "and" | |
| }, | |
| "renameOutput": true, | |
| "outputKey": "running" | |
| }, | |
| { | |
| "conditions": { | |
| "options": { | |
| "caseSensitive": true, | |
| "leftValue": "", | |
| "typeValidation": "strict", | |
| "version": 2 | |
| }, | |
| "conditions": [ | |
| { | |
| "id": "f4e2e7a4-9694-43cb-b743-f28c07ffbd91", | |
| "leftValue": "={{ $json.status }}", | |
| "rightValue": "ready", | |
| "operator": { | |
| "type": "string", | |
| "operation": "equals", | |
| "name": "filter.operator.equals" | |
| } | |
| } | |
| ], | |
| "combinator": "and" | |
| }, | |
| "renameOutput": true, | |
| "outputKey": "ready" | |
| }, | |
| { | |
| "conditions": { | |
| "options": { | |
| "caseSensitive": true, | |
| "leftValue": "", | |
| "typeValidation": "strict", | |
| "version": 2 | |
| }, | |
| "conditions": [ | |
| { | |
| "id": "d3467027-28f4-41e3-8048-3e47a0ac632b", | |
| "leftValue": "={{ $json.status }}", | |
| "rightValue": "failed", | |
| "operator": { | |
| "type": "string", | |
| "operation": "equals", | |
| "name": "filter.operator.equals" | |
| } | |
| } | |
| ], | |
| "combinator": "and" | |
| }, | |
| "renameOutput": true, | |
| "outputKey": "failed" | |
| } | |
| ] | |
| }, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.switch", | |
| "typeVersion": 3.2, | |
| "position": [480, 528], | |
| "id": "9e901a94-8d56-4e14-ac80-1d873a4243e7", | |
| "name": "check_current_status" | |
| }, | |
| { | |
| "parameters": { | |
| "amount": 25 | |
| }, | |
| "type": "n8n-nodes-base.wait", | |
| "typeVersion": 1.1, | |
| "position": [704, 784], | |
| "id": "b441b49d-8581-454d-a201-29aded13e2c0", | |
| "name": "wait_25s", | |
| "webhookId": "aef63d49-95af-48d9-8815-27aed75d72d4", | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "method": "POST", | |
| "url": "https://uqvwaiexsgprdbdecoxx.supabase.co/functions/v1/merge-cache", | |
| "authentication": "genericCredentialType", | |
| "genericAuthType": "httpBearerAuth", | |
| "sendBody": true, | |
| "specifyBody": "json", | |
| "jsonBody": "={\n \"title\": {{ $json.title }},\n \"description\": {{ $json.description }},\n \"source_type\": {{ $workflow.name }},\n \"external_id\": {{ $execution.id }},\n \"url\": {{ $json.url }},\n \"image_url\": {{ $json.image_url }},\n \"data\": {{ $json }}\n}", | |
| "options": { | |
| "timeout": 120000 | |
| } | |
| }, | |
| "type": "n8n-nodes-base.httpRequest", | |
| "typeVersion": 4.2, | |
| "position": [1152, 848], | |
| "id": "a421f436-1f5d-4d15-a8c9-5d761ee78754", | |
| "name": "update_cache_supabase", | |
| "credentials": { | |
| "httpBearerAuth": { | |
| "id": "qmIqRK2uopxYSrFs", | |
| "name": "SUPABASE_BEARER_AUTH" | |
| } | |
| } | |
| } | |
| ], | |
| "pinData": {}, | |
| "connections": { | |
| "generate_search_urls": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "trigger_fb_events_collection", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifications", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "update_fb_events_cache": { | |
| "main": [ | |
| [], | |
| [ | |
| { | |
| "node": "call_error_notifications", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "workflow_trigger": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "generate_search_urls", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "trigger_fb_events_collection": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "check_snapshot_status", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifications", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "download_snapshot": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "normalize_fb_events", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifications", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "check_snapshot_status": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "check_current_status", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifications", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "normalize_fb_events": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "update_fb_events_cache", | |
| "type": "main", | |
| "index": 0 | |
| }, | |
| { | |
| "node": "update_cache_supabase", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifications", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "check_current_status": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "wait_25s", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "download_snapshot", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifications", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "wait_25s": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "check_snapshot_status", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| } | |
| }, | |
| "active": false, | |
| "settings": { | |
| "executionOrder": "v1", | |
| "callerPolicy": "workflowsFromSameOwner", | |
| "errorWorkflow": "g0RA1ILyuSMHbt6q" | |
| }, | |
| "versionId": "f802630a-9e11-4a4d-b30c-83c9395dcd8e", | |
| "meta": { | |
| "templateCredsSetupCompleted": true, | |
| "instanceId": "ca38a51753a4eaa26e21803b676daa6c69ce9542656c83ba5959cacf3a748990" | |
| }, | |
| "id": "r9kt1jHGjG91iPuQ", | |
| "tags": [] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "wf_scrape_reddit_posts", | |
| "nodes": [ | |
| { | |
| "parameters": { | |
| "resource": "webScrapper", | |
| "operation": "monitorProgressSnapshot", | |
| "snapshot_id": "={{ $json.snapshot_id }}", | |
| "requestOptions": {} | |
| }, | |
| "type": "@brightdata/n8n-nodes-brightdata.brightData", | |
| "typeVersion": 1, | |
| "position": [912, -640], | |
| "id": "db71b778-2dc9-4fc8-996d-f8407e9af347", | |
| "name": "check_batch", | |
| "credentials": { | |
| "brightdataApi": { | |
| "id": "mPoDSDYWpK4VnaD4", | |
| "name": "brightdata_primary_api_token" | |
| } | |
| }, | |
| "onError": "continueErrorOutput", | |
| "notes": "This should be removed after verification that the notify as expected" | |
| }, | |
| { | |
| "parameters": { | |
| "amount": 15 | |
| }, | |
| "type": "n8n-nodes-base.wait", | |
| "typeVersion": 1.1, | |
| "position": [1360, -384], | |
| "id": "f65f8120-1e2e-499a-8442-f1347c6e2992", | |
| "name": "delay_15_sec", | |
| "webhookId": "a672b548-a303-4cf3-8bef-33fcdff2f0a4" | |
| }, | |
| { | |
| "parameters": { | |
| "resource": "webScrapper", | |
| "operation": "downloadSnapshot", | |
| "batch_size": "=1000", | |
| "snapshot_id": "={{ $json.snapshot_id }}", | |
| "requestOptions": {} | |
| }, | |
| "type": "@brightdata/n8n-nodes-brightdata.brightData", | |
| "typeVersion": 1, | |
| "position": [1584, -544], | |
| "id": "e12e6d44-8a89-4cef-b11e-922faa770097", | |
| "name": "download_snapshots", | |
| "credentials": { | |
| "brightdataApi": { | |
| "id": "mPoDSDYWpK4VnaD4", | |
| "name": "brightdata_primary_api_token" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "operation": "appendOrUpdate", | |
| "documentId": { | |
| "__rl": true, | |
| "value": "1Ij6RVvdsF2yUdJfz2_p9gAwRz2LmySUWxlxajQyY-XE", | |
| "mode": "list", | |
| "cachedResultName": "underfoot_subreddit_cache", | |
| "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Ij6RVvdsF2yUdJfz2_p9gAwRz2LmySUWxlxajQyY-XE/edit?usp=drivesdk" | |
| }, | |
| "sheetName": { | |
| "__rl": true, | |
| "value": "gid=0", | |
| "mode": "list", | |
| "cachedResultName": "Shee1", | |
| "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Ij6RVvdsF2yUdJfz2_p9gAwRz2LmySUWxlxajQyY-XE/edit#gid=0" | |
| }, | |
| "columns": { | |
| "mappingMode": "autoMapInputData", | |
| "value": {}, | |
| "matchingColumns": ["url"], | |
| "schema": [ | |
| { | |
| "id": "url", | |
| "displayName": "url", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "title", | |
| "displayName": "title", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "description", | |
| "displayName": "description", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "num_comments", | |
| "displayName": "num_comments", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "date_posted", | |
| "displayName": "date_posted", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "num_upvotes", | |
| "displayName": "num_upvotes", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "photos", | |
| "displayName": "photos", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "embedded_links", | |
| "displayName": "embedded_links", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| }, | |
| { | |
| "id": "created_at_iso", | |
| "displayName": "created_at_iso", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "type": "string", | |
| "canBeUsedToMatch": true, | |
| "removed": false | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": false | |
| }, | |
| "options": { | |
| "useAppend": true | |
| } | |
| }, | |
| "type": "n8n-nodes-base.googleSheets", | |
| "typeVersion": 4.7, | |
| "position": [2032, -448], | |
| "id": "8da4cadd-3d1d-4af3-a7bf-95cb54c28821", | |
| "name": "update_cache", | |
| "credentials": { | |
| "googleSheetsOAuth2Api": { | |
| "id": "LlE3kL9RL6ALt0Sy", | |
| "name": "Google Sheets Primary" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "conditions": { | |
| "options": { | |
| "caseSensitive": true, | |
| "leftValue": "", | |
| "typeValidation": "strict", | |
| "version": 2 | |
| }, | |
| "conditions": [ | |
| { | |
| "id": "ddc2c830-0d39-4d4c-94cc-9c647a42686c", | |
| "leftValue": "={{ $json.records }}", | |
| "rightValue": 0, | |
| "operator": { | |
| "type": "number", | |
| "operation": "gt" | |
| } | |
| } | |
| ], | |
| "combinator": "and" | |
| }, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.if", | |
| "typeVersion": 2.2, | |
| "position": [1360, -608], | |
| "id": "60052ae1-0314-4a67-a378-53f7f81e5e72", | |
| "name": "has_records" | |
| }, | |
| { | |
| "parameters": { | |
| "workflowId": { | |
| "__rl": true, | |
| "value": "wRCvCmRGcILIoLjy", | |
| "mode": "list", | |
| "cachedResultName": "Underfoot — wf_error_notifications" | |
| }, | |
| "workflowInputs": { | |
| "mappingMode": "defineBelow", | |
| "value": { | |
| "json": "={{ $json }}", | |
| "callingWorkflow": "={{ $workflow }}" | |
| }, | |
| "matchingColumns": ["json"], | |
| "schema": [ | |
| { | |
| "id": "json", | |
| "displayName": "json", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "object", | |
| "removed": false | |
| }, | |
| { | |
| "id": "callingWorkflow", | |
| "displayName": "callingWorkflow", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "object", | |
| "removed": false | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": true | |
| }, | |
| "mode": "each", | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflow", | |
| "typeVersion": 1.2, | |
| "position": [2256, -944], | |
| "id": "173c7e6e-a1a5-4ef5-8213-0488bba0dae2", | |
| "name": "call_error_notifier", | |
| "retryOnFail": false, | |
| "waitBetweenTries": 1500, | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "inputSource": "jsonExample", | |
| "jsonExample": "{\n \"intent\": \"an interest\",\n \"location\": \"a place to look for events\"\n}" | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflowTrigger", | |
| "typeVersion": 1.1, | |
| "position": [16, -880], | |
| "id": "55f19696-4b73-49df-afef-8bd049d307d8", | |
| "name": "workflow_trigger", | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "jsCode": "// n8n Code node (Run Once for Each Item)\n// Input: { user_intent, user_location }\n// Output: array of keyword objects ready for Bright Data\n\nconst intent = ($input.first().json.intent || \"\").trim();\nconst loc = ($input.first().json.location || \"\").trim();\n\nconst parts = loc.split(\",\").map(s => s.trim()).filter(Boolean);\nconst city = parts[0] || \"\";\nconst state = parts[1] || \"\";\nconst country = parts[2] || \"\";\n\nconst combos = [];\nif (city) combos.push(`${intent} ${city}`);\nif (city && state) combos.push(`${intent} ${city} ${state}`);\nif (city && state && country) combos.push(`${intent} ${city} ${state} ${country}`);\n\nconst uniq = arr => [...new Set(arr.filter(Boolean))];\n\nconst results = [];\nfor (const kw of uniq(combos)) {\n results.push({ keyword: kw, date: \"Past month\", num_of_posts: 10, sort_by: \"Top\" });\n results.push({ keyword: kw, date: \"Past week\", num_of_posts: 10, sort_by: \"Hot\" });\n}\n\nreturn results;" | |
| }, | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [240, -880], | |
| "id": "cba6ae5d-22b4-435f-bd67-13a69f7eb097", | |
| "name": "generate_discovery_urls", | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "method": "POST", | |
| "url": "https://api.brightdata.com/datasets/v3/trigger", | |
| "authentication": "genericCredentialType", | |
| "genericAuthType": "httpBearerAuth", | |
| "sendQuery": true, | |
| "queryParameters": { | |
| "parameters": [ | |
| { | |
| "name": "dataset_id", | |
| "value": "={{ $vars.REDDIT_POSTS_BY_KEYWORD_DATASET_ID }}" | |
| }, | |
| { | |
| "name": "include_errors", | |
| "value": "true" | |
| }, | |
| { | |
| "name": "type", | |
| "value": "discover_new" | |
| }, | |
| { | |
| "name": "discover_by", | |
| "value": "keyword" | |
| }, | |
| { | |
| "name": "notify", | |
| "value": "={{ $vars.DISCORD_BRIGHTDATA_NOTIFY_WEBHOOK }}" | |
| } | |
| ] | |
| }, | |
| "sendHeaders": true, | |
| "headerParameters": { | |
| "parameters": [ | |
| { | |
| "name": "Content-Type", | |
| "value": "application/json" | |
| } | |
| ] | |
| }, | |
| "sendBody": true, | |
| "specifyBody": "json", | |
| "jsonBody": "={{ $json }}", | |
| "options": { | |
| "timeout": 12000 | |
| } | |
| }, | |
| "type": "n8n-nodes-base.httpRequest", | |
| "typeVersion": 4.2, | |
| "position": [688, -800], | |
| "id": "e4e73758-8fac-47c7-b4cf-bff70ca28ddb", | |
| "name": "discover_reddit_posts_by_keyword", | |
| "executeOnce": false, | |
| "credentials": { | |
| "httpBearerAuth": { | |
| "id": "olJ8EsONUeKfeUR4", | |
| "name": "BrightData Bearer Auth" | |
| } | |
| }, | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.removeDuplicates", | |
| "typeVersion": 2, | |
| "position": [464, -800], | |
| "id": "bd40e50c-3ffe-40c7-a6db-3b4d81d3f5ca", | |
| "name": "remove_duplicates", | |
| "onError": "continueRegularOutput", | |
| "notes": "This is really extra because I wanted to see how it works. In reality, I have complete control already over what's inserted into the list. There would be no reason to do it after the fact." | |
| }, | |
| { | |
| "parameters": { | |
| "rules": { | |
| "values": [ | |
| { | |
| "conditions": { | |
| "options": { | |
| "caseSensitive": true, | |
| "leftValue": "", | |
| "typeValidation": "strict", | |
| "version": 2 | |
| }, | |
| "conditions": [ | |
| { | |
| "leftValue": "={{ $json.status }}", | |
| "rightValue": "ready", | |
| "operator": { | |
| "type": "string", | |
| "operation": "equals" | |
| }, | |
| "id": "154ccc45-69c3-407a-a5fb-7c41edba0d42" | |
| } | |
| ], | |
| "combinator": "and" | |
| }, | |
| "renameOutput": true, | |
| "outputKey": "ready" | |
| }, | |
| { | |
| "conditions": { | |
| "options": { | |
| "caseSensitive": true, | |
| "leftValue": "", | |
| "typeValidation": "strict", | |
| "version": 2 | |
| }, | |
| "conditions": [ | |
| { | |
| "id": "548371ce-824a-410d-b1e9-ac53cfa2226c", | |
| "leftValue": "={{ $json.status }}", | |
| "rightValue": "running", | |
| "operator": { | |
| "type": "string", | |
| "operation": "equals", | |
| "name": "filter.operator.equals" | |
| } | |
| } | |
| ], | |
| "combinator": "and" | |
| }, | |
| "renameOutput": true, | |
| "outputKey": "running" | |
| }, | |
| { | |
| "conditions": { | |
| "options": { | |
| "caseSensitive": true, | |
| "leftValue": "", | |
| "typeValidation": "strict", | |
| "version": 2 | |
| }, | |
| "conditions": [ | |
| { | |
| "id": "d80a18d1-3ee4-4e49-a06f-bffbf9f38ae5", | |
| "leftValue": "={{ $json.status }}", | |
| "rightValue": "failed", | |
| "operator": { | |
| "type": "string", | |
| "operation": "equals", | |
| "name": "filter.operator.equals" | |
| } | |
| } | |
| ], | |
| "combinator": "and" | |
| }, | |
| "renameOutput": true, | |
| "outputKey": "failed" | |
| } | |
| ] | |
| }, | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.switch", | |
| "typeVersion": 3.2, | |
| "position": [1136, -656], | |
| "id": "0c5f643f-67cc-48ba-838e-30dc30f88ae8", | |
| "name": "check_status", | |
| "onError": "continueRegularOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "jsCode": "// Run Once for All Items\nconst toISO = (v) => { try { return v ? new Date(v).toISOString() : null; } catch { return null; } };\nconst num = (v) => {\n if (v === null || v === undefined || v === '') return null;\n const n = Number(v);\n return Number.isFinite(n) ? n : null;\n};\n\nconst user_intent = $('workflow_trigger').first().json.intent ?? null;\nconst user_location = $('workflow_trigger').first().json?.location ?? null;\n\n\nreturn $input.all().map(({ json: p }) => {\n const embedded_links = Array.isArray(p.related_posts)\n ? p.related_posts.map(r => ({ url: r?.url ?? null, title: r?.title ?? null }))\n : null;\n\n return {\n url: p.url ?? null,\n title: p.title ?? null,\n description: p.description ?? null,\n num_comments: num(p.num_comments),\n date_posted: toISO(p.date_posted),\n num_upvotes: num(p.num_upvotes),\n photos: Array.isArray(p.photos) ? p.photos : (p.photos ? [p.photos] : null),\n embedded_links,\n created_at_iso: toISO(p.timestamp) || toISO(p.date_posted),\n user_intent,\n user_location\n };\n});" | |
| }, | |
| "type": "n8n-nodes-base.code", | |
| "typeVersion": 2, | |
| "position": [1808, -448], | |
| "id": "80157cbd-2d68-4bdc-93d3-8d61edf37ce8", | |
| "name": "normalize", | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "method": "POST", | |
| "url": "https://uqvwaiexsgprdbdecoxx.supabase.co/functions/v1/merge-cache", | |
| "authentication": "genericCredentialType", | |
| "genericAuthType": "httpBearerAuth", | |
| "sendBody": true, | |
| "specifyBody": "json", | |
| "jsonBody": "={\n \"title\": {{ $json.title }},\n \"description\": {{ $json.description }},\n \"source_type\": {{ $workflow.name }},\n \"external_id\": {{ $execution.id }},\n \"url\": {{ $json.url }},\n \"image_url\": {{ $json.image_url }},\n \"data\": {{ $json }}\n}", | |
| "options": { | |
| "timeout": 120000 | |
| } | |
| }, | |
| "type": "n8n-nodes-base.httpRequest", | |
| "typeVersion": 4.2, | |
| "position": [2032, -256], | |
| "id": "56806290-271d-46bb-b196-5a6cb6e886c3", | |
| "name": "update_cache_supabase", | |
| "credentials": { | |
| "httpBearerAuth": { | |
| "id": "qmIqRK2uopxYSrFs", | |
| "name": "SUPABASE_BEARER_AUTH" | |
| } | |
| } | |
| } | |
| ], | |
| "pinData": {}, | |
| "connections": { | |
| "check_batch": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "check_status", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "delay_15_sec": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "check_batch", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "download_snapshots": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "normalize", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "has_records": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "download_snapshots", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "update_cache": { | |
| "main": [ | |
| [], | |
| [ | |
| { | |
| "node": "call_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "workflow_trigger": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "generate_discovery_urls", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "generate_discovery_urls": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "remove_duplicates", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "discover_reddit_posts_by_keyword": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "check_batch", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "remove_duplicates": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "discover_reddit_posts_by_keyword", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "check_status": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "has_records", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "delay_15_sec", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "normalize": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "update_cache", | |
| "type": "main", | |
| "index": 0 | |
| }, | |
| { | |
| "node": "update_cache_supabase", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ], | |
| [ | |
| { | |
| "node": "call_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| } | |
| }, | |
| "active": false, | |
| "settings": { | |
| "executionOrder": "v1", | |
| "callerPolicy": "workflowsFromSameOwner", | |
| "errorWorkflow": "g0RA1ILyuSMHbt6q" | |
| }, | |
| "versionId": "5f018cce-2920-473e-bbef-cb5694c17d2b", | |
| "meta": { | |
| "templateCredsSetupCompleted": true, | |
| "instanceId": "ca38a51753a4eaa26e21803b676daa6c69ce9542656c83ba5959cacf3a748990" | |
| }, | |
| "id": "ctgclUQYW6ckB5ou", | |
| "tags": [] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "wf_update_all_caches", | |
| "nodes": [ | |
| { | |
| "parameters": { | |
| "workflowInputs": { | |
| "values": [ | |
| { | |
| "name": "intent" | |
| }, | |
| { | |
| "name": "location" | |
| } | |
| ] | |
| } | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflowTrigger", | |
| "typeVersion": 1.1, | |
| "position": [-224, 272], | |
| "id": "316407d6-9b63-46da-9227-5a8cd51c5291", | |
| "name": "workflow_trigger" | |
| }, | |
| { | |
| "parameters": { | |
| "workflowId": { | |
| "__rl": true, | |
| "value": "wRCvCmRGcILIoLjy", | |
| "mode": "list", | |
| "cachedResultName": "Underfoot — wf_error_notifications" | |
| }, | |
| "workflowInputs": { | |
| "mappingMode": "defineBelow", | |
| "value": { | |
| "json": "={{ $json }}", | |
| "callingWorkflow": "={{ $workflow }}" | |
| }, | |
| "matchingColumns": [], | |
| "schema": [ | |
| { | |
| "id": "json", | |
| "displayName": "json", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "object" | |
| }, | |
| { | |
| "id": "callingWorkflow", | |
| "displayName": "callingWorkflow", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string", | |
| "removed": false | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": true | |
| }, | |
| "mode": "each", | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflow", | |
| "typeVersion": 1.2, | |
| "position": [224, 272], | |
| "id": "4251e922-ba15-4617-8928-d2df35cfbf0c", | |
| "name": "discord_error_notifier" | |
| }, | |
| { | |
| "parameters": { | |
| "workflowId": { | |
| "__rl": true, | |
| "value": "ctgclUQYW6ckB5ou", | |
| "mode": "list", | |
| "cachedResultName": "Underfoot — wf_scrape_reddit_posts" | |
| }, | |
| "workflowInputs": { | |
| "mappingMode": "defineBelow", | |
| "value": { | |
| "location": "={{ $json.location }}", | |
| "intent": "={{ $json.intent }}" | |
| }, | |
| "matchingColumns": [], | |
| "schema": [ | |
| { | |
| "id": "intent", | |
| "displayName": "intent", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string" | |
| }, | |
| { | |
| "id": "location", | |
| "displayName": "location", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string" | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": true | |
| }, | |
| "mode": "each", | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflow", | |
| "typeVersion": 1.2, | |
| "position": [0, 368], | |
| "id": "2f27f7b2-c0cd-462b-84fd-79acee563187", | |
| "name": "scrape_reddit_posts", | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "workflowId": { | |
| "__rl": true, | |
| "value": "r9kt1jHGjG91iPuQ", | |
| "mode": "list", | |
| "cachedResultName": "Underfoot — wf_scraper_facebook_events" | |
| }, | |
| "workflowInputs": { | |
| "mappingMode": "defineBelow", | |
| "value": { | |
| "intent": "={{ $json.intent }}", | |
| "location": "={{ $json.location }}" | |
| }, | |
| "matchingColumns": [], | |
| "schema": [ | |
| { | |
| "id": "intent", | |
| "displayName": "intent", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string" | |
| }, | |
| { | |
| "id": "location", | |
| "displayName": "location", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string" | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": true | |
| }, | |
| "mode": "each", | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflow", | |
| "typeVersion": 1.2, | |
| "position": [0, 176], | |
| "id": "a389bac8-7260-4704-a4ba-03f19f70e2ae", | |
| "name": "scrape_facebook_events", | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "workflowId": { | |
| "__rl": true, | |
| "value": "TjJFvBLuhBlEO3c8", | |
| "mode": "list", | |
| "cachedResultName": "Underfoot — wf_maps_serp_backup_data" | |
| }, | |
| "workflowInputs": { | |
| "mappingMode": "defineBelow", | |
| "value": { | |
| "intent": "={{ $json.intent }}", | |
| "location": "={{ $json.location }}" | |
| }, | |
| "matchingColumns": [], | |
| "schema": [ | |
| { | |
| "id": "intent", | |
| "displayName": "intent", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string" | |
| }, | |
| { | |
| "id": "location", | |
| "displayName": "location", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string" | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": true | |
| }, | |
| "mode": "each", | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflow", | |
| "typeVersion": 1.2, | |
| "position": [0, -16], | |
| "id": "276c0b07-c84b-4a43-acf8-6f5ec43515b6", | |
| "name": "run_maps_backup_data", | |
| "onError": "continueErrorOutput" | |
| }, | |
| { | |
| "parameters": { | |
| "workflowId": { | |
| "__rl": true, | |
| "value": "So4ty17033VQwdOO", | |
| "mode": "list", | |
| "cachedResultName": "Underfoot — wf_serp_search_tool" | |
| }, | |
| "workflowInputs": { | |
| "mappingMode": "defineBelow", | |
| "value": { | |
| "intent": "={{ $json.intent }}", | |
| "location": "={{ $json.location }}" | |
| }, | |
| "matchingColumns": [], | |
| "schema": [ | |
| { | |
| "id": "intent", | |
| "displayName": "intent", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string" | |
| }, | |
| { | |
| "id": "location", | |
| "displayName": "location", | |
| "required": false, | |
| "defaultMatch": false, | |
| "display": true, | |
| "canBeUsedToMatch": true, | |
| "type": "string" | |
| } | |
| ], | |
| "attemptToConvertTypes": false, | |
| "convertFieldsToString": true | |
| }, | |
| "mode": "each", | |
| "options": {} | |
| }, | |
| "type": "n8n-nodes-base.executeWorkflow", | |
| "typeVersion": 1.2, | |
| "position": [0, 560], | |
| "id": "5312bc34-6549-4469-94cc-b825df570dc0", | |
| "name": "run_google_serp_search", | |
| "onError": "continueErrorOutput" | |
| } | |
| ], | |
| "pinData": {}, | |
| "connections": { | |
| "workflow_trigger": { | |
| "main": [ | |
| [ | |
| { | |
| "node": "run_maps_backup_data", | |
| "type": "main", | |
| "index": 0 | |
| }, | |
| { | |
| "node": "scrape_facebook_events", | |
| "type": "main", | |
| "index": 0 | |
| }, | |
| { | |
| "node": "scrape_reddit_posts", | |
| "type": "main", | |
| "index": 0 | |
| }, | |
| { | |
| "node": "run_google_serp_search", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "scrape_reddit_posts": { | |
| "main": [ | |
| [], | |
| [ | |
| { | |
| "node": "discord_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "scrape_facebook_events": { | |
| "main": [ | |
| [], | |
| [ | |
| { | |
| "node": "discord_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "run_maps_backup_data": { | |
| "main": [ | |
| [], | |
| [ | |
| { | |
| "node": "discord_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| }, | |
| "run_google_serp_search": { | |
| "main": [ | |
| [], | |
| [ | |
| { | |
| "node": "discord_error_notifier", | |
| "type": "main", | |
| "index": 0 | |
| } | |
| ] | |
| ] | |
| } | |
| }, | |
| "active": false, | |
| "settings": { | |
| "executionOrder": "v1", | |
| "callerPolicy": "workflowsFromSameOwner", | |
| "errorWorkflow": "g0RA1ILyuSMHbt6q" | |
| }, | |
| "versionId": "99681223-1f03-49eb-b4da-08fa090a0e3f", | |
| "meta": { | |
| "templateCredsSetupCompleted": true, | |
| "instanceId": "ca38a51753a4eaa26e21803b676daa6c69ce9542656c83ba5959cacf3a748990" | |
| }, | |
| "id": "IAKagbbjRUADr5n4", | |
| "tags": [] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment