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

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

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

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.


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 Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free