• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
sunnyatlightswitch

sunnyatlightswitch

reddit-checker

Public
Like
1
reddit-checker
Home
Code
11
README.md
H
config-manager.ts
reddit-api-monitor.ts
reddit-monitor.ts
reddit-rss-monitor.ts
H
test-main-monitor.ts
H
test-reddit-api.ts
H
test-reddit-monitor.ts
H
test-rss-monitor.ts
H
test-slack.ts
H
unified-reddit-monitor.ts
Branches
1
Pull requests
Remixes
1
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
6/24/2025
Viewing readonly version of main branch: v64
View latest version
README.md

Unified Reddit Monitor

A simplified, comprehensive Reddit monitoring system that consolidates all monitoring functionality into a single script. No more cron jobs or constant notifications!

πŸš€ Features

  • Unified Monitoring: Single script handles all Reddit monitoring
  • Multiple Methods: Uses Reddit API with JSON and RSS fallbacks for reliability
  • Multi-Subreddit Support: Monitors 11 subreddits simultaneously
  • Dual Notifications: Sends both Slack and email notifications
  • Manual Execution: Run only when you want - no automated scheduling
  • Robust Error Handling: Continues monitoring even if some subreddits fail
  • Comprehensive Logging: Detailed console output for debugging

πŸ“ Simplified Project Structure

β”œβ”€β”€ unified-reddit-monitor.ts  # 🎯 MAIN SCRIPT - Run this manually (HTTP) βœ… READY
β”œβ”€β”€ test-reddit-api.ts         # API testing tool (HTTP) - Legacy
β”œβ”€β”€ test-main-monitor.ts       # Manual testing tool (HTTP) - Legacy  
β”œβ”€β”€ test-slack.ts              # Slack webhook testing tool (HTTP) - Legacy
β”œβ”€β”€ config-manager.ts          # Configuration management (HTTP) - Legacy
β”œβ”€β”€ reddit-api-monitor.ts      # Old API monitor (NO CRON) - Legacy
β”œβ”€β”€ reddit-monitor.ts          # Old JSON monitor (NO CRON) - Legacy
β”œβ”€β”€ reddit-rss-monitor.ts      # Old RSS monitor (NO CRON) - Legacy
β”œβ”€β”€ test-rss-monitor.ts        # RSS testing tool (HTTP) - Legacy
└── README.md                  # This file

🎯 How to Use

Run the Monitor (Manual Execution)

Simply visit the HTTP endpoint to run the monitor:

GET /unified-reddit-monitor.ts

Available Actions

GET /unified-reddit-monitor.ts?action=run      # Run the monitor (default)
GET /unified-reddit-monitor.ts?action=status   # Show current configuration
GET /unified-reddit-monitor.ts?action=reset    # Reset last checked timestamp
GET /unified-reddit-monitor.ts?action=help     # Show help information

βš™οΈ Configuration

Current Settings βœ… CONFIGURED

  • Subreddits:
    • r/lovable
    • r/AppBusiness
    • r/appdev
    • r/AppDevelopers
    • r/ChatGPTCoding
    • r/indiehackers
    • r/microsaas
    • r/replit
    • r/ReplitBuilders
    • r/vibecoding
    • r/ViralApps
  • Keywords:
    • Authentication: auth, authentication, login, user sessions
    • Monetization: stripe, subscriptions, monetization, paywall, feature gating
    • Analytics: analytics
    • Business: how do I make money with my app
  • Check Frequency: Configurable via cron schedule (set in Val Town UI)
  • Post Limit: 25 posts per subreddit per check

Reddit API Credentials βœ… CONFIGURED

  • Client ID: 151sZ8h5TaHVZGZZn0rOhA
  • Client Secret: rX_YGngVjaxRA3Y0F3STl2cuEmgHkQ

πŸ”§ Usage

Automatic Monitoring βœ… READY

The main monitor (reddit-api-monitor.ts) runs automatically as a cron job. To configure the schedule:

  1. Go to the Val Town web UI
  2. Find the reddit-api-monitor.ts file
  3. Edit the cron schedule as needed (recommended: every 15-30 minutes)

Manual Testing βœ… WORKING

Test Reddit API Connection

GET /test-reddit-api.ts?action=help

Test Authentication βœ… VERIFIED

GET /test-reddit-api.ts?action=auth&client_id=151sZ8h5TaHVZGZZn0rOhA

Test Full Functionality βœ… VERIFIED (Multi-subreddit support added)

GET /test-reddit-api.ts?action=test&client_id=151sZ8h5TaHVZGZZn0rOhA&subreddit=lovable

Run Monitor Manually βœ… WORKING (Now monitors 11 subreddits)

GET /test-main-monitor.ts?action=run

Test Slack Integration βœ… WORKING

