Investigación avanzada de IA multi-fuente basada en Bright Data, OpenAI y Redis

Avanzado

Este es unMarket Research, AI RAGflujo de automatización del dominio deautomatización que contiene 43 nodos.Utiliza principalmente nodos como If, Set, Code, Redis, Slack. Investigación avanzada multi-fuente de IA usando Bright Data, OpenAI y Redis

Requisitos previos
  • Información de conexión del servidor Redis
  • Bot Token de Slack o URL de Webhook
  • Punto final de HTTP Webhook (n8n generará automáticamente)
  • Pueden requerirse credenciales de autenticación para la API de destino
  • Clave de API de OpenAI
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "meta": {
    "instanceId": "db30e8ae4100235addbd4638770997b7ef11878d049073c888ba440ca84c55fc"
  },
  "nodes": [
    {
      "id": "846f1917-cd8b-47fb-85cb-633f6ff19888",
      "name": "Webhook Entry",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -480,
        -48
      ],
      "webhookId": "a163f70d-4812-4100-8ce7-2c9b21ea5fee",
      "parameters": {
        "path": "advanced-brightdata-search",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "juW019hiKxiES5uR",
          "name": "Header Auth account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "421128ee-be55-44a3-b7fa-f876e2da962a",
      "name": "Establecer Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        -256,
        -48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "user-prompt",
              "name": "userPrompt",
              "type": "string",
              "value": "={{ $json.body.source }}"
            },
            {
              "id": "cell-ref",
              "name": "cellReference",
              "type": "string",
              "value": "={{ $json.body.prompt }}"
            },
            {
              "id": "output-lang",
              "name": "outputLanguage",
              "type": "string",
              "value": "={{ $json.body.language || 'English' }}"
            },
            {
              "id": "cache-key",
              "name": "cacheKey",
              "type": "string",
              "value": "={{ $crypto.createHash('md5').update($json.body.prompt + $json.body.source).digest('hex') }}"
            },
            {
              "id": "request-id",
              "name": "requestId",
              "type": "string",
              "value": "={{ $now.format('yyyyMMddHHmmss') }}-{{ $crypto.randomBytes(4).toString('hex') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "45905849-b08a-471b-8b9c-b6f7e70d478e",
      "name": "Verificación de Caché",
      "type": "n8n-nodes-base.redis",
      "onError": "continueRegularOutput",
      "position": [
        -48,
        -48
      ],
      "parameters": {
        "key": "={{ $json.cacheKey }}",
        "options": {},
        "operation": "get"
      },
      "typeVersion": 1
    },
    {
      "id": "f3874e1f-190a-4fe4-9dd8-ed53307436e1",
      "name": "Verificar Acierto de Caché",
      "type": "n8n-nodes-base.if",
      "position": [
        176,
        -48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cache-exists",
              "operator": {
                "type": "string",
                "operation": "exists"
              },
              "leftValue": "={{ $('Cache Check').item.json.value }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d24a360c-7785-402c-bdfa-8bf39d7f7321",
      "name": "Verificación de Límite de Tasa",
      "type": "n8n-nodes-base.code",
      "position": [
        -320,
        320
      ],
      "parameters": {
        "jsCode": "// Rate limiting: max 60 requests per minute\nconst Redis = require('ioredis');\nconst redis = new Redis($credentials.redis);\n\nconst key = `rate_limit:${new Date().toISOString().slice(0, 16)}`; // per minute\nconst count = await redis.incr(key);\nawait redis.expire(key, 60);\n\nif (count > 60) {\n  throw new Error('Rate limit exceeded. Max 60 requests per minute.');\n}\n\nreturn [{ \n  json: { \n    ...items[0].json,\n    rateLimit: { current: count, max: 60 }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "4cf998be-1901-420e-9a76-60d2a796bf34",
      "name": "Agente de Razonamiento de Múltiples Pasos",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -144,
        320
      ],
      "parameters": {
        "text": "=Analyze this query and determine if it needs to be broken into sub-queries:\n\nQuery: {{ $json.userPrompt }}\nContext: {{ $json.cellReference }}\n\nIf the query is complex (e.g., \"compare X and Y\", \"analyze trends\", \"multiple data points\"), break it into 2-5 focused sub-queries.\nIf the query is simple (e.g., \"what is X\", \"who is the CEO\"), return it as-is.\n\nReturn JSON format:\n{\n  \"isComplex\": boolean,\n  \"subQueries\": [\"query1\", \"query2\", ...] or [original_query],\n  \"reasoning\": \"explanation\"\n}",
        "options": {
          "systemMessage": "You are an expert at breaking down complex information requests into logical sub-queries. Each sub-query should be independently searchable and answerable."
        },
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "ce0a3979-bbcf-49a8-a438-e95b3eff820a",
      "name": "Analizador de Salida de Razonamiento",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        0,
        528
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"isComplex\": false,\n  \"subQueries\": [\"query\"],\n  \"reasoning\": \"\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "e55d6a52-d91f-4ad3-aef8-652ebfc1e009",
      "name": "GPT-4o (Razonamiento)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -144,
        528
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o"
        },
        "options": {
          "temperature": 0.3
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "84d9ece9-9b1f-49f3-a2e7-6d5b62181a67",
      "name": "Dividir Subconsultas",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        144,
        320
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "163afc77-961a-4cca-adaa-0c638f9962f3",
      "name": "Agente Optimizador de Consultas",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        320,
        320
      ],
      "parameters": {
        "text": "=Optimize this search query for maximum relevance:\n\nQuery: {{ $json.subQuery }}\nOriginal context: {{ $('Set Variables').item.json.cellReference }}\nTarget language: {{ $('Set Variables').item.json.outputLanguage }}\nCurrent date: {{ $now.format('yyyy-MM-dd') }}\n\nCreate an optimized search query in English that will:\n1. Include relevant keywords and synonyms\n2. Add temporal context if needed (e.g., \"2025\", \"latest\")\n3. Prioritize authoritative sources\n4. Use proper quotation marks for exact phrases\n\nReturn JSON:\n{\n  \"optimizedQuery\": \"the optimized query\",\n  \"suggestedCountry\": \"us\" or \"il\",\n  \"expectedSources\": [\"type of sources like news, official, financial\"]\n}",
        "options": {
          "systemMessage": "You are a search query optimization expert. Transform user queries into optimal search engine queries."
        },
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "8f5eecc0-f32a-4641-993c-3afd00973524",
      "name": "Analizador de Salida del Optimizador",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        464,
        528
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"optimizedQuery\": \"\",\n  \"suggestedCountry\": \"us\",\n  \"expectedSources\": []\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "7d46d961-ebcd-4298-a6f3-a37bc02ede22",
      "name": "GPT-4o Mini (Optimizador)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        320,
        528
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {
          "temperature": 0.1
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e21dd153-dd0b-4552-9c86-909a6bed554c",
      "name": "Agente de Búsqueda Multifuente",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        672,
        320
      ],
      "parameters": {
        "text": "=Search for the top 5 most relevant links:\n\nQuery: {{ $json.output.optimizedQuery }}\nCountry: {{ $json.output.suggestedCountry }}\nExpected sources: {{ $json.output.expectedSources.join(', ') }}\n\nUse search_engine to find the best results. Return EXACTLY 5 URLs.\n\nPriority sources:\n- Official websites (company, government)\n- Major news outlets (Reuters, Bloomberg, WSJ)\n- Financial reports (SEC filings, investor relations)\n- Wikipedia, Crunchbase for entity info\n- Academic or research sources\n\nAvoid:\n- Social media posts\n- Forums and discussion boards\n- Ads and promotional content\n- Low-quality or clickbait sites\n\nReturn JSON format:\n{\n  \"links\": [\n    {\n      \"url\": \"https://...\",\n      \"title\": \"page title\",\n      \"snippet\": \"description\",\n      \"sourceType\": \"news|official|financial|reference\",\n      \"credibilityScore\": 1-10\n    }\n  ]\n}",
        "options": {
          "systemMessage": "You are an expert at finding the most credible and relevant sources. Always return exactly 5 links ranked by relevance and credibility."
        },
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "acdaf58b-e349-40fa-9e4a-537ad1208053",
      "name": "Herramienta Bright Data MCP",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        768,
        528
      ],
      "parameters": {
        "include": "selected",
        "options": {
          "timeout": 120000
        },
        "endpointUrl": "https://mcp.brightdata.com/mcp?token=YOUR_TOKEN_HERE&pro=1",
        "includeTools": [
          "search_engine"
        ],
        "serverTransport": "httpStreamable"
      },
      "typeVersion": 1.1
    },
    {
      "id": "bf992e5e-cece-4203-888c-96dfabe54571",
      "name": "Analizador de Salida de Búsqueda",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        896,
        528
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"links\": [\n    {\n      \"url\": \"\",\n      \"title\": \"\",\n      \"snippet\": \"\",\n      \"sourceType\": \"news\",\n      \"credibilityScore\": 8\n    }\n  ]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "f7cc2f0d-16f6-4fcf-aa5e-29b644328e2e",
      "name": "GPT-4o (Búsqueda)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        624,
        528
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "ce606d56-37bb-484d-b0d5-5008968c38cb",
      "name": "Dividir URLs para Raspado Paralelo",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1008,
        320
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "4384e82b-12b8-4f41-858b-af2efd67c965",
      "name": "Raspado Web Paralelo",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1232,
        320
      ],
      "parameters": {
        "url": "https://api.brightdata.com/request",
        "method": "POST",
        "options": {
          "timeout": 30000,
          "batching": {
            "batch": {
              "batchSize": 5
            }
          }
        },
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "zone",
              "value": "mcp_unlocker"
            },
            {
              "name": "url",
              "value": "={{ $json.url }}"
            },
            {
              "name": "format",
              "value": "json"
            },
            {
              "name": "method",
              "value": "GET"
            },
            {
              "name": "country",
              "value": "={{ $('Query Optimizer Agent').item.json.output.suggestedCountry }}"
            },
            {
              "name": "data_format",
              "value": "markdown"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d784c590-720b-429c-b580-dea0ae7b80be",
      "name": "Extracción y Análisis Avanzado de Datos",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "onError": "continueRegularOutput",
      "position": [
        1408,
        320
      ],
      "parameters": {
        "text": "=## Input Data\n\n### Original Query:\n{{ $('Set Variables').item.json.cellReference }} - {{ $('Set Variables').item.json.userPrompt }}\n\n### Source Information:\n- URL: {{ $('Split URLs for Parallel Scraping').item.json.url }}\n- Title: {{ $('Split URLs for Parallel Scraping').item.json.title }}\n- Source Type: {{ $('Split URLs for Parallel Scraping').item.json.sourceType }}\n- Credibility Score: {{ $('Split URLs for Parallel Scraping').item.json.credibilityScore }}/10\n\n### Scraped Content:\n{{ $json.body }}\n\n---\n\n## Your Task\n\nExtract and analyze the following from the content:\n\n1. **Answer to Query**: Direct answer to the user's question\n2. **Key Facts**: Important facts, numbers, dates\n3. **Entities**: People, organizations, locations, products mentioned\n4. **Sentiment**: Overall tone (positive/neutral/negative) and confidence\n5. **Data Tables**: Any structured data (format as markdown tables)\n6. **Quotes**: Important quotes with attribution\n7. **Dates**: Relevant dates and temporal information\n\n## Output Format (JSON)\n\nReturn ONLY valid JSON:\n\n{\n  \"answer\": \"Direct answer to the query\",\n  \"summary\": \"Concise summary (max 300 chars)\",\n  \"keyFacts\": [\"fact1\", \"fact2\", ...],\n  \"entities\": {\n    \"people\": [\"name1\", \"name2\"],\n    \"organizations\": [\"org1\", \"org2\"],\n    \"locations\": [\"loc1\"],\n    \"products\": [\"product1\"]\n  },\n  \"sentiment\": {\n    \"overall\": \"positive|neutral|negative\",\n    \"confidence\": 0.0-1.0,\n    \"reasoning\": \"brief explanation\"\n  },\n  \"dataTables\": [\n    {\n      \"title\": \"table name\",\n      \"markdown\": \"| Col1 | Col2 |\\n|------|------|\\n| val1 | val2 |\"\n    }\n  ],\n  \"quotes\": [\n    {\n      \"text\": \"quote text\",\n      \"attribution\": \"person or source\"\n    }\n  ],\n  \"dates\": [\"2025-01-15\", \"Q4 2024\"],\n  \"relevanceScore\": 1-10\n}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "=You are an advanced data extraction AI specialized in:\n- Extracting structured data from unstructured text\n- Named entity recognition (NER)\n- Sentiment analysis\n- Information synthesis\n- Fact verification\n\n**Critical Rules:**\n1. Extract ONLY information present in the source\n2. Do NOT hallucinate or infer information\n3. Translate to {{ $('Set Variables').item.json.outputLanguage }} if needed\n4. Be precise with numbers, dates, and facts\n5. Always return valid JSON\n6. If data is not found, use empty arrays or null\n\n**Quality Standards:**\n- Accuracy > Completeness\n- Cite facts directly from source\n- Flag uncertainties in reasoning fields"
            }
          ]
        },
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "edf8b49b-8732-4361-9e9b-82c9460c9e1b",
      "name": "Analizador de Salida de Extracción",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1552,
        512
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"answer\": \"\",\n  \"summary\": \"\",\n  \"keyFacts\": [],\n  \"entities\": {\n    \"people\": [],\n    \"organizations\": [],\n    \"locations\": [],\n    \"products\": []\n  },\n  \"sentiment\": {\n    \"overall\": \"neutral\",\n    \"confidence\": 0.5,\n    \"reasoning\": \"\"\n  },\n  \"dataTables\": [],\n  \"quotes\": [],\n  \"dates\": [],\n  \"relevanceScore\": 5\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "be3ff2d2-2ed9-42fc-8f50-3665eee61c97",
      "name": "GPT-4o (Extracción)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1408,
        512
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "1d1b3367-ff6b-4d93-9ef6-a380e074eb29",
      "name": "Agente de Validación de Fuentes",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1664,
        320
      ],
      "parameters": {
        "text": "=Validate this source and extracted information:\n\n**Source Details:**\n- URL: {{ $('Split URLs for Parallel Scraping').item.json.url }}\n- Claimed Type: {{ $('Split URLs for Parallel Scraping').item.json.sourceType }}\n- Initial Credibility: {{ $('Split URLs for Parallel Scraping').item.json.credibilityScore }}/10\n\n**Extracted Data:**\n{{ JSON.stringify($json.output, null, 2) }}\n\n**Validation Criteria:**\n1. Is the domain trustworthy? (check TLD, known sources)\n2. Does the content match the expected source type?\n3. Are facts verifiable and internally consistent?\n4. Any red flags? (clickbait, bias, outdated info)\n5. Does the relevance score make sense?\n\nReturn JSON:\n{\n  \"isValid\": boolean,\n  \"validationScore\": 1-10,\n  \"trustLevel\": \"high|medium|low\",\n  \"redFlags\": [\"flag1\", \"flag2\"],\n  \"recommendations\": \"how to use this source\",\n  \"shouldInclude\": boolean\n}",
        "options": {
          "systemMessage": "You are a source validation expert. Assess credibility, detect bias, and flag unreliable information."
        },
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "c48f6265-c2ba-4b61-a64c-e7f490aec495",
      "name": "Analizador de Salida de Validación",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1808,
        512
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"isValid\": true,\n  \"validationScore\": 8,\n  \"trustLevel\": \"high\",\n  \"redFlags\": [],\n  \"recommendations\": \"\",\n  \"shouldInclude\": true\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "84ab425a-8e7b-417c-a2cc-e36be2518699",
      "name": "GPT-4o Mini (Validación)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1664,
        512
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {
          "temperature": 0.2
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0e5049ce-8def-4366-b25a-f7d85b0cdf43",
      "name": "Filtrar Fuentes Válidas",
      "type": "n8n-nodes-base.if",
      "position": [
        1936,
        320
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "should-include",
              "operator": {
                "type": "boolean",
                "operation": "true"
              },
              "leftValue": "={{ $json.output.shouldInclude }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "35d175db-b777-474a-b91d-144e9843adc7",
      "name": "Agregar Todos los Resultados",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        2112,
        192
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "e0fc624c-e72a-438f-9c1b-414fe2ed4d1a",
      "name": "Resumidor Inteligente con Contexto",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2256,
        192
      ],
      "parameters": {
        "text": "=## Input: Multi-Source Analysis\n\n**Original Query:**\n{{ $('Set Variables').item.json.cellReference }} - {{ $('Set Variables').item.json.userPrompt }}\n\n**Output Language:** {{ $('Set Variables').item.json.outputLanguage }}\n\n**Extracted Data from {{ $json.extractedData.length }} Sources:**\n{{ JSON.stringify($json.extractedData, null, 2) }}\n\n---\n\n## Task: Create Comprehensive Summary\n\nAnalyze all sources and create a final answer that:\n\n1. **Directly answers the user's question**\n2. **Synthesizes information from multiple sources**\n3. **Prioritizes high-credibility sources**\n4. **Includes key facts, entities, and sentiment**\n5. **Notes any conflicting information**\n6. **Stays within 400 characters for main answer**\n7. **Provides extended details separately**\n\n## Output Format (JSON)\n\n{\n  \"mainAnswer\": \"400 char summary in {{ $('Set Variables').item.json.outputLanguage }}\",\n  \"confidence\": 0.0-1.0,\n  \"keyInsights\": [\"insight1\", \"insight2\", \"insight3\"],\n  \"consensus\": \"areas where sources agree\",\n  \"conflicts\": \"areas where sources disagree (if any)\",\n  \"entities\": {\n    \"people\": [],\n    \"organizations\": [],\n    \"locations\": [],\n    \"products\": []\n  },\n  \"overallSentiment\": \"positive|neutral|negative\",\n  \"importantDates\": [],\n  \"dataHighlights\": [\n    {\n      \"metric\": \"name\",\n      \"value\": \"value\",\n      \"source\": \"which source\"\n    }\n  ],\n  \"sourcesUsed\": 5,\n  \"extendedSummary\": \"Detailed summary with all key information\"\n}",
        "options": {
          "systemMessage": "=You are an expert analyst who synthesizes information from multiple sources into clear, accurate summaries in {{ $('Set Variables').item.json.outputLanguage }}.\n\n**Principles:**\n- Accuracy first: Never fabricate information\n- Source ranking: Weight by credibility scores\n- Conflict resolution: Note disagreements, don't hide them\n- Completeness: Include all relevant entities and facts\n- Clarity: Write for non-experts\n- Brevity: Main answer ≤ 400 chars"
        },
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "c07929b4-9180-4f69-922d-11435dbcc9d3",
      "name": "Analizador de Salida del Resumen",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2400,
        400
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"mainAnswer\": \"\",\n  \"confidence\": 0.8,\n  \"keyInsights\": [],\n  \"consensus\": \"\",\n  \"conflicts\": \"\",\n  \"entities\": {\n    \"people\": [],\n    \"organizations\": [],\n    \"locations\": [],\n    \"products\": []\n  },\n  \"overallSentiment\": \"neutral\",\n  \"importantDates\": [],\n  \"dataHighlights\": [],\n  \"sourcesUsed\": 0,\n  \"extendedSummary\": \"\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "be44751d-d33b-46d6-ada9-e0ab4ae118ac",
      "name": "GPT-4o (Resumidor)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2256,
        400
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o"
        },
        "options": {
          "temperature": 0.3
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8bb399be-0edd-4ed2-b491-876b9024c3bc",
      "name": "Almacenar en Caché",
      "type": "n8n-nodes-base.redis",
      "onError": "continueRegularOutput",
      "position": [
        2544,
        192
      ],
      "parameters": {
        "key": "={{ $('Set Variables').item.json.cacheKey }}",
        "ttl": 3600,
        "value": "={{ JSON.stringify($json.output) }}",
        "expire": true,
        "operation": "set"
      },
      "typeVersion": 1
    },
    {
      "id": "dea2d0ed-b5f2-4140-98eb-f6ba2fb5d0be",
      "name": "Preparar Salidas",
      "type": "n8n-nodes-base.set",
      "position": [
        2768,
        192
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "webhook-response",
              "name": "webhookResponse",
              "type": "string",
              "value": "={{ $json.output.mainAnswer }}"
            },
            {
              "id": "slack-message",
              "name": "slackMessage",
              "type": "string",
              "value": "=✅ *Search Complete*\\n\\n*Query:* {{ $('Set Variables').item.json.cellReference }} - {{ $('Set Variables').item.json.userPrompt }}\\n\\n*Answer:* {{ $json.output.mainAnswer }}\\n\\n*Confidence:* {{ Math.round($json.output.confidence * 100) }}%\\n*Sources Used:* {{ $json.output.sourcesUsed }}\\n*Sentiment:* {{ $json.output.overallSentiment }}\\n\\n_Request ID: {{ $('Set Variables').item.json.requestId }}_"
            },
            {
              "id": "email-subject",
              "name": "emailSubject",
              "type": "string",
              "value": "=Search Results: {{ $('Set Variables').item.json.cellReference }}"
            },
            {
              "id": "email-body",
              "name": "emailBody",
              "type": "string",
              "value": "=<h2>Advanced Web Research Results</h2>\\n\\n<p><strong>Query:</strong> {{ $('Set Variables').item.json.userPrompt }}</p>\\n<p><strong>Context:</strong> {{ $('Set Variables').item.json.cellReference }}</p>\\n\\n<h3>Main Answer</h3>\\n<p>{{ $json.output.mainAnswer }}</p>\\n\\n<h3>Key Insights</h3>\\n<ul>\\n{{ $json.output.keyInsights.map(i => '<li>' + i + '</li>').join('\\n') }}\\n</ul>\\n\\n<h3>Extended Summary</h3>\\n<p>{{ $json.output.extendedSummary }}</p>\\n\\n<h3>Data Highlights</h3>\\n<ul>\\n{{ $json.output.dataHighlights.map(d => '<li><strong>' + d.metric + ':</strong> ' + d.value + ' <em>(from ' + d.source + ')</em></li>').join('\\n') }}\\n</ul>\\n\\n<h3>Entities Mentioned</h3>\\n<ul>\\n<li><strong>People:</strong> {{ $json.output.entities.people.join(', ') }}</li>\\n<li><strong>Organizations:</strong> {{ $json.output.entities.organizations.join(', ') }}</li>\\n<li><strong>Locations:</strong> {{ $json.output.entities.locations.join(', ') }}</li>\\n</ul>\\n\\n<hr>\\n<p><em>Generated: {{ $now.format('yyyy-MM-dd HH:mm:ss') }}</em></p>\\n<p><em>Confidence: {{ Math.round($json.output.confidence * 100) }}%</em></p>\\n<p><em>Sources Analyzed: {{ $json.output.sourcesUsed }}</em></p>"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "92028c09-3097-4046-ac6e-d843d313336f",
      "name": "Responder a Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2992,
        80
      ],
      "parameters": {
        "options": {
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": "text/plain; charset=utf-8"
              }
            ]
          }
        },
        "respondWith": "text",
        "responseBody": "={{ $json.webhookResponse }}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "35e531fe-47a8-43dc-8ac8-e08b7c9cdf82",
      "name": "Enviar Notificación Slack",
      "type": "n8n-nodes-base.slack",
      "onError": "continueRegularOutput",
      "position": [
        2992,
        208
      ],
      "webhookId": "7fd47177-bd3f-4f02-ab6c-6c50d80898e3",
      "parameters": {
        "text": "={{ $json.slackMessage }}",
        "otherOptions": {}
      },
      "typeVersion": 2.3
    },
    {
      "id": "edbf4987-666e-437d-878f-213a3207bf42",
      "name": "Enviar Informe por Correo",
      "type": "n8n-nodes-base.emailSend",
      "onError": "continueRegularOutput",
      "position": [
        2992,
        352
      ],
      "webhookId": "60d3ca6e-fb55-4b24-9b92-f32236ad401f",
      "parameters": {
        "options": {},
        "subject": "={{ $json.emailSubject }}",
        "toEmail": "={{ $('Webhook Entry').item.json.body.notifyEmail || 'team@yourdomain.com' }}",
        "fromEmail": "noreply@yourdomain.com"
      },
      "typeVersion": 2.1
    },
    {
      "id": "f78d7f9a-5de3-4721-bd06-cfd34a542c93",
      "name": "Registrar en DataTable",
      "type": "n8n-nodes-base.dataTable",
      "onError": "continueRegularOutput",
      "position": [
        2992,
        496
      ],
      "parameters": {
        "operation": "append",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_DATATABLE_ID"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0824c24a-81b3-40b6-a2f7-0595a1e7cf84",
      "name": "Devolver Resultado en Caché",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        400,
        -96
      ],
      "parameters": {
        "options": {
          "responseHeaders": {
            "entries": [
              {
                "name": "X-Cache",
                "value": "HIT"
              }
            ]
          }
        },
        "respondWith": "json",
        "responseBody": "={{ JSON.parse($('Cache Check').item.json.value) }}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "b846aa93-0079-46d4-bb52-345ffca70784",
      "name": "Registrar Acierto de Caché",
      "type": "n8n-nodes-base.dataTable",
      "onError": "continueRegularOutput",
      "position": [
        400,
        -240
      ],
      "parameters": {
        "operation": "append",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_DATATABLE_ID"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "00f81dfd-a518-45c4-acc6-a49483e4f357",
      "name": "Nota Adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        -368
      ],
      "parameters": {
        "color": 5,
        "width": 1296,
        "height": 512,
        "content": "# Input Handling and Caching\n\n## Receives webhook request, sets variables like prompt and cache key, checks Redis cache for existing results, and returns cached response if hit, ensuring efficient reuse of prior computations.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "67c24041-ed99-4b3e-aee4-9344509089f2",
      "name": "Nota Adhesiva1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        144
      ],
      "parameters": {
        "width": 1296,
        "height": 704,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Query Decomposition and Optimization\n\n## Applies rate limiting, uses AI to break complex queries into sub-queries, optimizes each for search relevance with keywords and context, preparing targeted English queries for authoritative sources. \n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d295efd7-0d94-4312-a07d-0f2583217d90",
      "name": "Nota Adhesiva2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        -368
      ],
      "parameters": {
        "color": 4,
        "width": 768,
        "height": 1216,
        "content": "# Multi-Source Search and Scraping\n\n\n## Performs AI-driven search via Bright Data for top 5 credible URLs, splits for parallel scraping to extract markdown content from official, news, and financial sites, avoiding low-quality sources. \n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "fe362a54-d47a-48f8-b921-071dda8af5f9",
      "name": "Nota Adhesiva3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1360,
        -368
      ],
      "parameters": {
        "color": 6,
        "width": 1152,
        "height": 1216,
        "content": "# Data Extraction, Validation, and Synthesis\n\n## Extracts structured data (facts, entities, sentiment) from scraped content using AI, validates source credibility and filters valid ones, aggregates results, and generates a comprehensive summary with confidence scores. "
      },
      "typeVersion": 1
    },
    {
      "id": "10e799b2-2920-4d4b-8701-386bbb7f91e8",
      "name": "Nota Adhesiva4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2512,
        -368
      ],
      "parameters": {
        "color": 2,
        "width": 848,
        "height": 1216,
        "content": "# Output and Notifications\n## Caches final summary, prepares responses for webhook, sends Slack notifications and email reports with insights, and logs to data table for tracking, completing the research workflow. \n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7dc6b369-e35f-4d8c-a6ed-1631ccca185d",
      "name": "Nota Adhesiva5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1728,
        -368
      ],
      "parameters": {
        "color": 4,
        "width": 1024,
        "height": 1216,
        "content": "# 🔍 Advanced AI-Powered Web Research System\n\n**Created by [Daniel Shashko](https://linkedin.com/in/daniel-shashko)**\n\nThis enterprise-grade workflow transforms natural language queries into comprehensive, multi-source research reports using AI agents, parallel web scraping, and intelligent data synthesis.\n\n## Key Features\n✅ **Smart Query Processing** - AI breaks complex questions into optimized sub-queries  \n✅ **Multi-Source Intelligence** - Searches and scrapes 5 credible sources in parallel  \n✅ **Intelligent Extraction** - Extracts facts, entities, sentiment, and structured data  \n✅ **Source Validation** - AI validates credibility and filters unreliable content  \n✅ **Redis Caching** - 1-hour cache for instant responses to duplicate queries  \n✅ **Rate Limiting** - 60 requests/minute protection  \n✅ **Multi-Channel Output** - Webhook response, Slack, email reports, and data logging\n\n## Tech Stack\n- **AI Models**: GPT-4o (reasoning, search, extraction) + GPT-4o-mini (optimization, validation)\n- **Search**: Bright Data MCP Tool + Web Scraping API\n- **Cache**: Redis with 1-hour TTL\n- **Output**: Webhook, Slack, Email, n8n DataTable\n\n## 📦 Companion Files\n**Note**: This workflow works with an accompanying [**`google-apps-script.js`**](https://gist.github.com/danishashko/fb509b733aebf5538676ca80b19fa28b) file for Google Sheets integration.\n\n## Workflow Stages\n1. **Input & Cache** → Webhook → Variables → Cache Check → Return if hit\n2. **Query Processing** → Rate limit → AI reasoning → Query optimization  \n3. **Search & Scrape** → Multi-source search → Parallel scraping (5 URLs)\n4. **Analysis** → Data extraction → Source validation → Filter & aggregate\n5. **Synthesis** → AI summarizer → Cache storage → Multi-channel output\n\n## API Input Format\n```json\n{\n  \"prompt\": \"Your question here\",\n  \"source\": \"Context or cell reference\", \n  \"language\": \"English\",\n  \"notifyEmail\": \"user@domain.com\"\n}\n```\n\n## Response Format\n- **Main Answer**: ≤400 chars in requested language\n- **Confidence Score**: 0.0-1.0\n- **Key Insights**: Top 3-5 findings\n- **Entities**: People, orgs, locations, products\n- **Extended Summary**: Full detailed analysis\n- **Data Highlights**: Key metrics with sources"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "45905849-b08a-471b-8b9c-b6f7e70d478e": {
      "main": [
        [
          {
            "node": "f3874e1f-190a-4fe4-9dd8-ed53307436e1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "421128ee-be55-44a3-b7fa-f876e2da962a": {
      "main": [
        [
          {
            "node": "45905849-b08a-471b-8b9c-b6f7e70d478e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "846f1917-cd8b-47fb-85cb-633f6ff19888": {
      "main": [
        [
          {
            "node": "421128ee-be55-44a3-b7fa-f876e2da962a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8bb399be-0edd-4ed2-b491-876b9024c3bc": {
      "main": [
        [
          {
            "node": "dea2d0ed-b5f2-4140-98eb-f6ba2fb5d0be",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f3874e1f-190a-4fe4-9dd8-ed53307436e1": {
      "main": [
        [
          {
            "node": "0824c24a-81b3-40b6-a2f7-0595a1e7cf84",
            "type": "main",
            "index": 0
          },
          {
            "node": "b846aa93-0079-46d4-bb52-345ffca70784",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "d24a360c-7785-402c-bdfa-8bf39d7f7321",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f7cc2f0d-16f6-4fcf-aa5e-29b644328e2e": {
      "ai_languageModel": [
        [
          {
            "node": "e21dd153-dd0b-4552-9c86-909a6bed554c",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "dea2d0ed-b5f2-4140-98eb-f6ba2fb5d0be": {
      "main": [
        [
          {
            "node": "92028c09-3097-4046-ac6e-d843d313336f",
            "type": "main",
            "index": 0
          },
          {
            "node": "35e531fe-47a8-43dc-8ac8-e08b7c9cdf82",
            "type": "main",
            "index": 0
          },
          {
            "node": "edbf4987-666e-437d-878f-213a3207bf42",
            "type": "main",
            "index": 0
          },
          {
            "node": "f78d7f9a-5de3-4721-bd06-cfd34a542c93",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d24a360c-7785-402c-bdfa-8bf39d7f7321": {
      "main": [
        [
          {
            "node": "4cf998be-1901-420e-9a76-60d2a796bf34",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "84d9ece9-9b1f-49f3-a2e7-6d5b62181a67": {
      "main": [
        [
          {
            "node": "163afc77-961a-4cca-adaa-0c638f9962f3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e55d6a52-d91f-4ad3-aef8-652ebfc1e009": {
      "ai_languageModel": [
        [
          {
            "node": "4cf998be-1901-420e-9a76-60d2a796bf34",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "be3ff2d2-2ed9-42fc-8f50-3665eee61c97": {
      "ai_languageModel": [
        [
          {
            "node": "d784c590-720b-429c-b580-dea0ae7b80be",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "be44751d-d33b-46d6-ada9-e0ab4ae118ac": {
      "ai_languageModel": [
        [
          {
            "node": "e0fc624c-e72a-438f-9c1b-414fe2ed4d1a",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "acdaf58b-e349-40fa-9e4a-537ad1208053": {
      "ai_tool": [
        [
          {
            "node": "e21dd153-dd0b-4552-9c86-909a6bed554c",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "0e5049ce-8def-4366-b25a-f7d85b0cdf43": {
      "main": [
        [
          {
            "node": "35d175db-b777-474a-b91d-144e9843adc7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "bf992e5e-cece-4203-888c-96dfabe54571": {
      "ai_outputParser": [
        [
          {
            "node": "e21dd153-dd0b-4552-9c86-909a6bed554c",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "35d175db-b777-474a-b91d-144e9843adc7": {
      "main": [
        [
          {
            "node": "e0fc624c-e72a-438f-9c1b-414fe2ed4d1a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4384e82b-12b8-4f41-858b-af2efd67c965": {
      "main": [
        [
          {
            "node": "d784c590-720b-429c-b580-dea0ae7b80be",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "163afc77-961a-4cca-adaa-0c638f9962f3": {
      "main": [
        [
          {
            "node": "e21dd153-dd0b-4552-9c86-909a6bed554c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c07929b4-9180-4f69-922d-11435dbcc9d3": {
      "ai_outputParser": [
        [
          {
            "node": "e0fc624c-e72a-438f-9c1b-414fe2ed4d1a",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "7d46d961-ebcd-4298-a6f3-a37bc02ede22": {
      "ai_languageModel": [
        [
          {
            "node": "163afc77-961a-4cca-adaa-0c638f9962f3",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "8f5eecc0-f32a-4641-993c-3afd00973524": {
      "ai_outputParser": [
        [
          {
            "node": "163afc77-961a-4cca-adaa-0c638f9962f3",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "ce0a3979-bbcf-49a8-a438-e95b3eff820a": {
      "ai_outputParser": [
        [
          {
            "node": "4cf998be-1901-420e-9a76-60d2a796bf34",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "1d1b3367-ff6b-4d93-9ef6-a380e074eb29": {
      "main": [
        [
          {
            "node": "0e5049ce-8def-4366-b25a-f7d85b0cdf43",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "edf8b49b-8732-4361-9e9b-82c9460c9e1b": {
      "ai_outputParser": [
        [
          {
            "node": "d784c590-720b-429c-b580-dea0ae7b80be",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "84ab425a-8e7b-417c-a2cc-e36be2518699": {
      "ai_languageModel": [
        [
          {
            "node": "1d1b3367-ff6b-4d93-9ef6-a380e074eb29",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "c48f6265-c2ba-4b61-a64c-e7f490aec495": {
      "ai_outputParser": [
        [
          {
            "node": "1d1b3367-ff6b-4d93-9ef6-a380e074eb29",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "e21dd153-dd0b-4552-9c86-909a6bed554c": {
      "main": [
        [
          {
            "node": "ce606d56-37bb-484d-b0d5-5008968c38cb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4cf998be-1901-420e-9a76-60d2a796bf34": {
      "main": [
        [
          {
            "node": "84d9ece9-9b1f-49f3-a2e7-6d5b62181a67",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e0fc624c-e72a-438f-9c1b-414fe2ed4d1a": {
      "main": [
        [
          {
            "node": "8bb399be-0edd-4ed2-b491-876b9024c3bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ce606d56-37bb-484d-b0d5-5008968c38cb": {
      "main": [
        [
          {
            "node": "4384e82b-12b8-4f41-858b-af2efd67c965",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d784c590-720b-429c-b580-dea0ae7b80be": {
      "main": [
        [
          {
            "node": "1d1b3367-ff6b-4d93-9ef6-a380e074eb29",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿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 - Investigación de mercado, 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.

Información del flujo de trabajo
Nivel de dificultad
Avanzado
Número de nodos43
Categoría2
Tipos de nodos18
Descripción de la dificultad

Adecuado para usuarios avanzados, flujos de trabajo complejos con 16+ nodos

Autor
Daniel Shashko

Daniel Shashko

@tomax

AI automation specialist and a marketing enthusiast. More than 6 years of experience in SEO/GEO. Senior SEO at Bright Data.

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34