Automated Reddit Post Summarization and Knowledge Base Builder - n8n Workflow

Use this powerful n8n workflow to monitor saved Reddit posts, filter relevant content, summarize discussions using Google Gemini, and store structured data into a Supabase knowledge base. Perfect for content curators.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Content curators who need to distill insights from lengthy Reddit discussions.

  • Analysts building personalized knowledge bases based on specific subreddits.

  • Users looking for advanced examples of combining custom Code nodes with AI models in an n8n workflow.

  • Anyone seeking ready-to-use n8n templates for web scraping and AI processing.

Overview

Keeping track of important discussions across niche subreddits can be overwhelming. This specialized n8n workflow solves this problem by automating the entire research pipeline. It connects to your Reddit account to fetch saved posts, applies custom filters (using an n8n node and JavaScript) to ensure only relevant topics are processed, and crucially, prevents duplicates by checking Supabase first. The core value of this n8n automation lies in its ability to fetch all nested comments for a post, aggregate them with the main body, and then pass this complex data structure to the Google Gemini large language model (LLM). The LLM summarizes the conversation and extracts actionable tags, providing a structured, concise summary that is then saved to your Supabase database. This robust n8n workflow ensures your knowledge base is always up-to-date and organized.

How it Works

The n8n workflow begins with an n8n trigger, either the manual trigger when testing or the check once a day if new post are available schedule trigger.


  1. Preparation & Filtering: The n8n workflow first queries Supabase via the Get post data from supabase n8n node to retrieve IDs of already processed Reddit posts. It then fetches the last 10 saved posts from Reddit.

  2. Code Filtering: Custom Code nodes (extract relevant attribut and filter posts based on subreddit and further filtering existing posts wrt existing posts in database) filter the posts based on specific subreddit criteria and remove any post IDs already found in Supabase.

  3. Looping: The Loop Over Every Posts n8n node processes the remaining unique posts sequentially.

  4. Relevance Check (LLM 1): The first LLM (LLM1), powered by Google Gemini, performs a quick relevance check using a prompt. The If the condition is satisfied n8n node checks if the result is 'YES'.

  5. Data Aggregation: If relevant, the n8n workflow uses the get all comments for the current post n8n node. A custom Code n8n node (extract relevant attribut from comments) recursively cleans and structures the comment data, which is then aggregated with the post content into a single prompt input by the aggregate post and comment into a single text Code n8n node.

  6. Summarization (LLM 2): The LLM2 n8n node (Gemini) summarizes the aggregated text and extracts relevant tags, ensuring the output adheres to a specific JSON schema defined by the Structured Output Parser n8n node.

  7. Saving Data: The final structured object is prepared by the prepare data to be inserted in supabase Code n8n node and then inserted into the Supabase table using the insert new reddit post n8n node.

  8. Rate Limit Control: The Wait (rate limiting) n8n node introduces a necessary pause before the n8n trigger continues the loop to the next post.

Installation Guide

To install this robust n8n workflow, follow these steps:


  1. Import: Copy the provided n8n workflow JSON and import it directly into your n8n instance.

  2. Credentials Setup: You must configure credentials for the following n8n nodes:

Supabase: Set up your Supabase API key and Project URL for the Supabase account credential.
Reddit OAuth2: Configure your Reddit API credentials for the Reddit account to allow the n8n node to fetch posts and comments.
Google Gemini (PaLM) API: Provide your API key for the Google Gemini(PaLM) Api account credential, which is used by both LLM n8n nodes.

  1. Customization: Review the Code n8n nodes:

Update the extract relevant attribut and filter posts based on subreddit n8n node's JavaScript array (acceptedSubReddits and subredditKeywords) to define the filtering criteria for your posts.
* Adjust the prompts in the LLM1 and LLM2 n8n nodes to match your specific summarization and filtering needs. Note that LLM1 requires a custom condition check.

  1. Activation: Choose whether to use the manual n8n trigger for testing or activate the schedule n8n trigger for daily runs.

Node Details

Schedule Trigger / Manual Trigger: Acts as the initial n8n trigger, initiating the daily check or a manual test run.
Supabase (Get post data & insert new reddit post): This core n8n node manages the knowledge base, first retrieving existing reddit_posts IDs to prevent duplication and finally inserting the summarized data.
Reddit (get saved post & get all comments): These n8n node instances fetch the initial list of saved posts and then retrieve the full nested comment structure for each individual post.
Code (extract relevant attribut from comments): A crucial custom n8n node that uses recursive JavaScript logic to flatten and structure the deeply nested Reddit comment JSON, making it readable for the LLM.
Code (aggregate post and comment into a single text): Aggregates the post title, body, and all cleaned comments into a single string for high-quality LLM processing.
Google Gemini Chat Model (LLM Provider): The engine powering the AI functions. This n8n node connects the workflow to the Gemini-2.0-flash model for both filtering and summarization tasks.
Chain LLM (LLM1 & LLM2): These n8n node instances execute the complex AI tasks: filtering posts based on custom logic (LLM1) and generating structured summaries and tags (LLM2).
Structured Output Parser: An n8n node that guarantees the output from LLM2 is structured JSON, ensuring reliable data insertion into Supabase.


  • If: A flow control n8n node that decides whether to proceed with expensive summarization based on the relevance check performed by LLM1.

Related n8n Workflows

Free

Nodes: 12 Nodes
Updated: December 26 2025
View all
Created by
Fei Wu
Fei Wu

Featured*