there are almost 100 date me docs on the http://dateme.directory!
we just need two more - quick!! - somebody make a date me doc! https://x.com/stevekrouse/status/1644390341489852428/photo/1
Notes
- @jamiew I think we're going to built a feature that makes this better My current idea is that there can be a "re-evaluate this val if any of it's references (recursively) change" checkbox What do you think @tmcw and @rodrigotellom?
- @jamiew thanks for the great question!
- @Clerk I publish the blog post before I write it, so in theory you can watch as I write it https://blog.val.town/blog/val-town-newsletter-6
- I'm tired of wondering when Twitter will finally deprecate their old API, so I setup a realtime notification when it breaks, and you can too 👇 https://x.com/stevekrouse/status/1644362429323681792
- Ok I think I'll stop there for now! 1. If your twitter app is still working (like mine is) hopefully it lasts a couple more weeks, maybe more 2. Here's a way to get notified when it goes down 3. I'll start paying $100 / month when it goes down and let y'all know how that goes!
- This interview of Zuck from 2005 is so precious https://vm.tiktok.com/ZMYpBjd85/
- Ok now let's setup alerts, but in a way that not just I get alerted. You too can get these alerts! Here I made a val function `twitterAPIDownAlert` that just checks my `twitterAPIDown` variable for if it's down, and then will email me if so https://www.val.town/@stevekrouse.twitterAPIDownAlert https://x.com/stevekrouse/status/1644362012925870085/photo/1If you want to get these email alerts 1. sign up for val town at https://www.val.town/auth/signup 2. go to this val, click "fork", then click "run" 3. done! now wait for an ominous email sometime in the next "30 days" 🤣🤣🤣🤣 https://www.val.town/stevekrouse.twitterAPIDownAlert
- For example now `down` is `false` and the reason is that a couple minutes ago we got 10 results from the Twitter API https://x.com/stevekrouse/status/1644349273192931330/photo/1Ok now let's setup alerts, but in a way that not just I get alerted. You too can get these alerts! Here I made a val function `twitterAPIDownAlert` that just checks my `twitterAPIDown` variable for if it's down, and then will email me if so https://www.val.town/@stevekrouse.twitterAPIDownAlert https://x.com/stevekrouse/status/1644362012925870085/photo/1
- For example now `down` is `false` and the reason is that a couple minutes ago we got 10 results from the Twitter API https://x.com/stevekrouse/status/1644349273192931330/photo/1
- Ok, so tweaked it so that the `twitterAPIDown` variable is no longer a boolean Now it's an object that stores 1) if it's down and 2) the reason we think it's down https://x.com/stevekrouse/status/1644349045379309572/photo/1
- But what if you want to get notified programmatically? Boy do I have an answer for you! First, let's refactor out the notification bits of my poll job. Those are the `http://console.email` lines, which email me, the author of the function (kinda like console.log)
- Ok so now I will get emailed when the Twitter API goes down, but what if any of you want a notification too? Well now that I've made this twitter thread about it, I'm sure I'll tweet about it, so that's one way you can get notified. (And I'm sure I won't be the only one!)
- Ok, now when I run it, it all works as expected! It set the twitterAPIDown variable back to false https://x.com/stevekrouse/status/1644343686359072768/photo/1
- Ok it turns out I had formatted the query param incorrectly. I needed quotes around hello. I had 'hello' but I needed '"hello"' 🤦♂️ You can scrub through the versions of this debugging val I made to see me play with it https://www.val.town/@stevekrouse.twitterSearchHello
- Tracing in Val Town is great for exploring what happened, up and down the call stack I can pop open the sub evaluation call to `twitterSearch` to confirm that it did indeed return and empty array https://x.com/stevekrouse/status/1644342086232145929/photo/1
- I used our sparkly new "Run Now" button to run the scheduled val immediately to see the results Bad news, it seems like either there's a bug somewhere or nobody tweeted the word "hello" in the last hour... https://x.com/stevekrouse/status/1644341169113931776/photo/1
- Ok that was pretty easy! I explained what every line does in comments, so you can just read em there. I'll wait https://www.val.town/@stevekrouse.checkIfTwitterAPIIsDown https://x.com/stevekrouse/status/1644338953078579201/photo/1
- Let's track if the Twitter API is down in this public boolean val We'll start it off as false, because it's not down now! https://www.val.town/@stevekrouse.twitterAPIDown
- Ok now we can pop the stack to finally get back to what we were trying to do back here: make a mini-app to let us know when the Elevated v2 twitter api is down https://x.com/stevekrouse/status/1644326564304236545?s=20
- The only parameter I haven't yet explain is line (3) `start_time` but that's self-explanatory, except for my `msHour` val, which I think is pretty neat I utilities that represent time in miliseconds for easy date math (hour, min, day, week, etc) https://www.val.town/stevekrouse.msHour
- Anyways, if you already have a bearer token, you can 1. sign up for val town 2. add your secret here https://www.val.town/settings/secrets 3. fork & run `exampleTwitterSearch`, and feel free to customize any parameter
- @_ValTown_ Of course, I'm not sure you can even get a new bearer token via the Twitter Developer Portal these days. After all, isn't that the whole point of this tweet thread?!
- @_ValTown_ All of these vals are public, forkable, and runnable, btw! If you want to try any of this out for yourself, all you need is a bearer token from the Twitter API Then go fork `exampleSearchTwitter`, put in your bearerToken on line 4, and run it ✨🕺 https://www.val.town/@stevekrouse.exampleTwitterSearch
- @_ValTown_ I should give some overall context: The main way I use the Twitter API, and `twitterSearch` in particular, is for almost-realtime notifications when anyone mentions "Val Town" anywhere on Twitter! This is my favorite/most useful val I've ever made https://www.val.town/@stevekrouse.twitterAlert https://x.com/stevekrouse/status/1644333403926327297/photo/1
- Ok but back to explaining how my `exampleTwitterSearch` val works line 2 is the query, which is mostly self explainable, except for the part where i had to filter out any mentions of @_ValTown_, because that's an unrelated twitter account 🤣 https://x.com/stevekrouse/status/1644332696112357377/photo/1
- If you scroll back up a couple of tweets, you'll notice `author_name`, `author_username` ("Steve Krouse" and "@stevekrouse", respectively, because it was my tweet) Those fields were tacked on by this second API call (per found result tweet)
- Here's what the code for `twitterSearch` looks like: One line 12 you can see me constructing the query Then line 24 is actually kinda interesting: I use another Val Town function `twitterUser` which uses another Twitter API to pull the username of the person who tweeted https://x.com/stevekrouse/status/1644331014641049600/photo/1
- Why did I build my own API wrapper vs using an npm library? Probably because Val Town didn't support npm imports at the time! But anyways, it works, so I keep using it!
- My `twitterSearch` function is built as a wrapper over this API https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-reference/get-tweets-search-recent
- Let me explain what's going on in this code Line 1 defines the name of the val `exampleTwitterSearch`, and then calls another one of my functions `twitterSearch`, which takes a number of search parameters https://www.val.town/stevekrouse.twitterSearch
- This is code on Val Town (my startup; a social programming environment) that uses the Elevated v2 Twitter API to search for any mentions of "Val Town" in the last hour Meta of all metas, it found a tweet from earlier in this thread https://www.val.town/@stevekrouse.exampleTwitterSearch https://x.com/stevekrouse/status/1644328751537311746/photo/1
- First, let me show you a quick way that I know that the Twitter Elevated API is still working right now, and we can work backwards from there...
Text may be partial · Read original
- Ok, so the issue here is: what does broken look like? Does it mean their server returns 500s? Empty responses? I'm pretty sure even the poor folks at Twitter don't know! They're probably working on how it should go down as I'm writing this!
- I've got a fun idea! I'd like to know as soon as the Elevated Twitter API is broken. Let's make a little mini app that does that, so we all finally know when it's down and need to migrate over...
Text may be partial · Read original
- Maybe the key words are actually their plea for you "migrate [...] as soon as possible for a smooth transition" Let me translate: Move over ASAP so we can make $$$ to make daddy elon proud Also if you don't and we shut you off, don't come crying to us
- The relevant Tweet is shutting off access to the Elevated API in the "next 30 days" Forgive me if I don't buy it Also - "next 30 days" is a pretty weird kind of deadline. I guess they mean April ~28, but didn't want to pick another date https://x.com/TwitterDev/status/1641222786894135296?s=20
- On March 29 (and the current pinned tweet) we got what looks like a reasonably well thought out plan 1. Free, Basic, Enterprise (discussed above) 2. Deprecating everything(?) else in the next 30 days 3. Some exceptions for advertisers and academics https://x.com/TwitterDev/status/1641222782594990080?s=20
- On Feb 13 and Feb 17 we got some good oopsie sorry we can't just cut off millions of developers with days of warning, we didn't mean it, give us some time to figure out a plan that actually makes sense 🤣 https://x.com/TwitterDev/status/1625234161010343941?s=20 https://x.com/TwitterDev/status/1626732269174943745?s=20
- The next word on Feb 8 was that we now had until Feb 13, and this was the first announcement of the $100 / month and free tiers. These VERY FIRM OFFICIAL DATES are funny to look at in retrospect https://x.com/TwitterDev/status/1623467615539859456?s=20











