Company Knowledge Base Agent (RAG)

Go to Workflow
86 views
Built by Abdul Mir Abdul Mir
Created on June 06, 2026

Description

Overview
Turn your docs into an AI-powered internal or public-facing assistant. This chatbot workflow uses RAG (Retrieval-Augmented Generation) with Supabase vector search to answer employee or customer questions based on your company documents—automatically updated via Google Drive.

Whether it’s deployed in Telegram or embedded on your website, this agent supports voice and text input, transcribes voice messages, pulls relevant context from your internal files, and responds with a helpful, AI-generated answer. Two additional workflows listen for file changes in a shared Google Drive folder, convert them into embeddings using OpenAI, and sync them with your Supabase vector DB—so your knowledge base is always up to date.

Who’s it for
Startups building an internal ops or HR assistant
SaaS companies deploying help bots on their websites
Customer support teams reducing repetitive questions
Knowledge-driven teams needing internal AI assistants

How it works
Triggered via Telegram bot (or easily swapped for website chatbot or “on chat message”)
If user sends a voice message, it’s transcribed to text using OpenAI Whisper
Input is passed to a RAG agent that:
Searches a Supabase vector store for relevant docs
Pulls context from matching chunks using OpenAI embeddings
Responds with an LLM-powered answer
The response is sent back as a Telegram message
Two separate workflows:
New File Workflow: Listens for file uploads in Google Drive, extracts and splits text, then sends to Supabase with embeddings
Update File Workflow: Detects file edits, deletes old rows, and updates embeddings for the revised file

Example use case
> You upload your internal policy docs and client FAQs into a Google Drive folder.
>
> Employees or customers can now ask:
> - “What’s the refund policy for annual plans?”
> - “How do I request a day off?”
> - “What tools are approved for use by the engineering team?”
>
> The chatbot instantly pulls up the right section and responds with a smart, confident answer.

How to set up
Connect a Telegram bot or use n8n’s webchat / chatbot widget
Hook up OpenAI for transcription, embeddings, and completion
Set up a Supabase project and connect it as a vector store
Upload your internal docs to Google Drive
Deploy the “Add File” and “Update File” automations to manage embedding sync
Customize the chatbot’s tone and personality with prompt tweaks

Requirements
Telegram bot (or n8n Chat widget)
Google Drive integration
Supabase with pgvector or similar enabled
OpenAI API key (Whisper, Embeddings, ChatGPT)
Two folders: one for raw documents and one for tracking updates

How to customize
Swap Supabase for Pinecone, Weaviate, or Qdrant
Replace Telegram with web chat, Slack, Intercom, or Discord
Add logic to handle fallback answers or escalate to human
Embed the chat widget on your site for public customer use
Add filters (e.g. department, date, author) to narrow down context

Nodes Used (12)

AI Agent
@n8n/n8n-nodes-langchain.agent
Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader
Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi
Google Drive
n8n-nodes-base.googleDrive
OpenAI
@n8n/n8n-nodes-langchain.openAi
OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
Recursive Character Text Splitter
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter
Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow
Supabase
n8n-nodes-base.supabase
Supabase Vector Store
@n8n/n8n-nodes-langchain.vectorStoreSupabase
Telegram
n8n-nodes-base.telegram
Vector Store Question Answer Tool
@n8n/n8n-nodes-langchain.toolVectorStore