• Townie
    AI
  • Blog
  • Docs
  • Pricing
Log inSign up
charmaine

charmaine

twitterAlert

Remix of stevekrouse/twitterAlert
Public
Like
twitterAlert
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 milliseconds.
Sign up now
Code
/
Code
/
Search
README.md

Twitter/𝕏 Keyword Alerts

Get custom notifications when you, your company, or anything you care about is mentioned on Twitter/X, even if they don't tag you directly.

This template will help you:

  1. Search for specific mentions on Twitter/X using customizable keywords.
  2. Deliver notifications wherever you'd like (email, Discord, Slack, Telegram, etc).

Example

This example tracks mentions of "valtown" and related terms, excluding noise like retweets and irrelevant accounts. Notifications are sent to a Discord webhook but can be easily reconfigured for other platforms.


Set Up

1. Fork this Val

To use this template, fork this val on the top right corner of this page. Screenshot 2025-01-10 at 1.22.10 PM.png

2. Customize Query

Define what you want to search for by modifying:

  • keywords: Add terms or phrases you care about.
const keywords = ["val.town", "val.run", "val town"];
  • excludes: Exclude irrelevant mentions (e.g., retweets, specific users, or keywords).
const excludes = "-_ValTown_ -is:retweet -from:valenzuelacity -from:val__run";

Refer to Twitter's search operators to fine-tune your query.

3. Test API call

Set isProd = false in the code if you are testing, to ensure there are enough tweets to display.
Toggle it back to true when you're ready to run this cron job in production.

4. Choose Notification Method

Once you've followed the instructions to create your Discord webhook, save it in your environment variables as mentionsDiscord so the following will run:

  await discordWebhook({
      url: Deno.env.get("mentionsDiscord"),
      content,
    });

Currently, this val sends notifications to Discord.

Update the discordWebhook call to send notifications to your preferred platform (e.g., @std/email, Slack, or anywhere else.)

5. NOTE: Usage Limits

This val uses the SocialData API for Twitter data:

  • Proxies via Val Town's SocialDataProxy: Limited to 100 calls/day for Val Town Pro users.
  • Need more calls? Sign up for your own SocialData API token and configure the socialDataSearch function.
Cron
  • main.tsx
Code
README.md
C
main.tsx
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareersBrandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.