Interactive knowledge base chat with Supabase RAG using AI ππ¬
Needs changesNeeds changes. This template uses 1 thing(s) that n8n 3.0 removes: AI Agent v1 (old agent modes). 1 breaking item(s) found. Static check, last run 2026-10-19.
What to replace before upgrading
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) RAG AI Agent (v1.8) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (21)
- Google Drive Trigger
n8n-nodes-base.googleDriveTrigger - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Edit Fields (Set)
n8n-nodes-base.set - Postgres
n8n-nodes-base.postgres - Extract from File
n8n-nodes-base.extractFromFile - Aggregate
n8n-nodes-base.aggregate - Summarize
n8n-nodes-base.summarize - Supabase
n8n-nodes-base.supabase - If
n8n-nodes-base.if - Supabase Vector Store
@n8n/n8n-nodes-langchain.vectorStoreSupabase - Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi - Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - Google Drive
n8n-nodes-base.googleDrive - Switch
n8n-nodes-base.switch - Gmail
n8n-nodes-base.gmail - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Postgres Chat Memory
@n8n/n8n-nodes-langchain.memoryPostgresChat - Postgres Tool
n8n-nodes-base.postgresTool - Character Text Splitter
@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter - Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger
What it does
Google Drive File Ingestion to Supabase for Knowledge Base ππΎ Overview π This n8n workflow automates the process of ingesting files from Google Drive into a Supabase database, preparing them for a knowledge base system. It supports text-based files (PDF, DOCX, TXT, etc.) and tabular data (XLSX, CSV, Google Sheets), extracting content, generating embeddings, and storing data in structured tables. This is a foundational workflow for building a company knowledge base that can be queried via a chat interface (e.g., using a RAG workflow). π Problem Solved π― Manually managing a knowledge base with files from Google Drive is time-consuming and error-prone. This workflow solves that by: - Automatically ingesting files from Google Drive as they are created or updated. - Extracting content from various file types (text and tabular). - Generating embeddings for text-based files to enable vector search. - Storing data in Supabase for efficient retrieval. - Handling duplicates and errors to ensure data consistency. Target Audience: - Knowledge Managers: Build a centralized knowledge base from company files. - Data Teams: Automate the ingestion of spreadsheets and documents. - Developers: Integrate with other workflows (e.g., RAG for querying the knowledge base). Workflow Description π This workflow listens for new or updated files in Google Drive, processes them based on their type, and stores the extracted data in Supabase tables for later retrieval. Hereβs how it works: 1. File Detection: Triggers when a file is created or updated in Google Drive. 2. File Processing: Loops through each file, extracts metadata, and validates the file type. 3. Duplicate Check: Ensures the file hasnβt been processed before. 4. Content Extraction: - Text-based Files: Downloads the file, extracts text, splits it into chunks, generates embeddings, and stores the chunks in Supabase. - Tabular Files: Extracts data from spreadsheets and stores it as rows in Supabase. 5. Metadata Storage: Stores file metadata and basic info in Supabase tables. 6. Error Handling: Logs errors for unsupported formats or duplicates. Nodes Breakdown π οΈ 1. Detect New File π - Type: Google Drive Trigger - Purpose: Triggers the workflow when a new file is created in Google Drive. - Configuration: - Credential: Google Drive OAuth2 - Event: File Created - Customization: - Specify a folder to monitor specific directories. 2. Detect Updated File π - Type: Google Drive Trigger - Purpose: Triggers the workflow when a file is updated in Google Drive. - Configuration: - Credential: Google Drive OAuth2 - Event: File Updated - Customization: - Currently disconnected; reconnect if updates need to be processed. 3. Process Each File π - Type: Loop Over Items - Purpose: Processes each file individually from the Google Drive trigger. - Configuration: - Input: {{ $json.files }} - Customization: - Adjust the batch size if processing multiple files at once. 4. Extract File Metadata π - Type: Set - Purpose: Extracts metadata like fileid, filename, mimetype, and webviewlink. - Configuration: - Fields: - fileid: {{ $json.id }} - filename: {{ $json.name }} - mimetype: {{ $json.mimeType }} - webviewlink: {{ $json.webViewLink }} - Customization: - Add more metadata fields if needed (e.g., size, createdTime). 5. Check File Type β
- Type: IF - Purpose: Validates the file type by checking the MIME type. - Configuration: - Condition: mimetype contains supported types (e.g., application/pdf, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet). - Customization: - Add more supported MIME types as needed. 6. Find Duplicates π - Type: Supabase - Purpose: Checks if the file has already been processed by querying knowledgebase. - Configuration: - Operation: Select - Table: knowledgebase - Filter: fileid = {{ $node'Extract File Metadata'.json.fileid }} - Customization: - Add additional duplicate checks (e.g., by file name). 7. Handle Duplicates π - Type: IF - Purpose: Routes the workflow based on