1. Opening Problem Statement ⚙️
Meet Sarah, a content manager at a growing tech startup. Every week, Sarah curates valuable insights, meeting notes, and project documentation inside Notion. However, searching through these pages manually is time-consuming and inefficient. She often spends hours each week copying relevant content into her company’s database, losing precious time she could spend on strategic tasks.
Sarah needs an automated solution to seamlessly capture new Notion pages, convert their textual content into searchable vectors, and store them in a powerful database like Supabase with vector search capabilities. Without it, the company faces slow knowledge retrieval, repeated manual work, and risks losing crucial information in scattered documents.
This automation is precisely what Sarah needs to save at least 3-5 hours weekly and improve data accessibility significantly.
2. What This Automation Does
This n8n workflow automates how new Notion pages are processed and stored as vector embeddings in Supabase, powered by OpenAI’s embedding model. When a page is added to a specific Notion database, this workflow:
- Monitors your Notion database for new pages automatically every minute.
- Retrieves all block content from the new page, focusing only on text (excluding images and videos).
- Concatenates the textual blocks into a single summary text to prepare for embedding.
- Generates vector embeddings of the content using OpenAI’s advanced AI model.
- Creates metadata including the page ID, creation time, and title for context.
- Stores both the content and its vector embedding in a Supabase table with vector columns for fast, semantic search usability.
By automating these steps, this workflow saves hours of manual work weekly and empowers more intelligent search and retrieval capabilities in your data.
3. Prerequisites ⚙️
- 🔑 n8n account (self-hosted or cloud). Self-hosting is an option — check out buldrr.com/hostinger for affordable hosting.
- 📁 A Notion account with a configured Notion database for your pages.
- 🔑 OpenAI API key to generate embeddings.
- 📊 Supabase project with a table configured to include a vector column (see Supabase Vector Columns Guide).
4. Step-by-Step Guide to Build This Workflow
Step 1: Set Up the Notion Page Added Trigger
Go to your n8n workflow editor and add a Notion Trigger node named Notion – Page Added Trigger.
- Click + Add Node → search for Notion Trigger and add it.
- In its settings, connect your Notion credentials.
- Set it to monitor the specific Notion
databaseIdwhere you add new pages. - Configure it to poll every minute to detect new page additions.
You should see your Notion database ID set and the node ready to trigger on new pages.
Common Mistake: Forgetting to select the exact Notion database will cause no triggers to fire.
Step 2: Retrieve the Full Content of the New Page
Add a Notion node named Notion – Retrieve Page Content next.
- Set the
blockIdparameter to pull from the URL of the newly triggered Notion page with= {{$json.url}}. - Choose the operation
getAllfor resource type block to get the entire content. - Enable returnAll to fetch all blocks.
This fetches the detailed contents inside the page for processing.
Common Mistake: Using the wrong field for blockId will cause the content retrieval to fail.
Step 3: Filter Out Media Blocks
Add a Filter node named Filter Non-Text Content.
- Configure the filter to exclude blocks where the
typefield isimageorvideo. - This focuses the workflow only on text blocks that can be meaningfully embedded.
Common Mistake: Forgetting to exclude these media types leads to errors downstream when generating embeddings.
Step 4: Concatenate Text Blocks into a Summary
Add a Summarize node called Summarize – Concatenate Notion’s blocks content.
- Set it to concatenate the
contentfield from each block separated by newline characters. - This creates a single large string to pass to the embedding generator.
Common Mistake: Not aggregating the content properly will result in partial or incomplete embeddings.
Step 5: Split Text into Chunks for Embedding
Add the Token Splitter node (n8n Langchain Text Splitter Token Splitter).
- Configure chunk size to 256 tokens with an overlap of 30 tokens to maintain context.
- Splitting the text helps the OpenAI embedding process handle large documents efficiently.
Common Mistake: Setting chunk size too large may cause API errors; too small can lose context.
Step 6: Create Metadata and Prepare Document Content
Add the Document Default Data Loader node named Create metadata and load content.
- Map metadata fields such as pageId (
={{$('Notion - Page Added Trigger').item.json.id}}), createdTime, and pageTitle from the Notion trigger. - Pass the concatenated text content to the document loader in expression mode.
Common Mistake: Improper metadata mapping can cause loss of essential context in Supabase.
Step 7: Generate Embeddings with OpenAI
Add the OpenAI Embeddings node from Langchain called Embeddings OpenAI.
- Connect this node to the token-split document loader.
- Ensure your OpenAI API key is connected.
- This node sends each text chunk to OpenAI for embedding vector generation.
Common Mistake: Missing API key or incorrect node connection leads to failed embeddings.
Step 8: Store the Vector Documents in Supabase
Add the Supabase Vector Store node from Langchain.
- Configure it to insert mode, select your Supabase table with the vector column (e.g., called
documents). - Pass the embeddings and metadata to store searchable vectors.
Common Mistake: Wrong table name or missing vector column configuration in Supabase will cause insertion errors.
5. Customizations ✏️
- Change Filtering Criteria: In the Filter Non-Text Content node, add other types like
pdforaudioto exclude additional media as needed. - Adjust Chunk Sizes: Edit the Token Splitter node’s
chunkSizeandchunkOverlapvalues to optimize for different document sizes or API limits. - Add Additional Metadata: In the Create metadata and load content node, add new metadata fields like author name or tags by mapping corresponding Notion page properties.
- Change Polling Interval: Modify the Notion – Page Added Trigger node to poll every 5 minutes instead of every minute to reduce API calls and improve efficiency.
6. Troubleshooting 🔧
Problem: “No pages are detected by Notion Trigger.”
Cause: The Notion database ID is incorrect or credentials aren’t connected properly.
Solution: Double-check your Notion database ID and reauthorize credentials in the Notion Trigger node.
Problem: “Embeddings OpenAI node fails with API error.”
Cause: API key might be missing, expired, or quota exceeded.
Solution: Verify your OpenAI API key in credentials, renew if needed, and ensure usage limits are not exceeded.
Problem: “Supabase insertion errors or missing vector data.”
Cause: Supabase table lacks vector column or incorrect table name.
Solution: Ensure the Supabase table has a vector column and update the node with the correct table name.
7. Pre-Production Checklist ✅
- Verify your Notion database ID is correct and accessible.
- Test the workflow by adding a new page to the Notion database.
- Check that the Filter node correctly excludes images and videos.
- Confirm that embeddings generate without errors and store properly in Supabase.
- Back up your Supabase table schema before deploying for safety.
8. Deployment Guide
Once confirmed, activate your workflow by toggling it to active in n8n.
The workflow will poll Notion every minute for new pages automatically.
Monitor your execution logs in n8n to catch errors or failures.
Set up alerts in Supabase or n8n for failure notifications if needed.
9. FAQs
- Can I use Airtable instead of Notion? This workflow specifically uses the Notion Trigger node, so Airtable integration would require node replacement and workflow redesign.
- Does this workflow consume OpenAI API credits? Yes, every text chunk embedding consumes OpenAI credits based on your usage.
- Is my data safe in Supabase? Supabase uses encrypted connections and secure cloud storage, but always configure your access policies properly.
- Can this handle large Notion databases? Yes, but polling frequency and chunk sizes should be optimized to avoid rate limits.
10. Conclusion
By following this unique n8n workflow, you will automatically store new Notion pages as vector documents in Supabase, enriched with OpenAI embeddings. This setup eliminates hours of manual importing work and creates a searchable, semantic data reservoir ready for advanced queries.
You can now easily find important information, speed up decision-making, and keep your team’s knowledge organized and accessible.
Next steps could include building search interfaces on top of this data, adding alerting for important content changes, or expanding to other content types like PDFs or emails for a complete knowledge management system.
Start automating your Notion page vector storage today and unlock smarter data workflows!