Get notifications when specific keywords appear in Reddit posts.
This template will help you:
Reddit does not have an API that allows users to scrape data, so we are doing this with the Google Search API, Serp.
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.
To start using this template, fork this val by clicking the fork button at the top-right corner of the page.
The CODE
box shows you the the full source code of this val, you may need to scroll down to see it.
This template requires a SerpApi key to search Reddit posts via Google search results.
Get a SerpApi key:
Add the SerpApi key to your environment variables:
SERP_API_KEY
Without this key, the val will not function correctly.
In the CODE
box below, update the terms or phrases you want to track:
const KEYWORDS = ["val town", "val.town"];
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:
mentionsDiscord
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)