Generación de leads de Instagram
Este es unLead Generation, AI RAGflujo de automatización del dominio deautomatización que contiene 18 nodos.Utiliza principalmente nodos como Set, Code, Postgres, SplitOut, HttpRequest. Automatizar la recopilación de leads de influencers de Instagram con Apify, GPT y PostgreSQL
- •Información de conexión de la base de datos PostgreSQL
- •Pueden requerirse credenciales de autenticación para la API de destino
- •Clave de API de OpenAI
Nodos utilizados (18)
Categoría
{
"id": "geEVmbXLYDSA8UGM",
"meta": {
"instanceId": "5ca157bf036415a321c9d29eeb986017053989bb83b5b61701e90fe3987ac8b7",
"templateCredsSetupCompleted": true
},
"name": "Instagram Lead Generation",
"tags": [],
"nodes": [
{
"id": "5f49d3d3-5e81-4b9d-9bc4-687ee97e2e8f",
"name": "Al hacer clic en 'Probar flujo de trabajo'",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-256,
0
],
"parameters": {},
"typeVersion": 1
},
{
"id": "9990229b-1098-4ff5-8906-c57a260f4d15",
"name": "Editar Campos",
"type": "n8n-nodes-base.set",
"position": [
-32,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "8b66c6fb-0773-4c66-b088-e35fbb27fd08",
"name": "site",
"type": "string",
"value": "instagram"
},
{
"id": "9dddc30f-b90d-4759-81be-96161bc5dd48",
"name": "field_of_interest",
"type": "string",
"value": "beauty & hair"
},
{
"id": "9fba044b-013f-4ff0-8687-6a6c8954011a",
"name": "target_country",
"type": "string",
"value": "USA"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "a40f44bc-efee-4c89-8fbc-77cd0d09ff3e",
"name": "Agente de IA",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
224,
0
],
"parameters": {
"text": "=field of interest: {{ $json.field_of_interest }}\ntarget country: {{ $json.target_country }}",
"options": {
"systemMessage": "You are an assistant designed to generate Google search queries based on user instructions. Your sole task is to create queries following a specific format like the one below:\n\nsite:instagram.com/*/ (inurl:\"/beauty\" OR inurl:\"/hair\" OR intitle:\"beauty\" OR intitle:\"hair\") (\"England\" OR \"UK\" OR \"London\" OR \"Manchester\" OR \"Birmingham\" OR \"Liverpool\" OR \"Leeds\") (\"@gmail.com\" OR \"@yahoo.com\" OR \"@hotmail.com\" OR \"@outlook.com\" OR \"@aol.com\" OR \"@icloud.com\") -inurl:\"/p/\" -inurl:\"/reel/\" -inurl:\"/tv/\"\n\nYour output must:\n\n1. Only return the Google search query, no explanation or extra text.\n\n2. Replace the niche-related keywords (e.g., \"beauty\" or \"hair\") with the field of interest specified by the user.\n\n3. Replace the location filters (e.g., \"England\", \"UK\", \"London\") with the target country provided by the user. Add cities related to the target country as well.\n\n4. Always include the email provider filters:\n(\"@gmail.com\" OR \"@yahoo.com\" OR \"@hotmail.com\" OR \"@outlook.com\" OR \"@aol.com\" OR \"@icloud.com\")\n\n5. Always exclude media content using:\n-inurl:\"/p/\" -inurl:\"/reel/\" -inurl:\"/tv/\"\n\n6. Ensure the query remains **clean, optimized, and structurally consistent** with the original format. Do **not explain** the query — return only the **raw search string**.\n"
},
"promptType": "define"
},
"typeVersion": 1.9
},
{
"id": "79b4c5f6-7fe9-46eb-932b-4d98593c2607",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
224,
208
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "dUQjRoJSrkOznqAl",
"name": "My OpenAi account "
}
},
"typeVersion": 1.2
},
{
"id": "d2eecb84-b111-401c-9fb2-91722625cb66",
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"position": [
736,
32
],
"parameters": {
"url": "https://api.apify.com/v2/acts/apify~google-search-scraper/run-sync-get-dataset-items?token=apify_api_YOUR_TOKEN_HERE",
"options": {},
"jsonBody": "={\n \"focusOnPaidAds\": false,\n \"forceExactMatch\": false,\n \"includeIcons\": false,\n \"includeUnfilteredResults\": false,\n \"maxPagesPerQuery\": 20,\n \"mobileResults\": false,\n \"queries\": \"{{ $json.escapedQuery }}\",\n \"resultsPerPage\": 100,\n \"saveHtml\": false,\n \"saveHtmlToKeyValueStore\": true\n} ",
"sendBody": true,
"specifyBody": "json"
},
"typeVersion": 4.2
},
{
"id": "ff3a6ff0-f66f-499d-b56f-2ae8f22534ba",
"name": "Código",
"type": "n8n-nodes-base.code",
"position": [
496,
0
],
"parameters": {
"jsCode": "// n8n Function node code\nconst inputQuery = $input.first().json.output;\n\n// Replace all \" with \\\"\nconst escapedQuery = inputQuery.replace(/\"/g, '\\\\\"');\n\n// Return as output\nreturn [\n {\n json: {\n escapedQuery\n }\n }\n];"
},
"typeVersion": 2
},
{
"id": "dd29f519-c629-4302-ad17-e1a5b0555e46",
"name": "Dividir",
"type": "n8n-nodes-base.splitOut",
"position": [
896,
32
],
"parameters": {
"options": {},
"fieldToSplitOut": "organicResults"
},
"typeVersion": 1
},
{
"id": "32b57f66-c3cd-4a04-a787-3f7662af13c2",
"name": "HTTP Request1",
"type": "n8n-nodes-base.httpRequest",
"position": [
1456,
80
],
"parameters": {
"url": "https://api.apify.com/v2/acts/apify~instagram-scraper/run-sync-get-dataset-items?token=apify_api_YOUR_TOKEN_HERE",
"options": {},
"jsonBody": "={\n \"addParentData\": false,\n \"directUrls\": [\n \"{{ $json.cleanedUrl }}\"\n ],\n \"enhanceUserSearchWithFacebookPage\": false,\n \"isUserReelFeedURL\": false,\n \"isUserTaggedFeedURL\": false,\n \"resultsLimit\": 2,\n \"resultsType\": \"details\",\n \"searchLimit\": 1,\n \"searchType\": \"hashtag\"\n} ",
"sendBody": true,
"specifyBody": "json"
},
"typeVersion": 4.2
},
{
"id": "6e52cddd-1cf2-433f-8f78-cd1f0f2d89ad",
"name": "Código1",
"type": "n8n-nodes-base.code",
"position": [
1312,
80
],
"parameters": {
"jsCode": "// n8n Function node code\nconst inputUrl = $input.first().json.url;\n\n// Remove trailing slash if present\nconst cleanedUrl = inputUrl.replace(/\\/$/, \"\");\n\nreturn [\n {\n json: {\n cleanedUrl\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "28aaf56d-ee27-4a81-9cd7-b0e43d13aeb9",
"name": "Extractor de Información",
"type": "@n8n/n8n-nodes-langchain.informationExtractor",
"position": [
1600,
80
],
"parameters": {
"text": "={{ $json.biography }}",
"options": {
"systemPromptTemplate": "You are an expert extraction algorithm. Extract relevant information from the given web scraped text data and present it in JSON format with the attribute Email . If email attribute is not found in the text, assign them the value \"N/A\". Always extract email address in small hand."
},
"schemaType": "manual",
"inputSchema": "{\n\t\"type\": \"array\",\n\t\"properties\": {\n\t\t\"Email\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"format\": \"email\"\n\t\t}\n\t}\n}"
},
"typeVersion": 1
},
{
"id": "f2a03fb3-9171-482e-b078-05a5dff93e6a",
"name": "OpenAI Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1600,
304
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-3.5-turbo",
"cachedResultName": "gpt-3.5-turbo"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "dUQjRoJSrkOznqAl",
"name": "My OpenAi account "
}
},
"typeVersion": 1.2
},
{
"id": "9d1fbc5b-538a-4d82-a897-00a03ce4d5cc",
"name": "Iterar sobre Elementos",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1152,
32
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "067b1f22-eb31-4573-80e1-47fac5bddb7b",
"name": "Postgres",
"type": "n8n-nodes-base.postgres",
"position": [
2032,
80
],
"parameters": {
"table": {
"__rl": true,
"mode": "list",
"value": "Instagram_Leads_Beauty&Hair",
"cachedResultName": "Instagram_Leads_Beauty&Hair"
},
"schema": {
"__rl": true,
"mode": "list",
"value": "public"
},
"columns": {
"value": {
"email": "={{ $('Filter').item.json.output[0].Email }}",
"user_name": "={{ $('HTTP Request1').item.json.username }}",
"account_link": "={{ $('HTTP Request1').item.json.inputUrl }}",
"follower_count": "={{ $('HTTP Request1').item.json.followsCount }}",
"target_country": "={{ $('Edit Fields').item.json.target_country }}",
"field_of_interest": "={{ $('Edit Fields').item.json.field_of_interest }}"
},
"schema": [
{
"id": "user_name",
"type": "string",
"display": true,
"removed": false,
"required": true,
"displayName": "user_name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "follower_count",
"type": "number",
"display": true,
"required": true,
"displayName": "follower_count",
"defaultMatch": false,
"canBeUsedToMatch": false
},
{
"id": "account_link",
"type": "string",
"display": true,
"required": false,
"displayName": "account_link",
"defaultMatch": false,
"canBeUsedToMatch": false
},
{
"id": "email",
"type": "string",
"display": true,
"required": false,
"displayName": "email",
"defaultMatch": false,
"canBeUsedToMatch": false
},
{
"id": "target_country",
"type": "string",
"display": true,
"required": false,
"displayName": "target_country",
"defaultMatch": false,
"canBeUsedToMatch": false
},
{
"id": "field_of_interest",
"type": "string",
"display": true,
"required": false,
"displayName": "field_of_interest",
"defaultMatch": false,
"canBeUsedToMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"user_name"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "upsert"
},
"credentials": {
"postgres": {
"id": "sZAvcVeX17fuVXQz",
"name": "Postgres account"
}
},
"typeVersion": 2.6
},
{
"id": "c8d53921-24d1-4f79-ab40-2f5794f0f057",
"name": "Nota Adhesiva",
"type": "n8n-nodes-base.stickyNote",
"position": [
-112,
-128
],
"parameters": {
"color": 5,
"width": 256,
"height": 304,
"content": "## Specifying Our Target Niche \n"
},
"typeVersion": 1
},
{
"id": "a466c89c-8766-4927-871c-474a67a42265",
"name": "Nota Adhesiva1",
"type": "n8n-nodes-base.stickyNote",
"position": [
176,
-128
],
"parameters": {
"width": 464,
"height": 464,
"content": "## Generating Custom Optimized Search Engine Query for finding Instagram Accounts\n"
},
"typeVersion": 1
},
{
"id": "8d2a5c18-c22b-4773-8890-12fa1e0b7913",
"name": "Nota Adhesiva2",
"type": "n8n-nodes-base.stickyNote",
"position": [
672,
-128
],
"parameters": {
"color": 3,
"width": 368,
"height": 336,
"content": "## Extracting Search Results Using Apify Api"
},
"typeVersion": 1
},
{
"id": "6d5711e0-b5d3-43ee-b1f4-b8db6c853d7d",
"name": "Nota Adhesiva3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1072,
-128
],
"parameters": {
"color": 4,
"width": 848,
"height": 560,
"content": "## Going Through Each of the Accounts & Extracting Leads From User's Bio"
},
"typeVersion": 1
},
{
"id": "0c298e44-251f-4718-9f58-ba8904cb2708",
"name": "Nota Adhesiva4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1952,
-32
],
"parameters": {
"color": 6,
"width": 256,
"height": 272,
"content": "## Storing Leads In PostgreSQL"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "cd76a0c4-c864-4bb3-906f-57bfb43d2a9e",
"connections": {
"ff3a6ff0-f66f-499d-b56f-2ae8f22534ba": {
"main": [
[
{
"node": "d2eecb84-b111-401c-9fb2-91722625cb66",
"type": "main",
"index": 0
}
]
]
},
"6e52cddd-1cf2-433f-8f78-cd1f0f2d89ad": {
"main": [
[
{
"node": "32b57f66-c3cd-4a04-a787-3f7662af13c2",
"type": "main",
"index": 0
}
]
]
},
"a40f44bc-efee-4c89-8fbc-77cd0d09ff3e": {
"main": [
[
{
"node": "ff3a6ff0-f66f-499d-b56f-2ae8f22534ba",
"type": "main",
"index": 0
}
]
]
},
"067b1f22-eb31-4573-80e1-47fac5bddb7b": {
"main": [
[
{
"node": "9d1fbc5b-538a-4d82-a897-00a03ce4d5cc",
"type": "main",
"index": 0
}
]
]
},
"dd29f519-c629-4302-ad17-e1a5b0555e46": {
"main": [
[
{
"node": "9d1fbc5b-538a-4d82-a897-00a03ce4d5cc",
"type": "main",
"index": 0
}
]
]
},
"9990229b-1098-4ff5-8906-c57a260f4d15": {
"main": [
[
{
"node": "a40f44bc-efee-4c89-8fbc-77cd0d09ff3e",
"type": "main",
"index": 0
}
]
]
},
"d2eecb84-b111-401c-9fb2-91722625cb66": {
"main": [
[
{
"node": "dd29f519-c629-4302-ad17-e1a5b0555e46",
"type": "main",
"index": 0
}
]
]
},
"32b57f66-c3cd-4a04-a787-3f7662af13c2": {
"main": [
[
{
"node": "28aaf56d-ee27-4a81-9cd7-b0e43d13aeb9",
"type": "main",
"index": 0
}
]
]
},
"9d1fbc5b-538a-4d82-a897-00a03ce4d5cc": {
"main": [
[],
[
{
"node": "6e52cddd-1cf2-433f-8f78-cd1f0f2d89ad",
"type": "main",
"index": 0
}
]
]
},
"79b4c5f6-7fe9-46eb-932b-4d98593c2607": {
"ai_languageModel": [
[
{
"node": "a40f44bc-efee-4c89-8fbc-77cd0d09ff3e",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"f2a03fb3-9171-482e-b078-05a5dff93e6a": {
"ai_languageModel": [
[
{
"node": "28aaf56d-ee27-4a81-9cd7-b0e43d13aeb9",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"28aaf56d-ee27-4a81-9cd7-b0e43d13aeb9": {
"main": [
[
{
"node": "067b1f22-eb31-4573-80e1-47fac5bddb7b",
"type": "main",
"index": 0
}
]
]
},
"5f49d3d3-5e81-4b9d-9bc4-687ee97e2e8f": {
"main": [
[
{
"node": "9990229b-1098-4ff5-8906-c57a260f4d15",
"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, RAG 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
Fayzul Noor
@fayzul-noorCompartir este flujo de trabajo