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

sunnyatlightswitch

reddit-checker

Public
Like
1
reddit-checker
Home
Code
8
README.md
main.tsx
reddit-api-monitor.ts
C
reddit-monitor.ts
C
reddit-rss-monitor.ts
H
test-reddit-api.ts
H
test-reddit-monitor.ts
H
test-rss-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/21/2025
Viewing readonly version of main branch: v18
View latest version
README.md

Reddit Monitor

A comprehensive Reddit monitoring system that watches specific subreddits for posts containing target keywords and sends email notifications when matches are found.

Features

  • πŸ” Keyword Monitoring: Searches for specific keywords in post titles and content
  • πŸ“§ Email Notifications: Sends detailed email alerts when matches are found
  • ⏰ Scheduled Monitoring: Runs automatically via cron jobs
  • πŸ’Ύ State Management: Tracks last checked timestamps to avoid duplicate notifications
  • πŸ”„ Multiple Approaches: Supports both RSS feeds and official Reddit API

Current Setup

Target Configuration

  • Subreddit: r/lovable
  • Keywords: auth, authentication, login, signin, signup, oauth, jwt, token

Files

Main Monitoring Scripts

  1. reddit-rss-monitor.ts (Cron Job)

    • Uses Reddit RSS/Atom feeds
    • More reliable for basic monitoring
    • No API credentials required
    • Currently configured and ready to run
  2. reddit-api-monitor.ts (Cron Job - Needs Setup)

    • Uses official Reddit API
    • More detailed post data
    • Requires Reddit app credentials
    • Better rate limits and reliability

Test Scripts

  1. test-rss-monitor.ts (HTTP Endpoint)

    • Test RSS feed functionality
    • Endpoints:
      • /?action=test - Test keyword matching
      • /?action=status - Check last run status
      • /?action=reset - Reset timestamps
      • /?action=raw&subreddit=programming - View raw RSS
  2. test-reddit-api.ts (HTTP Endpoint)

    • Test Reddit API functionality
    • Endpoints:
      • /?action=help - Usage instructions
      • /?action=auth&client_id=YOUR_ID - Test authentication
      • /?action=test&client_id=YOUR_ID - Full functionality test
      • /?action=reset - Reset stored data

Legacy Files

  1. reddit-monitor.ts - Original JSON API attempt (blocked by Reddit)
  2. test-reddit-monitor.ts - Test for JSON API (blocked by Reddit)

Setup Instructions

Option 1: RSS Monitor (Ready to Use)

The RSS monitor is already configured and ready to run. It will:

  • Check r/lovable every time the cron job runs
  • Look for auth-related keywords
  • Send email notifications for matches
  • Track timestamps to avoid duplicates

Option 2: Reddit API Monitor (Requires Setup)

To use the more robust API monitor:

  1. Get Reddit App Credentials:

    • Go to https://www.reddit.com/prefs/apps
    • Create a new app (type: script)
    • Note the client ID (under app name)
    • Client secret is already configured: rX_YGngVjaxRA3Y0F3STl2cuEmgHkQ
  2. Test the Setup:

    /test-reddit-api.ts?action=auth&client_id=YOUR_CLIENT_ID
    
  3. Update the Monitor:

    • Edit reddit-api-monitor.ts
    • Replace 'your_client_id' with your actual client ID

Usage

Manual Testing

  • Test RSS: Visit /test-rss-monitor.ts?action=test
  • Test API: Visit /test-reddit-api.ts?action=test&client_id=YOUR_ID

Monitoring Status

  • RSS Status: /test-rss-monitor.ts?action=status
  • API Status: /test-reddit-api.ts?action=reset

Reset Timestamps

  • RSS Reset: /test-rss-monitor.ts?action=reset
  • API Reset: /test-reddit-api.ts?action=reset

Customization

Adding More Subreddits

Edit the CONFIG object in the monitor files:

const CONFIG: MonitorConfig = { subreddit: "lovable", // Change this keywords: ["auth", "authentication", ...], // Add more keywords lastChecked: 0 };

Changing Keywords

Update the keywords array in the CONFIG object.

Cron Schedule

The cron schedule needs to be set in the Val Town web UI after the files are created.

Email Notifications

When matches are found, you'll receive emails with:

  • πŸ“ Match summary
  • πŸ” Matched keywords
  • πŸ“ Post title and author
  • πŸ“Š Score and comment count
  • πŸ•’ Post timestamp
  • πŸ”— Direct link to Reddit post
  • πŸ“„ Content preview

Storage

The system uses Val Town's blob storage to track:

  • reddit_rss_monitor_last_checked - RSS monitor timestamp
  • reddit_api_monitor_last_checked - API monitor timestamp
  • reddit_access_token - Cached Reddit API token

Next Steps

  1. Provide Reddit Client ID to complete API setup
  2. Set Cron Schedule in Val Town UI for automatic monitoring
  3. Test Email Notifications to ensure they're working
  4. Customize Keywords based on your specific needs
  5. Add More Subreddits by creating additional monitor instances
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.