Back to APIs list

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.
charmaine avatar
twitterRecentMentions
@charmaine
HTTP (preview)
// This val fetches recent tweets about @SnapAR or Lens Studio, removes duplicates,
alexdphan avatar
twitterSearch
@alexdphan
HTTP
An interactive, runnable TypeScript val by alexdphan
marianogenovese avatar
twitterAlert
@marianogenovese
Cron
Forked from stevekrouse/twitterAlert
shawnbasquiat avatar
fetchTwitterUserInfoBroken
@shawnbasquiat
HTTP (preview)
// This approach will use web scraping to fetch user information given a Twitter handle.
stevekrouse avatar
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
stevekrouse avatar
twitterSearch
@stevekrouse
Script
An interactive, runnable TypeScript val by stevekrouse
buttondown avatar
twitterAlert
@buttondown
Cron
Forked from stevekrouse/twitterAlert
andreterron avatar
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
ted avatar
twitterPoll
@ted
Script
An interactive, runnable TypeScript val by ted
stevekrouse avatar
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).
substrate avatar
twitterRAG
@substrate
HTTP
Forked from substrate/hackerNewsRAG
jamiedubs avatar
twitterSearch
@jamiedubs
Script
Forked from stevekrouse/twitterSearch
syncretizm avatar
twEndpoint
@syncretizm
HTTP
An interactive, runnable TypeScript val by syncretizm
geoffreylitt avatar
twitterDailyDigest
@geoffreylitt
Cron
Forked from stevekrouse/twitterAlert
levi avatar
twitterRAG
@levi
HTTP
Forked from substrate/twitterRAG
andreterron avatar
postTweet
@andreterron
Script
An interactive, runnable TypeScript val by andreterron