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 Assistant - Query",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "rag-query",
"responseMode": "responseNode",
"options": {}
},
"id": "webhook-rag",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
240,
300
]
},
{
"parameters": {
"functionCode": "const inputItem = $input.item;\nconst body = inputItem?.json?.body || inputItem?.json || {};\nconst q = body.query || body.question || body.q;\n\nif (!q || typeof q !== 'string') {\n throw new Error('\u041f\u043e\u043b\u0435 query (\u0438\u043b\u0438 question, q) \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u041f\u0440\u0438\u043c\u0435\u0440: {\"query\": \"\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 RAG?\"}');\n}\n\nreturn [{ json: { query: String(q).trim() } }];"
},
"id": "parse-query",
"name": "Parse Query",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
460,
300
]
},
{
"parameters": {
"method": "POST",
"url": "={{ $env.RAG_API_URL || 'http://localhost:8000' }}/query",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ { \"query\": $json.query } }}",
"options": {}
},
"id": "http-rag-query",
"name": "RAG API: Query",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
680,
300
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ $input.item.json }}",
"options": {}
},
"id": "respond-webhook",
"name": "Respond to Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
900,
300
]
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Parse Query",
"type": "main",
"index": 0
}
]
]
},
"Parse Query": {
"main": [
[
{
"node": "RAG API: Query",
"type": "main",
"index": 0
}
]
]
},
"RAG API: Query": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": [],
"triggerCount": 0,
"updatedAt": "2025-01-01T00:00:00.000Z",
"versionId": "1"
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
RAG Assistant - Query. Uses httpRequest. Webhook trigger; 4 nodes.
Source: https://github.com/Edwards359/rag-assistant/blob/de2491b7cdde3aac33ca7df06f7a299d39043aa9/n8n/workflow-rag-query.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 builds a fully private, self-hosted AI chatbot using Meta Llama models. Unlike cloud-based AI APIs, every conversation stays on your infrastructure — no data leaves your environment. The
The Ultimate Scraper for n8n uses Selenium and AI to retrieve any information displayed on a webpage. You can also use session cookies to log in to the targeted webpage for more advanced scraping need
z-Api. Uses httpRequest, openAi, redis, postgres. Webhook trigger; 61 nodes.
How it works: • Receives WhatsApp messages via webhook from Whapi.Cloud • Routes commands: AI chat (/ai), numeric commands (1-9), or help menu • Sends responses: text, images, documents, videos, conta
This workflow will allow you to use OpenAI Assistant API together with a chatting platform. This version is configured to work with Hubspot, however, the Hubspot modules can be replaced by other platf