π What This Workflow Does
This n8n workflow mines real Reddit conversations to generate 15 structured, AI-powered content ideas tailored to your niche, content format, and audience pain points β with built-in deduplication against your previously generated ideas.
π‘ No Reddit API needed. The workflow uses Perplexity AI's web search to find Reddit posts directly.
ποΈ Architecture
+--> Display Results (form response)
|
Form --> Find Subreddits --> Prepare Queries --> Search Posts --> Score --> Build Prompt --> Generate --> Parse --> Save --+
| ^ |
+--> Fetch Previous Ideas --------------------------------------------------+ +--> Build Email Summary --> Send Email
Two parallel branches run from the form trigger:
Branch | Purpose |
|---|---|
Main | Subreddit discovery β Reddit research β AI content generation |
Dedup | Fetches previously generated ideas from Google Sheets to avoid repeats |
π§© Node-by-Node Overview
# | Node | Type | Purpose |
|---|---|---|---|
1 | Content Idea Form | Form Trigger | Web form collecting niche, subreddits, search phrase, time range, content format |
2 | Find Subreddits | Perplexity | Discovers 5 relevant subreddits via AI (skipped if user provides their own) |
3 | Fetch Previous Ideas | Google Sheets | Reads existing ideas for deduplication |
4 | Prepare Search Queries | Code | Parses subreddits with 4-strategy fallback parser, builds search parameters |
5 | Search Reddit Posts | Perplexity | Searches each subreddit for pain-point posts with time range filtering |
6 | Score & Filter Posts | Code | Aggregates and labels results by subreddit |
7 | Build Prompt | Code | Constructs generation prompt with dedup list + format-specific instructions |
8 | Generate Article Ideas | OpenAI | Generates exactly 15 structured content ideas |
9 | Parse & Split Ideas | Code | Parses JSON response into individual row items |
10 | Save to Google Sheets | Google Sheets | Appends each idea as a row |
11 | Display Results | Code | Formats results for form completion page |
12 | Build Email Summary | Code | Aggregates all ideas into a single email body |
13 | Send a message | Gmail | Sends summary notification email |
π Credentials Required
# | Credential | Type | Used By | How to Get |
|---|---|---|---|---|
1 | Perplexity API | API Key | Find Subreddits, Search Reddit Posts | |
2 | OpenAI API | API Key | Generate Article Ideas | |
3 | Google Sheets OAuth2 | OAuth2 | Fetch Previous Ideas, Save to Google Sheets | console.cloud.google.com β Enable Sheets API β Create OAuth2 credentials |
4 | Gmail OAuth2 | OAuth2 | Send a message | console.cloud.google.com β Enable Gmail API β Create OAuth2 credentials |
β οΈ Important: Create all credentials through n8n's Credentials Manager (Settings β Credentials β Add). Never paste keys into code nodes.
π Step-by-Step Setup
Step 1: Import the Workflow
- Open your n8n instance
- Go to Workflows β Import from File
- Select
workflow.json - The workflow appears in your workspace (inactive)
Step 2: Create Credentials in n8n
Open Settings β Credentials β Add Credential for each:
Perplexity API
- Search for "Perplexity" in credential types
- Paste your API key from perplexity.ai/settings/api
- Save
OpenAI API
- Search for "OpenAI" in credential types
- Paste your API key from platform.openai.com/api-keys
- Save
Google Sheets OAuth2
- Search for "Google Sheets OAuth2" in credential types
- Follow the OAuth2 flow to connect your Google account
- Ensure the Google Sheets API is enabled in your Google Cloud Console
- Save
Gmail OAuth2
- Search for "Gmail OAuth2" in credential types
- Follow the OAuth2 flow to connect your Gmail account
- Ensure the Gmail API is enabled in your Google Cloud Console
- Save
Step 3: Attach Credentials to Nodes
Open each node and select your saved credential:
Node | Credential to Attach |
|---|---|
Find Subreddits | Perplexity API |
Search Reddit Posts | Perplexity API |
Generate Article Ideas | OpenAI API |
Fetch Previous Ideas | Google Sheets OAuth2 |
Save to Google Sheets | Google Sheets OAuth2 |
Send a message | Gmail OAuth2 |
Step 4: Set Up Google Sheets
- Create a new Google Spreadsheet
- Add these column headers in Row 1:
A | B | C | D | E | F | G | H | I |
|---|---|---|---|---|---|---|---|---|
Timestamp | Niche | Content Format | Category | Title | Description | Addresses | Unique Angle | Source Subreddits |
- Copy the spreadsheet ID from the URL:
- Update the document ID in both Google Sheets nodes:
- Fetch Previous Ideas β Document ID
- Save to Google Sheets β Document ID
Step 5: Configure Email Recipient
- Open the "Send a message" (Gmail) node
- Update
sendTowith your email address
Step 6: Verify the AI Model
- Open the "Generate Article Ideas" node
- Confirm the model is set to a valid OpenAI model (e.g.,
gpt-4o-miniorgpt-4o)
β οΈ The workflow JSON may referencegpt-5-miniβ this is not a publicly available model. Change it togpt-4o-minifor reliable results.
Step 7: Activate & Test
- Toggle the workflow to Active
- Copy the form URL shown in the "Content Idea Form" trigger node
- Open the URL in your browser
- Submit a test with your niche β ideas appear on the form page + email + Google Sheets
π Form Fields
Field | Type | Required | Description |
|---|---|---|---|
Niche | Text | β | Your content niche (e.g., "productivity for creative professionals") |
Subreddits (Optional) | Text | β | Comma-separated subreddit names. Leave empty for AI discovery |
Search Phrase | Dropdown | β | Single phrase or "All (Top 5 Phrases - Recommended)" |
Time Range | Dropdown | β | Past Month, Past Week, or Past Day |
Content Format | Dropdown | β | Blog Articles, YouTube Videos, Twitter/X Threads, or Newsletter Topics |
π Content Idea Categories
Each run generates exactly 15 ideas:
Category | Count | Description |
|---|---|---|
How-to | 5 | Step-by-step guides addressing specific problems |
List | 5 | Curated collections and roundups |
Deep Dive | 3 | In-depth analysis of complex topics |
Framework | 2 | Actionable systems and mental models |
π Available Search Phrases
Phrase | Best For |
|---|---|
All (Top 5 Phrases - Recommended) | Comprehensive search using 5 phrases simultaneously |
How can I | Direct problem-solving questions |
How do you | Seeking peer advice |
I'm struggling with | Expressed frustrations |
I can't stand | Strong pain points |
Tips | Advice-seeking posts |
Suggestions | Open-ended recommendations |
Biggest challenge | Core struggles |
Biggest struggle | Deep frustrations |
Help me | Urgent needs |
Hardest part | Difficulty spots |
Can someone help | Community support |
Figure out | Problem-solving attempts |
Suggest | Recommendations |
Biggest challenges | Broad pain points |
Struggle with | Ongoing difficulties |
π¨ Content Format Adaptations
The AI prompt adapts based on your selected format:
Format | Adaptation |
|---|---|
Blog Articles | SEO-friendly headlines, long-form structure |
YouTube Videos | Click-worthy titles, suggested 30-second hook in description |
Twitter/X Threads | Punchy titles under 100 chars, suggested opening tweet |
Newsletter Topics | Email subject lineβstyle titles, key takeaway angles |
β¨ Key Features
Feature | Description |
|---|---|
π€ Auto Subreddit Discovery | AI finds 5 relevant subreddits when none are provided |
π Multi-Phrase Search | "All Top 5 Phrases" option searches 5 pain-point phrases simultaneously |
β±οΈ Time Range Control | Filter Reddit posts by Past Day, Past Week, or Past Month |
π― Content Format Adaptation | Tailored prompts for 4 different content formats |
π« Deduplication | Reads existing ideas from Google Sheets to prevent repeats |
π§ Email Notification | Single aggregated summary email with all ideas grouped by category |
π‘οΈ Error Resilience | Graceful error handling on all external API nodes |
π§ Robust Parsing | 4-strategy subreddit parser handles various AI response formats |
π§ Customization Options
Change the Number of Ideas
Edit the prompt in the "Build Prompt" Code node. Modify:
Generate exactly 15 content ideas:
- 5 "How-to" pieces
- 5 "List" pieces
- 3 "Deep Dive" pieces
- 2 "Framework" pieces
Add More Search Phrases
- Edit the form dropdown options in the "Content Idea Form" trigger
- Update the phrase array in the "Prepare Search Queries" Code node
Change the AI Model
Update the modelId in the "Generate Article Ideas" node.
Disable Email Notifications
Disable the "Send a message" node in the n8n UI. The workflow will still save to Sheets and display results.
π Troubleshooting
Problem | Solution |
|---|---|
No subreddits found | Workflow falls back to r/AskReddit. Try a more specific niche or provide subreddits manually. |
JSON parse errors in ideas | The Parse & Split Ideas node has fallback handling. Check the OpenAI model is responding with valid JSON. |
Google Sheets permission error | Re-authorize Google Sheets OAuth2 in n8n Credentials. Ensure the Sheets API is enabled. |
Email not sending | Re-authorize Gmail OAuth2. Check the |
Model not found error | Change |
Deduplication not working | Ensure the "Fetch Previous Ideas" node points to the correct sheet and has the right column headers. |
Form URL not showing | Make sure the workflow is Active before copying the form URL. |
π‘ Pro Tips
- Start with "All (Top 5 Phrases)" β gives the broadest coverage of audience pain points
- Use "Past Month" for established niches, "Past Week" for trending topics
- Run weekly to build a content calendar β deduplication prevents repeats automatically
- Try different content formats for the same niche β you'll get different angles each time
- Provide specific subreddits if you already know your audience's communities for more targeted results
π Output Structure
Each idea saved to Google Sheets includes:
Column | Description |
|---|---|
Timestamp | ISO 8601 generation timestamp |
Niche | The niche submitted in the form |
Content Format | Selected content format |
Category | How-to, List, Deep Dive, or Framework |
Title | Content headline/title |
Description | One-line overview of the content piece |
Addresses | Specific problem or pain point solved |
Unique Angle | What makes this idea different |
Source Subreddits | Comma-separated list of subreddits used |
FULL JSON Code
|
Made with β€οΈ using n8n + Perplexity AI + OpenAI
