Build a labeled Reddit opinion dataset with Apify, OpenAI, and Supabase

Go to Workflow
0 views
Built by Apify Apify
Created on August 22, 2026

Description

Quick overview
This workflow runs weekly to scrape Reddit posts and comments via Apify, labels each comment’s reaction type with OpenAI, and stores structured rows plus OpenAI embeddings in Supabase tables for analysis and vector search.

How it works
Runs weekly on a schedule and loads dataset inputs like subreddits, sort order, time window, minimum score, and item limits.
Splits the subreddit plan into individual scrape jobs and uses the Apify Reddit Scraper actor to collect posts and their comments.
Filters and formats scraped posts into structured metadata rows and inserts them into a Supabase posts table.
Creates OpenAI embeddings for each post’s combined context text and inserts the vectors into a Supabase documents table.
Filters and formats scraped comments, then uses OpenAI (gpt-4.1-mini) to classify each comment into one reaction type.
Inserts labeled comments into a Supabase comments table and embeds the comment text into the Supabase documents table for vector search.

Setup
Add Apify API token credential.
Create a Supabase project, enable pgvector, create the posts, comments, and documents tables, and add a Supabase credential using your project URL and service_role key.
Add an OpenAI API credential for the classification and embedding steps.
Update the dataset parameters (subreddits list with per-subreddit max results, sort, time filter, minScore, and maxCommentsPerPost/maxItems) in the workflow’s input configuration before activating it.

Requirements
Apify, Supabase and OpenAI accounts

Nodes Used (6)

Code
n8n-nodes-base.code
Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader
Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi
OpenAI
@n8n/n8n-nodes-langchain.openAi
Supabase
n8n-nodes-base.supabase
Supabase Vector Store
@n8n/n8n-nodes-langchain.vectorStoreSupabase