Automate document synchronization from Google Drive to a Supabase vector database using n8n. This powerful n8n workflow features custom chunking, OpenAI contextualization, and hybrid RAG search capabilities.
Download this n8n workflow template and start using it instantly.




























Maintaining a synchronized and optimized knowledge base for Retrieval-Augmented Generation (RAG) is challenging. This advanced n8n workflow solves this by creating a robust pipeline between Google Drive and Supabase. The automation monitors a specified Google Drive folder for new or modified documents. It utilizes a file hashing mechanism and a record manager table in Supabase to efficiently detect changes, ensuring only necessary updates are processed (a technique known as delta processing).
Crucially, this n8n workflow goes beyond simple text splitting. It employs custom JavaScript for intelligent chunking and uses an OpenAI n8n node to generate contextual summaries for each resulting chunk. This step significantly boosts retrieval performance in the Supabase hybrid search environment. Furthermore, the overall n8n template includes a complete AI Agent setup, demonstrating how to query this newly built, optimized vector database using the RAG data it ingests, making it a complete end-to-end solution.
This comprehensive n8n workflow operates in two main logical paths: Data Synchronization and AI Querying.
Watch GD RAG Files n8n trigger, which detects new or modified files in Google Drive.Extract from File n8n node). A SHA256 hash is generated using the Generate Hash n8n node to identify unique content.Search Record Manager (Supabase n8n node) checks the corresponding file ID. The Switch n8n node directs the flow: if the file is new, it proceeds directly. If it is modified, the old vectors and records are deleted before proceeding. If it is unchanged, the workflow stops processing that item.Basic LLM Chain connected to an OpenAI n8n node) generates a summary and classified metadata for the document.Recursive Splitter2 n8n node) handles intelligent text segmentation. Another LLM chain (Add Context) leverages the entire document to write a succinct contextual sentence for each individual chunk, preparing it for superior vector search.Embeddings OpenAI1 n8n node and then inserted into the Supabase vector store (Supabase Vector Store1 n8n node), completing the synchronization.Watch GD Trash) detects when a file is moved to trash, automatically deleting the corresponding vectors and tracking records from Supabase, ensuring data integrity.When chat message received n8n trigger. This agent uses the Query Vector Store tool, which orchestrates a call to a Supabase Edge Function after converting the user's query into an embedding vector (via an HTTP Request n8n node), enabling immediate hybrid RAG search against the newly synchronized data.To deploy this n8n workflow, follow these steps:
Watch GD RAG Files n8n trigger and related nodes. Specify the target folder ID for RAG files and the Trash folder ID.OpenAI Chat Model, Embeddings OpenAI1). Ensure the keys are linked.documentshs, recordmanagerhs).documentshs table (including vectors and tsvectors for hybrid search) and the recordmanagerHS table.matchdocumentshshybrid function), and update the URL in the Edge Function HTTP Request n8n node.record_managerhs) to retrieve the existing file hash for comparison.insert the contextualized, embedded documents into the documentshs table.Query Vector Store tool.Automate file retrieval from deeply nested Google Drive folders using this robust n8n workflow. Efficiently list all file IDs from a complex directory structure.

Automate Google Drive file management using this powerful n8n workflow. Detect, flag, or trash duplicate files based on MD5 checksums and creation time.

Enable AI agents (like Claude or ChatGPT) to read, write, and format Google Docs programmatically using this powerful n8n workflow and MCP server. Leverage the n8n trigger for advanced file operations.

Automate high-quality, SEO-optimized technical blog posts using this robust n8n workflow. Triggers on new Google Sheets submissions, generates content using multiple AI models (Groq, Mistral), optimizes for GEO/SEO, and includes a mandatory human approval gate via a custom n8n form in Gmail.

Use this comprehensive n8n workflow to scrape Google Maps business data via Bright Data, enrich leads using Google Gemini AI, and save structured results efficiently to Google Sheets.

Automate lead generation using this advanced n8n workflow. Scrape Google Maps data via Apify, extract contact emails from websites using custom code, and sync qualified leads to Airtable. Find the perfect n8n templates here.


n8n developer helping businesses save time and scale by automating complex business processes with n8n and smart integrations.







































