Extraer contactos de empresas locales con Google Sheets, SerpAPI, Apify y GPT-4o
Este es unLead Generation, AI Summarizationflujo de automatización del dominio deautomatización que contiene 18 nodos.Utiliza principalmente nodos como Code, Filter, Summarize, SerpApi, HttpRequest. Extraer contactos de empresas locales usando Google Sheets, SerpAPI, Apify y GPT-4o
- •Pueden requerirse credenciales de autenticación para la API de destino
- •Credenciales de API de Google Sheets
- •Clave de API de OpenAI
Nodos utilizados (18)
Categoría
{
"meta": {
"instanceId": "efb474b59b0341d7791932605bd9ff04a6c7ed9941fdd53dc4a2e4b99a6f9439"
},
"nodes": [
{
"id": "0377cde7-39de-4a27-9f57-2ac62ecae89c",
"name": "Al hacer clic en 'Ejecutar flujo de trabajo'",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-2520,
400
],
"parameters": {},
"typeVersion": 1
},
{
"id": "ac9d9f3b-db6c-4491-a1ce-ebfff9652ea3",
"name": "Modelo de chat OpenAI",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-700,
780
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "ghJTvay8CvwXDsXz",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "a05ec908-7476-49ec-9b32-3355cec11dce",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
-580,
780
],
"parameters": {
"jsonSchemaExample": "{\n\t\"email\": \"emailaddress\"\n}"
},
"typeVersion": 1.2
},
{
"id": "f6bbdf13-a0c1-4d9e-9157-c1a55a06e16b",
"name": "Recorrer elementos",
"type": "n8n-nodes-base.splitInBatches",
"onError": "continueRegularOutput",
"position": [
-1160,
260
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "2003373e-cb00-4c74-b0bf-7ddb677ddb96",
"name": "Execute Workflow",
"type": "n8n-nodes-base.executeWorkflow",
"onError": "continueRegularOutput",
"position": [
-640,
200
],
"parameters": {
"options": {
"waitForSubWorkflow": false
},
"workflowId": {
"__rl": true,
"mode": "list",
"value": "SDMXLfMXOQ6TDfKq",
"cachedResultName": "Email Extraction Project"
},
"workflowInputs": {
"value": {},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": true
}
},
"typeVersion": 1.2
},
{
"id": "17c39dd5-5c44-4b95-ad50-591224d5517c",
"name": "Extract Search Terms",
"type": "n8n-nodes-base.googleSheets",
"position": [
-2300,
400
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nwgaTyp239ErzFS0IaDnJca-6LkIqvshmiHHs5bX77o/edit#gid=0",
"cachedResultName": "Searches"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1nwgaTyp239ErzFS0IaDnJca-6LkIqvshmiHHs5bX77o",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nwgaTyp239ErzFS0IaDnJca-6LkIqvshmiHHs5bX77o/edit?usp=drivesdk",
"cachedResultName": "Searches&Results"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "WsgMg14OYooIdvn7",
"name": "Google Sheets account"
}
},
"executeOnce": true,
"typeVersion": 4.6
},
{
"id": "4222fa4d-d0e0-4e91-90bf-dead1424ed2c",
"name": "Keep Unprocessed Rows",
"type": "n8n-nodes-base.filter",
"position": [
-2080,
400
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "c295c5ea-1ec4-4c9f-bf12-f4c23c60543f",
"operator": {
"type": "string",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json.Complete }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "4de8ae34-2fea-4169-ada9-80cad9ee2e87",
"name": "Filtrar to first row",
"type": "n8n-nodes-base.code",
"position": [
-1860,
400
],
"parameters": {
"jsCode": "return [items[0]];"
},
"typeVersion": 2
},
{
"id": "af38c3a1-1414-4dcf-932d-e4a1db059a91",
"name": "Mark Row as Completed",
"type": "n8n-nodes-base.googleSheets",
"position": [
-1640,
300
],
"parameters": {
"columns": {
"value": {
"Search": "={{ $json.Search }}",
"Complete": "Yes"
},
"schema": [
{
"id": "Search",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Search",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Area",
"type": "string",
"display": true,
"required": false,
"displayName": "Area",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Area Name",
"type": "string",
"display": true,
"required": false,
"displayName": "Area Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Complete",
"type": "string",
"display": true,
"required": false,
"displayName": "Complete",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"Search"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nwgaTyp239ErzFS0IaDnJca-6LkIqvshmiHHs5bX77o/edit#gid=0",
"cachedResultName": "Searches"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1nwgaTyp239ErzFS0IaDnJca-6LkIqvshmiHHs5bX77o",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nwgaTyp239ErzFS0IaDnJca-6LkIqvshmiHHs5bX77o/edit?usp=drivesdk",
"cachedResultName": "Searches&Results"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "WsgMg14OYooIdvn7",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "e0087b09-f158-4ce8-bb74-ce45b5d9dfa6",
"name": "Search Google Maps",
"type": "n8n-nodes-serpapi.serpApi",
"onError": "continueRegularOutput",
"position": [
-1640,
500
],
"parameters": {
"q": "={{ $json.Search }}",
"ll": "={{ $json.Area }}",
"operation": "google_maps",
"requestOptions": {},
"additionalFields": {}
},
"credentials": {
"serpApi": {
"id": "u6KGxSGJbtJANls7",
"name": "SerpAPI account"
}
},
"typeVersion": 1
},
{
"id": "fc558eef-8092-42f7-ab51-41c7002cb50b",
"name": "Format output as table",
"type": "n8n-nodes-base.code",
"onError": "continueRegularOutput",
"position": [
-1420,
500
],
"parameters": {
"jsCode": "const results = items[0].json.local_results || [];\n\nconst parsedResults = results.map(entry => {\n // Remove \"/url?q=\" if present in the website\n let cleanWebsite = entry.website || null;\n if (cleanWebsite && cleanWebsite.startsWith(\"/url?q=\")) {\n cleanWebsite = cleanWebsite.replace(\"/url?q=\", \"\").split(\"&\")[0];\n }\n\n return {\n title: entry.title || null,\n website: cleanWebsite,\n address: entry.address || null,\n phone: entry.phone || null,\n };\n});\n\n// Return each result as a separate item\nreturn parsedResults.map(result => ({ json: result }));\n"
},
"typeVersion": 2
},
{
"id": "2d3fa5a3-f338-4eb8-be95-c915ce3f189a",
"name": "Save Correo electrónicos to Sheet",
"type": "n8n-nodes-base.googleSheets",
"onError": "continueRegularOutput",
"position": [
-940,
0
],
"parameters": {
"columns": {
"value": {
"Area": "={{ $('Extract Search Terms').item.json.Area }}",
"phone": "={{ $('Format output as table').item.json.phone }}",
"title": "={{ $('Format output as table').item.json.title }}",
"Search": "={{ $('Extract Search Terms').item.json.Search }}",
"address": "={{ $('Format output as table').item.json.address }}",
"website": "={{ $('Format output as table').item.json.website }}",
"Search Name": "={{ $('Extract Search Terms').item.json['Area Name'] }}",
"email (Manual Entry)": "={{ $json.output.email }}"
},
"schema": [
{
"id": "title",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "website",
"type": "string",
"display": true,
"required": false,
"displayName": "website",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "address",
"type": "string",
"display": true,
"required": false,
"displayName": "address",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "phone",
"type": "string",
"display": true,
"required": false,
"displayName": "phone",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Search",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Search",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Search Name",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Search Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Area",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Area",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "email (Manual Entry)",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "email (Manual Entry)",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"title"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1470668196,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nwgaTyp239ErzFS0IaDnJca-6LkIqvshmiHHs5bX77o/edit#gid=1470668196",
"cachedResultName": "Results"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1nwgaTyp239ErzFS0IaDnJca-6LkIqvshmiHHs5bX77o",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nwgaTyp239ErzFS0IaDnJca-6LkIqvshmiHHs5bX77o/edit?usp=drivesdk",
"cachedResultName": "Searches&Results"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "WsgMg14OYooIdvn7",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "947fad74-dd81-4993-947e-a1e9264c1056",
"name": "Scrape Web Page",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-940,
400
],
"parameters": {
"url": "=https://api.apify.com/v2/acts/6sigmag~fast-website-content-crawler/run-sync-get-dataset-items\n",
"method": "POST",
"options": {},
"jsonBody": "={\n \"startUrls\": [\n \"{{ $json.website }}\"\n ]\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth"
},
"credentials": {
"httpQueryAuth": {
"id": "yLUXsSPePLOGnHmf",
"name": "Query Auth account"
}
},
"typeVersion": 4.2,
"alwaysOutputData": true
},
{
"id": "eaab5179-b3a7-4c94-b2b9-0db29509573f",
"name": "Extract Email - Agente IA",
"type": "@n8n/n8n-nodes-langchain.agent",
"onError": "continueRegularOutput",
"position": [
-720,
560
],
"parameters": {
"text": "={{ $json.text }}",
"options": {
"systemMessage": "extract the email address from the text. if there is no email address, output null. "
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2,
"alwaysOutputData": true
},
{
"id": "4a9f36d4-fd8b-409c-a1af-6be7248ed671",
"name": "Reduce to 1 row",
"type": "n8n-nodes-base.summarize",
"onError": "continueRegularOutput",
"position": [
-940,
200
],
"parameters": {
"options": {},
"fieldsToSummarize": {
"values": [
{
"field": "title"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "0fa2b9a4-3e33-4830-86a5-5466f4b9ab1a",
"name": "Nota adhesiva",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2380,
20
],
"parameters": {
"width": 980,
"content": "## n8n Workflow: Local Business Contact Finder with Email Extraction\n\n** Feel free to contact me if you need help implementing (rbreen@ynteractive.com) **"
},
"typeVersion": 1
},
{
"id": "72de7718-1d85-47e4-ab0b-5e559323f6d4",
"name": "Nota adhesiva1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3360,
-80
],
"parameters": {
"width": 780,
"height": 1160,
"content": "## How to Implement This n8n Workflow\n\nFollow the steps below to get this business contact finder workflow up and running in your own environment:\n\n1. Copy the Google Sheet\nMake a copy of the search input/output sheet to your own Google Drive:\n\n👉 https://docs.google.com/spreadsheets/d/1QgcVMlXRlM_5ZFFUHr6bVK-93Tzia9XseTX03ZYnowI/edit?usp=sharing\n\n2. Update the Google Sheets Nodes\nOpen the workflow in n8n.\n\nUpdate both Google Sheets nodes (\"Extract Search Terms\" and \"Save Emails to Sheet\") to point to your copied sheet.\n\nMake sure you select the correct sheet/tab names (Searches and Results).\n\nConnect your Google account using the Google Sheets OAuth2 credentials.\n\n3. Get a SerpAPI Key\nSign up for a free trial at 👉 https://serpapi.com/dashboard\n\nCopy your API key.\n\nIn the “Search Google Maps” node:\n\nClick on credentials.\n\nAdd a new SerpAPI credential using your API key.\n\n4. Set Up Apify Crawler\nSign up for an Apify account at 👉 https://apify.com\n\nGo to the Actors section and add Fast Website Content Crawler to your account.\n\nIn the \"Scrape Web Page\" HTTP node:\n\nUnder credentials, enter your Apify API key as a query string parameter (token=YOUR_API_KEY).\n\n5. Add Your OpenAI Key\nSign up at 👉 https://platform.openai.com/\n\nGo to API keys and copy your secret key.\n\nIn the \"AI Agent\" (LangChain node) and \"OpenAI Chat Model\" nodes:\n\nAdd your OpenAI key under the OpenAI credentials section.\n\n✅ Once Complete:\nClick \"Execute Workflow\" to run the automation. The script will:\n\nRead a search + location from your Google Sheet.\n\nPull business info from Google Maps.\n\nVisit each business’s website and scrape its content.\n\nUse AI to extract an email address if available.\n\nSave the full results into the \"Results\" tab and mark the search as complete.\n\n"
},
"typeVersion": 1
},
{
"id": "c771ab3b-428f-46d9-be51-6ea1ce2a3659",
"name": "Nota adhesiva2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2560,
-80
],
"parameters": {
"color": 5,
"width": 2260,
"height": 1160,
"content": ""
},
"typeVersion": 1
}
],
"pinData": {
"When clicking ‘Execute workflow’": [
{}
]
},
"connections": {
"Loop Over Items": {
"main": [
[
{
"node": "Save Emails to Sheet",
"type": "main",
"index": 0
},
{
"node": "4a9f36d4-fd8b-409c-a1af-6be7248ed671",
"type": "main",
"index": 0
}
],
[
{
"node": "947fad74-dd81-4993-947e-a1e9264c1056",
"type": "main",
"index": 0
}
]
]
},
"4a9f36d4-fd8b-409c-a1af-6be7248ed671": {
"main": [
[
{
"node": "2003373e-cb00-4c74-b0bf-7ddb677ddb96",
"type": "main",
"index": 0
}
]
]
},
"947fad74-dd81-4993-947e-a1e9264c1056": {
"main": [
[
{
"node": "Extract Email - AI Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Extract Email - AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"e0087b09-f158-4ce8-bb74-ce45b5d9dfa6": {
"main": [
[
{
"node": "fc558eef-8092-42f7-ab51-41c7002cb50b",
"type": "main",
"index": 0
}
]
]
},
"Filter to first row": {
"main": [
[
{
"node": "af38c3a1-1414-4dcf-932d-e4a1db059a91",
"type": "main",
"index": 0
},
{
"node": "e0087b09-f158-4ce8-bb74-ce45b5d9dfa6",
"type": "main",
"index": 0
}
]
]
},
"17c39dd5-5c44-4b95-ad50-591224d5517c": {
"main": [
[
{
"node": "4222fa4d-d0e0-4e91-90bf-dead1424ed2c",
"type": "main",
"index": 0
}
]
]
},
"4222fa4d-d0e0-4e91-90bf-dead1424ed2c": {
"main": [
[
{
"node": "Filter to first row",
"type": "main",
"index": 0
}
]
]
},
"fc558eef-8092-42f7-ab51-41c7002cb50b": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Extract Email - AI Agent": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"a05ec908-7476-49ec-9b32-3355cec11dce": {
"ai_outputParser": [
[
{
"node": "Extract Email - AI Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"0377cde7-39de-4a27-9f57-2ac62ecae89c": {
"main": [
[
{
"node": "17c39dd5-5c44-4b95-ad50-591224d5517c",
"type": "main",
"index": 0
}
]
]
}
}
}¿Cómo usar este flujo de trabajo?
Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.
¿En qué escenarios es adecuado este flujo de trabajo?
Avanzado - Generación de leads, Resumen de IA
¿Es de pago?
Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.
Flujos de trabajo relacionados recomendados
Robert Breen
@rbreenProfessional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.
Compartir este flujo de trabajo