Skip to main content

Create a self-updating RAG chatbot with Google Drive, Gemini, and Supabase

Workflow preview

Workflow preview
100%
Create a self-updating RAG chatbot with Google Drive, Gemini, and Supabase preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This template creates a comprehensive, production ready Retrieval Augmented Generation (RAG) system. It builds a sophisticated AI agent that can answer questions based on documents stored in a spec...

Best for

  • Internal Wiki automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.rerankercohere, @n8n/n8n-nodes-langchain.vectorstoresupabase, n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.googledrivetrigger, n8n-nodes-base.extractfromfile, n8n-nodes-base.supabase, n8n-nodes-base.set

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Anirudh Aeran.

Original n8n.io source

1.1 Workflow description

Title
Create a self-updating RAG chatbot with Google Drive, Gemini, and Supabase
Workflow name
Create a self-updating RAG chatbot with Google Drive, Gemini, and Supabase

This template creates a comprehensive, production-ready Retrieval-Augmented Generation (RAG) system. It builds a sophisticated AI agent that can answer questions based on documents stored in a specific Google Drive folder, and it automatically keeps its knowledge base up-to-date as you add, update, or remove files.

Who’s it for?

This workflow is perfect for developers, businesses, and AI agencies looking to:

Create an internal knowledge base chatbot for employees (e.g., for HR policies, technical documentation, or project information).

Build an intelligent support agent that uses your company's official documents as its source of truth.

Develop advanced AI solutions for clients that require a self-maintaining knowledge base.

How it works?

This workflow is divided into three distinct, powerful systems:

The RAG Agent: This is the core chatbot. It receives a user's question, uses a Supabase Vector Store to find the most relevant document snippets, leverages a Cohere Reranker to improve accuracy, and uses a Postgres database to maintain conversation history (memory). It then uses Google Gemini to generate a final, context-aware answer.

The Ingestion Pipeline: This system automates the process of learning new information. It triggers whenever a file is created or updated in your designated Google Drive folder. It intelligently detects the file type (Google Doc or PDF), extracts the text, splits it into manageable chunks, generates embeddings using Gemini, and stores them in your Supabase vector database.

The Cleanup System: To ensure your knowledge base remains accurate, a scheduled process runs periodically to find and remove data from Supabase that corresponds to files that have been deleted from the Google Drive folder. This prevents the agent from using outdated information.

How to set up

To get this workflow running, you will need to configure the following:

Credentials: Connect your accounts in the n8n credential manager for:

Google Drive (OAuth2)

Supabase (API Key)

Postgres

Google Gemini (API Key from Google AI Studio)

Cohere (API Key)

Google Drive Folder: In the Search files and folders node, replace the placeholder folder ID with the ID of the Google Drive folder you want to monitor.

Database Setup: Ensure your Supabase and Postgres instances are set up with the necessary tables. You'll need a documents table in Supabase for the vectors and a document_metadata table in Postgres.

How to customize the workflow This template is a powerful starting point. You can easily customize it by:

Swapping out the LLM (e.g., use OpenAI or Anthropic instead of Gemini).

Changing the vector database (e.g., Pinecone, Weaviate).

Adding more data sources, such as Notion, Slack, or websites.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Reranker Cohere

Type / Role
@n8n/n8n-nodes-langchain.rerankerCohere - rerankerCohere
Config choices
Version 1

Block 2 - Supabase Vector Store

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreSupabase - vectorStoreSupabase
Config choices
Version 1.3

Block 3 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - RAG Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2

Block 6 - File Created

Type / Role
n8n-nodes-base.googleDriveTrigger - googleDriveTrigger
Config choices
Version 1

Block 7 - File Updated

Type / Role
n8n-nodes-base.googleDriveTrigger - googleDriveTrigger
Config choices
Version 1

Block 8 - Extract Document Text

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 9 - Delete Old Doc Rows

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 10 - Set File ID

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 11 - Extract PDF Text

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 12 - Character Text Splitter

Type / Role
@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter - textSplitterCharacterTextSplitter
Config choices
Version 1

Block 13 - Switch

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3

Block 14 - Insert into Supabase Vectorstore

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreSupabase - vectorStoreSupabase
Config choices
Version 1

Block 15 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 16 - Insert Document Metadata

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.5

Block 17 - Default Data Loader1

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1

Block 18 - Download File1

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 19 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Get File IDs

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 21 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3

Block 22 - Supabase

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 23 - Code1

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 24 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Showing the first 24 of 45 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Create a self-updating RAG chatbot with Google Drive, Gemini, and Supabase
Complexity advanced
Nodes 45
Categories Internal Wiki, AI RAG
Author Anirudh Aeran
Published 27 Sept 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/9007/9007.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Create a self-updating RAG chatbot with Google Drive, Gemini, and Supabase do?

This template creates a comprehensive, production ready Retrieval Augmented Generation (RAG) system. It builds a sophisticated AI agent that can answer questions based on documents stored in a spec...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Internal Wiki, AI RAG use case.