GET /test-slack.ts?action=simple    # Send simple test message
GET /test-slack.ts?action=reddit    # Send mock Reddit post notification  
GET /test-slack.ts?action=error     # Send mock error notification
GET /test-slack.ts?action=help      # Show usage information

Reset Stored Data

GET /test-reddit-api.ts?action=reset

πŸ“± Slack Notifications βœ… CONFIGURED

When matches are found, you'll receive a Slack message with:

  • Header: 🚨 Reddit Monitor Alert: X new matching posts in Y subreddits (or specific subreddit if only one)
  • Rich Attachments for each matching post including:
    • Post title (clickable link to Reddit)
    • Matched keywords
    • Author information
    • Score and comment count
    • Publication date
    • Content preview
    • Subreddit footer (shows which subreddit the post came from)

Webhook URL: https://hooks.slack.com/services/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

πŸ” Monitoring Details

What Gets Monitored

  • Post Titles: Full text search for keywords across all subreddits
  • Post Content: Self-text content of posts across all subreddits
  • Frequency: Based on cron schedule (configurable)
  • Scope: New posts since last check across all monitored subreddits
  • Subreddits: Currently monitoring 11 subreddits simultaneously

Keyword Matching βœ… TESTED

  • Case-insensitive matching
  • Partial word matching (e.g., "auth" matches "authentication")
  • Multiple keyword detection per post
  • Configurable keyword list

Recent Test Results: System updated to monitor 11 subreddits simultaneously

πŸ› οΈ Customization

Adding New Keywords

Edit the CONFIG object in reddit-api-monitor.ts:

const CONFIG: MonitorConfig = { subreddits: [ "lovable", "AppBusiness", "appdev", "AppDevelopers", "ChatGPTCoding", "indiehackers", "microsaas", "replit", "ReplitBuilders", "vibecoding", "ViralApps" ], keywords: ["auth", "authentication", "login", "signin", "signup", "oauth", "jwt", "token", "YOUR_NEW_KEYWORD"], lastChecked: 0 };

Adding New Subreddits

Add new subreddits to the subreddits array in the CONFIG object:

const CONFIG: MonitorConfig = { subreddits: [ "lovable", "AppBusiness", "appdev", "AppDevelopers", "ChatGPTCoding", "indiehackers", "microsaas", "replit", "ReplitBuilders", "vibecoding", "ViralApps", "YOUR_NEW_SUBREDDIT" ], keywords: ["your", "keywords", "here"], lastChecked: 0 };

Adjusting Post Limit

Modify the limit parameter in the fetchSubredditPosts function call:

const posts = await fetchSubredditPosts(subreddit, 50); // Check 50 posts per subreddit instead of 25

πŸ” Security

  • Reddit API credentials are configured and working
  • Access tokens are cached and automatically refreshed
  • All API calls use proper authentication headers

βœ… System Status

Current Status: FULLY OPERATIONAL WITH MULTI-SUBREDDIT SUPPORT

  • βœ… Reddit API authentication working
  • βœ… Post fetching functional across multiple subreddits
  • βœ… Keyword matching operational
  • βœ… Slack notifications configured and tested
  • βœ… Timestamp tracking working
  • βœ… Multi-subreddit monitoring (11 subreddits)
  • βœ… All Slack webhook formats working (simple, Reddit posts, errors)

Next Steps

  1. Set Cron Schedule: Configure the automatic run frequency in Val Town UI
  2. Monitor Slack: Check for notification messages when matches are found across all subreddits
  3. Customize as Needed: Adjust keywords or add/remove subreddits based on requirements

πŸ› Troubleshooting

Common Issues

  1. Authentication Errors

    • βœ… Resolved: Credentials are properly configured
  2. No Matches Found

    • βœ… Verified: System successfully finds matches (tested with 4 matches)
  3. Email Not Received

    • Check spam folder
    • Verify Val Town email configuration
    • Check monitor logs for errors

Debug Tools βœ… ALL WORKING

  • Use test-reddit-api.ts to verify API connectivity
  • Use test-main-monitor.ts to run the monitor manually
  • Check Val Town logs for detailed error information

πŸ“Š Recent Test Results

  • API Connection: βœ… Successful
  • Authentication: βœ… Working
  • Post Fetching: βœ… Retrieved posts from multiple subreddits
  • Keyword Matching: βœ… Found matches with updated keyword list
  • Multi-Subreddit Support: βœ… Now monitoring 11 subreddits simultaneously
  • Slack Integration: βœ… All notification types working
    • Simple messages: βœ… Working
    • Reddit post notifications: βœ… Working with subreddit identification
    • Error notifications: βœ… Working

πŸ”„ Backup Options

The project includes an RSS-based monitor (reddit-rss-monitor.ts) as a backup option if the API approach encounters issues. The RSS monitor has similar functionality but uses Reddit's RSS feeds instead of the official API.

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
Β© 2025 Val Town, Inc.