AI Automation / RAG / Knowledge Management Completed · Published Workflow
RAG Knowledge Base Chatbot
AI-Powered Document Intelligence | Supabase + Google Gemini + n8n
An n8n-built AI assistant that answers questions from your documents, cites the source file, and works through web chat and WhatsApp.
connected.
Execution figures are a recorded instance snapshot: 214 executions, 16 failures, approximately 92.5% successful in that snapshot. This is not a guaranteed ongoing success rate.
Project overview
Answers grounded in your own documents
Knowledge is scattered across files
Teams often store important information across scattered documents, including company policies, FAQs, guides, and internal reference materials. Finding specific information can become time-consuming, especially when users need to search through multiple files manually.
Traditional chatbots may also generate answers that are not supported by an organization’s actual documentation. I wanted to make it possible to ask questions naturally, retrieve from uploaded documents, cite the source file, and avoid guessing when relevant information is unavailable.
One knowledge base, two chat channels
I developed a Retrieval-Augmented Generation (RAG) Knowledge Base Chatbot using n8n, Google Gemini, and Supabase. Users upload PDF, TXT, and Markdown files through a custom form. The documents are extracted, split into chunks, embedded, and stored in Supabase using pgvector.
When someone asks a question, vector search retrieves relevant chunks and Gemini generates a grounded answer with the source filename. The same knowledge base serves a custom web chat and WhatsApp.
Retrieval pipeline
How the RAG Architecture Works
Document ingestion, semantic retrieval, grounded generation, and delivery through two channels.
Document Upload
Accept user documents through a custom upload form.
- Supports PDF, TXT, and Markdown files.
- The form submits uploaded files to an n8n webhook for ingestion.
Document Processing
Prepare extracted content for retrieval.
- Extracts text and splits it into 800-character chunks with 100-character overlap.
- Google Gemini generates embeddings; Supabase stores each vector.
- Chunk metadata includes source filename, upload timestamp, content, and embedding.
Vector Database Storage
Keep the document vectors searchable by meaning.
- Supabase PostgreSQL with pgvector stores embeddings and document chunks.
- Semantic similarity search goes beyond exact keyword matching.
- Stored chunks become the chatbot’s shared knowledge source.
AI Retrieval and Response
Generate answers using relevant retrieved document information.
- A question arrives through web chat or WhatsApp and is processed by the AI Agent.
- Supabase vector search retrieves relevant chunks.
- Google Gemini generates a response using retrieved information and includes the source filename.
- If relevant information is unavailable, the assistant is instructed to say so instead of inventing an answer.
Source Citations
Help users see and verify where an answer came from.
- Responses identify the source file used.
- Citations make retrieved information more transparent and verifiable.
Multi-Channel Delivery
Use the same knowledge base from two conversation experiences.
- Custom Web Chat served through n8n webhooks.
- WhatsApp Business Cloud API integration.
- Both channels access the same underlying document knowledge base.
Knowledge ingestion
Document Upload & Knowledge Ingestion
A custom upload form starts the pipeline that turns documents into searchable knowledge.
From file to searchable knowledge
Users submit PDF, TXT, or Markdown documents. n8n receives the upload, extracts text, splits it into overlapping chunks, generates Google Gemini embeddings, and stores vectors with source metadata in Supabase.
- Submit a document.
- n8n receives the file and extracts its text.
- Text is split into chunks.
- Google Gemini generates embeddings.
- Supabase stores vectors and source metadata.
- The chatbot can retrieve relevant information.

Channel 01
Custom Web Chat
A custom-themed public chat page connected to the same document retrieval system.
- HTML and CSS served through n8n webhooks
- Google Gemini AI Agent using gemini-3.5-flash-lite
- Supabase vector search tool
- Six-message conversation memory
- Document-grounded response instructions
- Source file citations
- Fallback when relevant documents cannot be found
The agent is instructed to answer only from retrieved chunks, avoid unsupported assumptions, cite source files, and clearly state when information is unavailable.

Channel 02
WhatsApp AI Assistant
WhatsApp Business Cloud API connects to the shared knowledge base and keeps conversation history per phone number.
The WhatsApp Business Cloud API connects to the shared RAG knowledge base. The screenshot shown in the Web Chat section above is the available interface image; no WhatsApp conversation screenshot has been supplied.
- WhatsApp Business Cloud API webhook
- Google Gemini processing with Supabase vector search
- Same shared document knowledge base
- Individual conversation history for each phone number
- Context-aware follow-up questions
- Automated responses sent back to the sender
Available commands
/uploadfile sends the document upload form link.
/help displays available chatbot commands.
Other incoming messages are treated as knowledge base questions. Per-number context supports follow-ups such as “What about his role?”
Published n8n workflow
Inside the Automation Architecture
The complete published workflow connects document ingestion, vector storage, AI retrieval, web chat, WhatsApp, and supporting webhook functionality.
Workflow screenshot placeholder
The actual RAG workflow screenshot is stored in the portfolio image assets.
Published workflow · 36 nodes
36 workflow nodes integrate document ingestion, vector storage, AI retrieval, web chat, WhatsApp, and supporting webhooks. The workflow URL opens the published n8n workflow and is not presented as a public chatbot demo.
Platform & integrations
Platform Integration & Compliance
Supporting Meta publishing requirements
The workflow serves Privacy Policy and Data Deletion pages to support Meta requirements for WhatsApp application publishing. No unverified contact details are reproduced here.
Webhook-driven communication
n8n webhooks receive document uploads, serve the custom web chat, process WhatsApp events, handle WhatsApp webhook verification, and serve compliance pages.
Credentials, tokens, private webhook URLs, phone number identifiers, and internal workflow configuration are intentionally excluded from this case study.
AI & workflow engineering
Tools behind the assistant
n8n Cloud
Workflow automation, webhook management, and AI orchestration.
Google Gemini
LLM processing and document embeddings.
Supabase
Database and vector storage.
PostgreSQL
Structured data storage.
pgvector
Semantic vector similarity search.
WhatsApp Business Cloud API
WhatsApp messaging and chatbot integration.
n8n AI Agent
AI-powered retrieval and response generation.
LangChain Nodes
AI agent and retrieval workflow components.
HTML & CSS
Custom upload form and web chat interfaces.
Webhooks
Communication between external platforms and n8n.
Engineering
Technical Highlights
Retrieval-Augmented Generation
Retrieves relevant document chunks before generating AI responses.
Vector Embeddings
Uses Google Gemini embeddings and Supabase pgvector for semantic search.
Source-Grounded Answers
Prompts restrict responses to retrieved information and require source citations.
Document Processing
Ingests files using 800-character chunks and 100-character overlap.
Multi-Channel AI
Connects one document knowledge base to web chat and WhatsApp.
Per-User Conversation Memory
Maintains separate WhatsApp conversation histories by phone number.
Custom Web Interfaces
Serves upload and chat experiences using HTML and CSS through n8n webhooks.
Verification & Compliance
Supports webhook verification and Meta privacy and data-deletion pages.
Reflection
What I Learned
Building this RAG Knowledge Base Chatbot strengthened my understanding of practical AI engineering and retrieval-based systems.
Future enhancements
Future Enhancements
Potential improvements for future iterations; these are not presented as completed features.
- Document management dashboard
- Document deletion and re-indexing
- Additional document formats
- Advanced access control and user permissions
- Document version management
- Retrieval analytics
- Additional messaging integrations
- Enhanced citation display
Explore AI-Powered Knowledge Retrieval
Discover how documents, vector search, and generative AI can work together to make business knowledge easier to access.