Automation projects

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.

RAG ArchitectureSupabase Vector DatabaseGoogle GeminiWhatsApp AI Bot
Completed project Published n8n workflow
DOCUMENT INTELLIGENCEKnowledge,
connected.
GeminiSupabasen8n
36Workflow nodes
214Recorded executions
2Chat channels
1Shared knowledge base

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

01 / THE PROBLEM

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.

02 / THE SOLUTION

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.

01

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.
02

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.
03

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.
04

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.
05

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.
06

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.

  1. Submit a document.
  2. n8n receives the file and extracts its text.
  3. Text is split into chunks.
  4. Google Gemini generates embeddings.
  5. Supabase stores vectors and source metadata.
  6. The chatbot can retrieve relevant information.
PDFTXTMarkdown
Document upload interfaceUpload form screenshot will appear here when added to the portfolio assets.

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.

Web chat screenshotActual interface screenshot will appear here when added to the portfolio assets.

Channel 02

WhatsApp AI Assistant

WhatsApp Business Cloud API connects to the shared knowledge base and keeps conversation history per phone number.

WhatsApp channel integration

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.

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

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

01

Retrieval-Augmented Generation

Retrieves relevant document chunks before generating AI responses.

02

Vector Embeddings

Uses Google Gemini embeddings and Supabase pgvector for semantic search.

03

Source-Grounded Answers

Prompts restrict responses to retrieved information and require source citations.

04

Document Processing

Ingests files using 800-character chunks and 100-character overlap.

05

Multi-Channel AI

Connects one document knowledge base to web chat and WhatsApp.

06

Per-User Conversation Memory

Maintains separate WhatsApp conversation histories by phone number.

07

Custom Web Interfaces

Serves upload and chat experiences using HTML and CSS through n8n webhooks.

08

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.

RAG architecture designDocument processing and chunkingVector embeddingsSupabase and pgvectorSemantic search workflowsAI agents with retrieval toolsGrounded prompts and citationsConversation memoryMulti-channel integrationWebhook-based interfacesWhatsApp Business Cloud APIWebhook verification and compliance

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.

Full size RAG Knowledge Base n8n automation workflow

RAG Knowledge Base Chatbot — published n8n workflow