FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
charmainetest
charmainetesttemplateRedditAlert
Remix of valdottown/templateRedditAlert
Public
Like
templateRedditAlert
Home
Code
2
README.md
C
main.tsx
Branches
1
Pull requests
Remixes
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 miliseconds.
Sign up now
Code
/
Code
/
Search
README.md

Reddit Keyword Alerts [TEMPLATE]

Get notifications when specific keywords appear in Reddit posts.

This template will help you:

  1. Search Reddit for specific keywords within a defined time range.
  2. Send notifications to your preferred platform (Discord, Slack, email, etc.)

Reddit does not have an API that allows users to scrape data, so we are doing this with the Google Search API, Serp.


Example

This val tracks mentions of "Val Town" and related terms on Reddit, filtering results from the last 7 days and sending alerts to a Discord webhook. Screenshot 2025-01-10 at 5.13.16 PM.png


Set Up

1. Fork this Val

To start using this template, fork this val by clicking the fork button at the top-right corner of the page. Screenshot 2025-01-10 at 1.22.10 PM.png


2. View Source Code

The CODE box shows you the the full source code of this val, you may need to scroll down to see it. image.png


3. Get a SerpApi Key

This template requires a SerpApi key to search Reddit posts via Google search results.

  1. Get a SerpApi key:

    • Sign up at SerpApi to create an account.
    • Generate an API key from your account dashboard.
  2. Add the SerpApi key to your environment variables:

    • Go to your Val Town environment variables.
    • Add a new key:
      • Key: SERP_API_KEY
      • Value: Your SERP API key.

Without this key, the val will not function correctly.


4. Customize Keyword

In the CODE box below, update the terms or phrases you want to track: const KEYWORDS = ["val town", "val.town"];


5. Set Up Your Notification Method

This template uses a Discord webhook for notifications. You can update this to your preferred platform:

Create a Discord webhook following this guide. Save your webhook URL in your Val Town environment variables:

  • Key: mentionsDiscord
  • Value: Your Discord webhook URL. Notifications will be sent using this function:
  await discordWebhook({
      url: Deno.env.get("mentionsDiscord"),
      content,
    });

To switch to another platform (e.g., Slack, email, or custom webhooks), replace the discordWebhook call with the appropriate integration ((e.g., @std/email, Slack, or anywhere else)


🎉 Congrats! You now have a val running that ensures you never miss another Reddit mention. 🎉


NOTE: Usage Limits

  • SerpApi: Free SerpApi accounts have monthly call limits.
Code
README.md
C
main.tsx
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.