Analytics Advanced

Build a Labeled Reddit Opinion Dataset

A weekly n8n workflow that scrapes Reddit posts and comments with Apify, classifies each comment's reaction type with OpenAI, and saves structured rows plus embeddings in Supabase for analysis and vector search.

At a glance

Build a Labeled Reddit Opinion Dataset is an advanced-level analytics automation built with n8n. Scrape Reddit weekly, label comment reactions with OpenAI, and store vectors in Supabase.

Tools required
n8n
Tags
#reddit #apify #openai #supabase #vector-search
Difficulty
Advanced
Published
· 2 min read

How It Works

This workflow builds a growing dataset of Reddit opinions. Once a week it scrapes posts and comments from a list of subreddits with the Apify Reddit Scraper, asks OpenAI to label the reaction type of every comment, and writes the results to Supabase. Posts and comments land in their own tables, and OpenAI embeddings of both go into a documents table so the dataset supports vector search as well as SQL analysis.

Setup Steps

  1. Connect Apify: Add your Apify API token as a credential in n8n so the workflow can run the Reddit Scraper actor.
  2. Prepare Supabase: Create a Supabase project, enable the pgvector extension, and create the posts, comments, and documents tables.
  3. Add the Supabase Credential: Connect n8n to Supabase with your project URL and service_role key.
  4. Connect OpenAI: Add an OpenAI API credential; it powers both the comment classification and the embedding steps.
  5. Set the Dataset Parameters: Edit the input configuration with your subreddits and per-subreddit max results, sort order, time filter, minScore, and maxCommentsPerPost or maxItems.
  6. Activate the Workflow: Turn the workflow on so the weekly schedule starts collecting data.

Automation Workflow

Weekly Schedule Trigger
↓
Load dataset inputs (subreddits, sort, time window, min score, limits)
↓
Split subreddit plan into individual scrape jobs
↓
Apify Reddit Scraper → posts and comments
↓
Posts branch:
  Filter and format posts → Supabase "posts" table
  ↓
  OpenAI embeddings of post context → Supabase "documents" table
↓
Comments branch:
  Filter and format comments → OpenAI gpt-4.1-mini reaction label
  ↓
  Supabase "comments" table → OpenAI embeddings → Supabase "documents" table

Benefits

Advanced Features

Use Cases

Related Automations