Library / RAG & Knowledge Bases
RAG & Knowledge Bases
Answer support chat questions from uploaded documents using OpenAI and a webhook
Indexes uploaded PDFs, CSVs and text files into an in-memory vector store, then answers each chat message sent to the webhook with OpenAI, keeping session history.
What it does
# Support chatbot answering from your own documents A chat API that answers customer questions from files you upload. Ask it anything over your PDFs, CSVs or text files and it replies in a natural conversation, remembering what was said earlier. Point a website widget, WhatsApp bot or app at the webhook and it just works. ### How it works 1. You upload documents through a simple form. They are split, embedded with OpenAI and held in an in-memory vector store. 2. A webhook receives each chat message along with a session ID, protected by header authentication. 3. The support agent answers common questions straight from its system prompt. For anything specific it calls a second agent that searches the uploaded documents and hands back only the facts it found. 4. Conversation memory keeps the last 15 messages per session, so follow-up questions and multi-step requests work naturally. 5. The reply is formatted and returned to whatever sent the message. ### Setup 1. Add your OpenAI API key to the three model and embedding nodes. 2. On the Receive chat message node, create a header auth credential. Your chat app must send that same header and secret. 3. Open the Support agent node and replace every bracketed placeholder in the system prompt with your own company details. 4. Activate, open the form URL, upload your documents, then POST to the webhook with a JSON body containing message and session_id. ### Customization The in-memory store is cleared whenever n8n restarts, so re-upload after a restart. For permanent storage, swap both vector store nodes for Pinecone, Qdrant or Supabase.
The steps
- Upload files to the knowledge base
- Embeddings - OpenAI
- Data Loader - Split uploaded files
- Store documents in vector store
- Search knowledge base
- Chat model - Knowledge base agent
- Receive chat message
- Support agent
- Chat model - Support agent
- Conversation memory
- Knowledge base agent
- Send reply
- Format reply
Similar automations
RAG & Knowledge BasesAnswer support questions from your docs with Telegram, OpenRouter and pgvector28 stepsEmail AutomationAnswer currency rate questions from Gmail and chat with Gemini and Frankfurter API24 stepsRAG & Knowledge BasesAnswer internal policy questions from Google Drive with OpenAI and Qdrant31 stepsChatbots & Messaging BotsAnswer RFx sourcing event questions with Gemini and Google Sheets42 steps