RAG with n8n: upload documents and query a knowledge base in a flow
Published on 2026-11-16 by ArduBot
Practical design of n8n automations to feed a RAG from files and query it via webhooks, with retries and duplicate control.
A chatbot receives the same question every day and someone has to keep pasting updated information into it. With n8n you can orchestrate document loading and RAG index querying, without turning every content change into a manual programming task.
Two flows, not just one
It is advisable to separate ingestion and querying. Ingestion is triggered when a source changes: a PDF uploaded to a folder, a modified page, or a CMS notification. Querying runs when a user's question arrives. If you mix both, you could reprocess the entire library with every message.
Conceptual ingestion flow:
Trigger de cambio -> validar fuente -> extraer texto
-> normalizar y dividir -> servicio de indexación RAG
-> registrar versión, resultado y errores Query flow: Webhook -> autenticar usuario -> buscar evidencia en RAG
-> comprobar si es suficiente -> opcional: generar respuesta
-> devolver resultado y fuente The exact nodes and credentials depend on the n8n instance and the chosen search service. It does not assume that an ArduMaker-specific RAG node exists today.
What data to save per document
Keep a stable source identifier, its version or hash, last change date, language, permission, and processing status. If the system receives the same event three times, an idempotency key prevents fragment multiplication. If the file is deleted, the flow must remove its fragments, not just stop updating it.
In work documents, a flow that always adds content without deleting previous versions ends up answering obsolete policies.
Errors you need to consider
An OCR can fail, a link can return 403, an embeddings provider can respond 429, or the server can cut the connection. It is not advisable to retry indefinitely: use limits, progressive waiting, and a review queue. Save the failure and allow controlled re-execution.
For queries, decide what happens when the search is unavailable. The correct answer may be “I cannot consult the documentation right now” instead of using old text or inventing a policy.
Realistic case: store support
The store manages size guides, frequently asked questions, and shipping terms. A flow runs when editing those documents. When a question enters the form, another flow retrieves the relevant fragments. If the result contains the size rule, the bot explains it and offers the reference; if someone asks about the status of their order, the correct thing is to call the authenticated orders API, not to guess it from RAG.
This distinction between documentary knowledge and transactional data avoids design errors.
How to know if it worked
For two weeks, record how many updates synchronized correctly, how long they took to be queryable, and what percentage of questions found an appropriate source. Add change tests: modify a policy and check that the previous version stops appearing.
ArduMaker Experiment: we are studying a node that receives sources and provides API search for integrations such as n8n. If your flow requires PDF, web, or internal databases, tell us what trigger and what volume it would handle through ArduMaker.
Useful readings: n8n Documentation · Microsoft RAG Architecture · Hybrid RAG on ArduMaker.