The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "RAG - Consulta via Webhook",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "rag-query",
"responseMode": "responseNode",
"options": {}
},
"id": "webhook-trigger",
"name": "Webhook - Recibir Pregunta",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
250,
300
]
},
{
"parameters": {
"functionCode": "const body = $input.first().json.body;\n\nif (!body || !body.pregunta) {\n return [{\n json: {\n error: true,\n mensaje: 'El campo \"pregunta\" es requerido en el body del request'\n }\n }];\n}\n\nreturn [{\n json: {\n pregunta: body.pregunta,\n top_k: body.top_k || 5,\n temperature: body.temperature || 0.3\n }\n}];"
},
"id": "validate-input",
"name": "Validar entrada",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
470,
300
]
},
{
"parameters": {
"method": "POST",
"url": "http://api:8000/api/query",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ pregunta: $json.pregunta, top_k: $json.top_k, temperature: $json.temperature }) }}",
"options": {
"timeout": 120000
}
},
"id": "query-api",
"name": "Consultar API RAG",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
690,
300
]
},
{
"parameters": {
"functionCode": "const data = $input.first().json;\n\nreturn [{\n json: {\n respuesta: data.respuesta,\n fuentes: (data.fuentes || []).map(f => ({\n documento: f.documento,\n fragmento: f.fragmento,\n similitud: f.similitud,\n pagina: f.pagina\n })),\n modelo: data.modelo_usado,\n fragmentos_consultados: data.fragmentos_consultados,\n timestamp: new Date().toISOString()\n }\n}];"
},
"id": "format-response",
"name": "Formatear respuesta",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
910,
300
]
},
{
"parameters": {
"options": {
"responseCode": 200
}
},
"id": "respond-webhook",
"name": "Responder al Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
1130,
300
]
}
],
"connections": {
"Webhook - Recibir Pregunta": {
"main": [
[
{
"node": "Validar entrada",
"type": "main",
"index": 0
}
]
]
},
"Validar entrada": {
"main": [
[
{
"node": "Consultar API RAG",
"type": "main",
"index": 0
}
]
]
},
"Consultar API RAG": {
"main": [
[
{
"node": "Formatear respuesta",
"type": "main",
"index": 0
}
]
]
},
"Formatear respuesta": {
"main": [
[
{
"node": "Responder al Webhook",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"meta": {
"templateCredsSetupCompleted": true
},
"tags": [
{
"name": "RAG",
"id": "1"
},
{
"name": "Consulta",
"id": "3"
}
]
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
RAG - Consulta via Webhook. Uses httpRequest. Webhook trigger; 5 nodes.
Source: https://github.com/Mateo-R99/RAG-Empresarial/blob/b2405cf2b06cfd20a1430111aec6acfb93b8ffff/n8n/flujo_consulta.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow automates end-to-end social media publishing powered by Late API. It generates text content with Google Gemini, creates branded visuals with Kie.ai, uploads media to Late, and publishes
This workflow is perfect for app developers, SaaS founders, and mobile growth teams who need constant UGC-style video ads without hiring creators or agencies. If you're spending $500+ per creator and
AI Background Generation with Nano Banana (Gemini Image). Uses httpRequest, googleDrive. Webhook trigger; 35 nodes.
This template is for developers, teams, and automation enthusiasts who want a private, PIN-protected Telegram chatbot that answers questions from their own documents — without relying on external AI A
Elevate your digital presence with high-fidelity cinematic video automation. This workflow orchestrates the complex, asynchronous rendering process of OpenAI Sora—transforming static product images or