Skip to main content

Upsert huge documents in a vector store with Supabase and Notion

Workflow preview

Workflow preview
100%
Upsert huge documents in a vector store with Supabase and Notion preview
Open on n8n.io

Important notice

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

1. Workflow Overview

Purpose This workflow adds the capability to build a RAG on living data. In this case Notion is used as a Knowledge Base. Whenever a page is updated, the embeddings get upserted in a Supabase Vecto...

Best for

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

Tools used

@n8n/n8n-nodes-langchain.embeddingsopenai, @n8n/n8n-nodes-langchain.textsplittertokensplitter, n8n-nodes-base.splitinbatches, @n8n/n8n-nodes-langchain.chainretrievalqa, @n8n/n8n-nodes-langchain.retrievervectorstore, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.chattrigger, n8n-nodes-base.scheduletrigger

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Upsert huge documents in a vector store with Supabase and Notion
Workflow name
Upsert huge documents in a vector store with Supabase and Notion

Purpose

This workflow adds the capability to build a RAG on living data. In this case Notion is used as a Knowledge Base. Whenever a page is updated, the embeddings get upserted in a Supabase Vector Store.

It can also be fairly easily adapted to PGVector, Pinecone, or Qdrant by using a custom HTTP request for the latter two.

Demo

How it works

  • A trigger checks every minute for changes in the Notion Database. The manual polling approach improves accuracy and prevents changes from being lost between cached polling intervals.
  • Afterwards every updated page is processed sequentially
  • The Vector Database is searched using the Notion Page ID stored in the metadata of each embedding. If old entries exist, they are deleted.
  • All blocks of the Notion Database Page are retrieved and combined into a single string
  • The content is embedded and split into chunks if necessary. Metadata, including the Notion Page ID, is added during storage for future reference.
  • A simple Question and Answer Chain enables users to ask questions about the embedded content through the integrated chat function

Prerequisites

  • To setup a new Vector Store in Supabase, follow this guide
  • Prepare a simple Database in Notion with each Database Page containing at least a title and some content in the blocks section. You can of course also connect this to an existing Database of your choice.

Setup

  • Select your credentials in the nodes which require those
  • If you are on an n8n cloud plan, switch to the native Notion Trigger by activating it and deactivating the Schedule Trigger along with its subsequent Notion Node
  • Choose your Notion Database in the first Node related to Notion
  • Adjust the chunk size and overlap in the Token Splitter to your preference
  • Activate the workflow

How to use

Populate your Notion Database with useful information and use the chat mode of this workflow to ask questions about it. Updates to a Notion Page should quickly reflect in future conversations.

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 - Embeddings OpenAI

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

Block 2 - Token Splitter

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

Block 3 - Loop Over Items

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

Block 4 - Question and Answer Chain

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

Block 5 - Vector Store Retriever

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

Block 6 - OpenAI Chat Model

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

Block 7 - When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.1

Block 8 - Schedule Trigger

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

Block 9 - Sticky Note

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

Block 10 - Limit

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

Block 11 - Limit1

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

Block 12 - Delete old embeddings if exist

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

Block 13 - Get page blocks

Type / Role
n8n-nodes-base.notion - notion
Config choices
Version 2.2

Block 14 - Default Data Loader

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

Block 15 - Sticky Note1

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

Block 16 - Input Reference

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

Block 17 - Notion Trigger

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

Block 18 - Get updated pages

Type / Role
n8n-nodes-base.notion - notion
Config choices
Version 2.2

Block 19 - Sticky Note23

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

Block 20 - Sticky Note24

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

Block 21 - Sticky Note25

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

Block 22 - Sticky Note26

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

Block 23 - Sticky Note27

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

Block 24 - Sticky Note28

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

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

3. Summary Table

Workflow Upsert huge documents in a vector store with Supabase and Notion
Complexity advanced
Nodes 34
Categories Internal Wiki, AI RAG
Author Mario
Published 24 Nov 2024

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/2568/2568.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 Upsert huge documents in a vector store with Supabase and Notion do?

Purpose This workflow adds the capability to build a RAG on living data. In this case Notion is used as a Knowledge Base. Whenever a page is updated, the embeddings get upserted in a Supabase Vecto...

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.