Automate Vector Database Q&A with n8n & Supabase Integration

This n8n workflow automates querying Venerable Geshe Kelsang Gyatso’s book using Supabase as a vector database for embeddings. It streamlines document processing, storage, and AI-powered question answering to save hours of manual data retrieval.
Google Drive
Default Data Loader
Question and Answer Chain
+14
Workflow Identifier: 2327
NODES in Use: Google Drive, Default Data Loader, Sticky Note, Question and Answer Chain, OpenAI Chat Model, Vector Store Retriever, Recursive Character Text Splitter, Customize Response, When chat message received, Retrieve by Query, Embeddings OpenAI Retrieval, Embeddings OpenAI Insertion, Embeddings OpenAI Upserting, Insert Documents, Retrieve Rows from Table, Sticky Note4, Update Documents
Automate Q&A with n8n and Supabase

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What this workflow does

This workflow helps you ask questions to a big book and get clear answers fast.
It stops you from wasting hours searching through the text manually.
You get useful, exact answers from the book’s words using AI and vector search.

The workflow downloads the book, breaks it into parts, makes those parts searchable by meaning, and answers your questions based on the best matching parts.


Tools and services used

  • n8n: for building and running the automation workflow.
  • Google Drive: stores the book file to download.
  • Default Data Loader: reads the book file into text.
  • Recursive Character Text Splitter: breaks the text into small pieces.
  • OpenAI Embeddings API (text-embedding-3-small): converts text pieces to vectors for similarity search.
  • Supabase with pgvector: stores and lets you search vectors quickly.
  • OpenAI Chat Model: answers questions using selected book parts.
  • Supabase SQL functions: match_documents to find best vector matches.
  • Webhook node: provides the chat endpoint for asking questions.

Inputs → Processing Steps → Output

Inputs

  • Book file in Google Drive (epub format preferred).
  • User’s question text entered via chat interface.

Processing Steps

  • Download book file automatically using Google Drive node.
  • Load book text with Default Data Loader using epubLoader.
  • Split loaded text recursively with Recursive Character Text Splitter into manageable chunks.
  • Create vector embeddings for chunks via Embeddings OpenAI Insertion node with model text-embedding-3-small.
  • Insert or update embeddings and text into Supabase vector table using Insert Documents node.
  • From chat input, embed question text with embedding model in Embeddings OpenAI Retrieval.
  • Query Supabase vector table using match_documents to find most relevant chunks.
  • Pass retrieved chunks and the question to OpenAI chat model to answer.
  • Format and return answer to user via Webhook node.

Output

  • Clear, context-aware answer text from the book’s content matching the user’s question.

Who should use this workflow

This is for researchers, students, or anyone needing quick, reliable answers from big texts.
People frustrated by slow searches or scattered notes will find this useful.
You need basic skills to set up API keys and connections, but the workflow automates the hard parts.


Beginner step-by-step: How to use this workflow in n8n

Step 1: Get the workflow file

  1. Download the workflow file from this page using the “Download” button.
  2. Open your n8n editor where you want to add the workflow.
  3. Click “Import from File” and choose the downloaded workflow file.

Step 2: Configure the workflow

  1. Add your OpenAI API key in the credentials section.
  2. Enter your Google Drive API credentials so the workflow can download the book.
  3. Update the Google Drive fileId or URL if needed to point to your uploaded book file.
  4. Check Supabase credentials and confirm connection to database with pgvector extension.
  5. Adjust table names or SQL function names if you use a custom schema.
  6. Optional: edit the chat greeting message in the When chat message received node.

Step 3: Test and activate

  1. Run a test message through the chat webhook URL to see if it returns a meaningful answer.
  2. Fix any errors shown in n8n execution logs (check API keys, permissions, URLs).
  3. Once tested, toggle the workflow switch to activate it for real use.
  4. Start asking questions in your chat client connected to the webhook.

If interested in hosting the workflow yourself, consider using self-host n8n for stability and control.


Common issues and edge cases

No matching documents found error

This means the database doesn’t have data or vectors don’t match in size.
Check you inserted chunks and that your embedding model’s vector size (1536) matches the Supabase vector column.

Empty text after loading book

If the loader returns no text, your book file format may be unsupported or corrupt.
Try re-saving your book as EPUB and ensure the file permissions allow reading.

Permission denied errors with Supabase

Supabase security policies may block access.
Verify RLS policies for insert and select permission, and confirm API keys have needed roles.


Customization ideas

  • Change the embedding model in Embeddings OpenAI nodes if you want newer or different embeddings.
  • Modify Supabase table names in insertion or retrieval nodes to your own database tables.
  • Add functionality to delete vectors using Supabase REST API and HTTP Request node.
  • Edit the chat greeting message or instructions to match your style.
  • Adjust chunk size in text splitter to find balance between accuracy and performance.

Summary of benefits and results

✓ Cuts down search time from hours to seconds.
✓ Gives direct, context-aware answers from large texts.
✓ Removes errors caused by keyword-only searching.
✓ Easy to operate once set up, no deep programming needed.
✓ Works with open n8n platform and widely used services.


Automate Q&A with n8n and Supabase

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

The workflow uses the Google Drive node to download the book file and the Default Data Loader node to extract the book text from the file.
It breaks the book text into smaller chunks that can be embedded and searched efficiently.
The workflow embeds the question, queries the Supabase vector database using a match function, and retrieves the best matching text chunks.
Users should add API keys for OpenAI and Google Drive, update book file IDs or URLs, configure Supabase credentials, and test the workflow before activating.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.