Who is this workflow for? This workflow enables the creation of a Retrieval-Augmented Generation (RAG) system using live data from Notion as a knowledge base. It automatically updates embeddings in a Supabase Vector Store whenever a Notion page is modified, ensuring that your RAG system remains current with the latest information..

What does this workflow do?

1. Monitoring Notion Database Changes

A trigger node polls the Notion Database every minute to detect any updates. This manual polling approach ensures high accuracy and prevents missing changes between intervals.

2. Processing Updated Pages

Each updated Notion page is processed one after the other to maintain order and ensure consistency in the workflow.

3. Managing Vector Store Entries

The workflow searches the Supabase Vector Store using the Notion Page ID from the embedding metadata. If existing entries are found, they are deleted to avoid duplication.

4. Retrieving and Combining Content

All blocks from the updated Notion page are retrieved and concatenated into a single string, preparing the content for embedding.

5. Embedding and Storing Content

The combined content is embedded into vectors. If necessary, the content is split into manageable chunks. Metadata, including the Notion Page ID, is attached to each embedding before storage in the Supabase Vector Store.

6. Enabling Q&A Functionality

A simple Question and Answer Chain is integrated, allowing users to query the embedded content through a chat interface, leveraging the updated vector store for accurate responses.

  • Supabase Vector Store: Follow Supabase’s guide to set up a new Vector Store.
  • Notion Database: Prepare a Notion Database with each page containing at least a title and content blocks. You can also integrate this with an existing database of your choice.
  • Configure Credentials: Select your credentials in the necessary nodes within n8n.
  • n8n Cloud Plans: If using an n8n cloud plan, activate the native Notion Trigger and deactivate the Schedule Trigger along with its associated Notion Node.
  • Select Notion Database: Choose your specific Notion Database in the initial Notion-related node.
  • Adjust Token Splitter Settings: Modify the chunk size and overlap in the Token Splitter node to suit your preferences.
  • Activate Workflow: Enable the workflow to start monitoring and processing updates.

Populate your Notion Database with relevant information. Use the integrated chat function to ask questions about the content. Any updates to Notion pages will be quickly reflected in the chat responses, ensuring that your queries are always based on the latest data.

🤖 Why Use This Automation Workflow?

  • Real-Time Data Updates: Automatically syncs changes from Notion to the vector store, ensuring up-to-date embeddings.
  • Scalable Vector Storage: Utilizes Supabase Vector Store, with flexibility to adapt to other vector databases like PGVector, Pinecone, or Qdrant.
  • Seamless Integration: Combines Notion’s user-friendly interface with powerful vector search capabilities for efficient knowledge management.

👨‍💻 Who is This Workflow For?

  • Knowledge Managers: Individuals managing large databases of information who need efficient search and retrieval.
  • Developers: Professionals looking to implement RAG systems with minimal setup using n8n.
  • Teams: Organizations that rely on Notion for documentation and require automated, real-time updates to their knowledge base.

🎯 Use Cases

  1. Customer Support: Maintain an up-to-date knowledge base that support agents can query for accurate information.
  2. Content Management: Automatically update and search through large volumes of content, such as articles or documentation.
  3. Research Databases: Manage and retrieve research papers or data efficiently with real-time updates.

TL;DR

This workflow automates the synchronization of Notion pages with a Supabase Vector Store, enabling the creation of a dynamic RAG system. By ensuring that embeddings are always up-to-date with the latest Notion data, it provides a reliable and efficient solution for managing and querying large knowledge bases.

Help us find the best n8n templates

About

A curated directory of the best n8n templates for workflow automations.