Back to APIs list![substrate avatar](https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvdXBsb2FkZWQvaW1nXzJqMlJaUElsQjV0V09sWjhKYndNRnpQemJJUyJ9)
![tmcw avatar](https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvdXBsb2FkZWQvaW1nXzJUbmdsaHJKczVGSDdSS1R5MGtjVVczVFRtTi5qcGVnIn0)
![charmaine avatar](https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvb2F1dGhfZ2l0aHViL2ltZ18yakh1a0cxcnYweDVXdUJIWUhzb01lU0hhRmMifQ)
![substrate avatar](https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvdXBsb2FkZWQvaW1nXzJqMlJaUElsQjV0V09sWjhKYndNRnpQemJJUyJ9)
![stevekrouse avatar](https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg)
![andreterron avatar](https://avatars.githubusercontent.com/u/1753594?v=4)
![stevekrouse avatar](https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg)
![geoffreylitt avatar](https://secure.gravatar.com/avatar/94262cddd28e127e29dacba5f09c8125.jpg?s=200&d=identicon)
![substrate avatar](https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvdXBsb2FkZWQvaW1nXzJqMlJaUElsQjV0V09sWjhKYndNRnpQemJJUyJ9)
Twitter API examples & templates
Use these vals as a playground to view and fork Twitter API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
twitterRAG
@substrate
HTTP
NOTE: We've disabled the Exa API key in this demo due to high volume β you'll need to fork and provide your own to use it. Search on Twitter (powered by Exa ) and return a streaming markdown summary (powered by Substrate ). To fork, sign up for Substrate to get your own API key and $51 free credits. You'll also need Exa, which comes with generous free credits and can be a much cheaper alternative to the Twitter API.
twitterAlert
@tmcw
Cron
Twitter π keyword Alerts Custom notifications for when you, your company, or anything you care about is mentioned on Twitter. 1. Authentication You'll need a Twitter Bearer Token. Follow these instructions to get one. Unfortunately it costs $100 / month to have a Basic Twitter Developer account. If you subscribe to Val Town Pro, I can let you "borrow" my token. Just comment on this val and I'll hook you up. 2. Query Change the query variable for what you want to get notified for. You can use Twitter's search operators to customize your query, for some collection of keywords, filtering out others, and much more! 3. Notification Below I'm sending these mentions to a private channel in our company Discord, but you can customize that to whatever you want, @std/email, Slack, Telegram, whatever. TODO [x] ~Filter out retweets. We've long wanted to filter these out. Should be a quick fix if anyone wants to send me a PR :)~ Completed by @sumukh
twitterAlert
@charmaine
Cron
Twitter π keyword Alerts Custom notifications for when you, your company, or anything you care about is mentioned on Twitter. 1. Authentication You'll need a Twitter Bearer Token. Follow these instructions to get one. Unfortunately it costs $100 / month to have a Basic Twitter Developer account. If you subscribe to Val Town Pro, I can let you "borrow" my token. Just comment on this val and I'll hook you up. 2. Query Change the query variable for what you want to get notified for. You can use Twitter's search operators to customize your query, for some collection of keywords, filtering out others, and much more! 3. Notification Below I'm sending these mentions to a private channel in our company Discord, but you can customize that to whatever you want, @std/email, Slack, Telegram, whatever. TODO [x] ~Filter out retweets. We've long wanted to filter these out. Should be a quick fix if anyone wants to send me a PR :)~ Completed by @sumukh
meTwitterExa
@substrate
HTTP
Search on Twitter (powered by Exa ) and return a streaming markdown summary (powered by Substrate ). To fork, sign up for Substrate to get your own API key and $50 free credits. You'll also need Exa, which comes with generous free credits and can be a much cheaper alternative to the Twitter API.
![stevekrouse avatar](https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg)
twitterAlert
@stevekrouse
Cron
Twitter π keyword Alerts Custom notifications for when you, your company, or anything you care about is mentioned on Twitter. 1. Authentication You'll need a Twitter Bearer Token. Follow these instructions to get one. Unfortunately it costs $100 / month to have a Basic Twitter Developer account. If you subscribe to Val Town Pro, I can let you "borrow" my token. Just comment on this val and I'll hook you up. 2. Query Change the query variable for what you want to get notified for. You can use Twitter's search operators to customize your query, for some collection of keywords, filtering out others, and much more! 3. Notification Below I'm sending these mentions to a private channel in our company Discord, but you can customize that to whatever you want, @std/email, Slack, Telegram, whatever. TODO [x] ~Filter out retweets. We've long wanted to filter these out. Should be a quick fix if anyone wants to send me a PR :)~ Completed by @sumukh
twitter
@andreterron
Script
Login with ~~Twitter~~ π Use this val to login with π and save your token into a twitter_token val Usage Fork this val Change the π privacy to "Unlisted" Navigate to https://developer.twitter.com/en/portal/dashboard to create an OAuth app and save your client id and secret to your secrets page Navigate to https://{your_username}-twitter.web.val.run to authenticate with π And then you'll have your tokens saved to a twitter_token val! Other ~~Twitter~~ π helper vals Refresh your tokens: https://www.val.town/v/andreterron/refreshTwitterToken Fetch user by id: https://www.val.town/v/andreterron/fetchTwitterUser Search posts: https://www.val.town/v/andreterron/searchTweets Write an X post: https://www.val.town/v/andreterron/postTweet
![stevekrouse avatar](https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg)
populateTwitterDB
@stevekrouse
Script
Poll Twitter & Populate SQlite database The twitter API (or in this case someone else's wrapper over the twitter API) is finicky, so we just try to get one handle per minute, and shove whatever we get into our database, which could be an error message (this is why handles don't have a unique index).
![geoffreylitt avatar](https://secure.gravatar.com/avatar/94262cddd28e127e29dacba5f09c8125.jpg?s=200&d=identicon)
twitterDailyDigest
@geoffreylitt
Cron
Daily Twitter "Important Updates" Digest You like getting important updates from Twitterβnew projects or writing or companies to learn about. But you don't like being addicted to the feed constantly. This val lets you get daily updates from specific people you want to follow closely. It uses AI to filter out random shitposts and only get the important updates. 1. Authentication You'll need a Twitter Bearer Token. Follow these instructions to get one. Unfortunately it costs $100 / month to have a Basic Twitter Developer account. If you subscribe to Val Town Pro, you can ask Steve Krouse to borrow his token. Also rate limits seem really severe which limits how useful this is :( Need to figure out workarounds... 2. Query Update the list of usernames to people you care about; change the AI prompt if you want different filtering. 3. Notification Sends a daily email. Todos: this should filter the twitter API call to only tweets since the last run. some kind of caching to avoid rate limiting would be nice to use the user's feed instead of a username list... but not sure how easy that is
similarTweetsWIP
@substrate
HTTP
NOTE: We've disabled the Exa API key in this demo due to high volume β you'll need to fork and provide your own to use it. Find similar pages on HN and return a streaming markdown summary. Powered by Exa and Substrate . πͺ© To fork, sign up for Substrate to get your own API key and $50 free credits.