Coding up "Subway Bot"

I spent some time building @nycsubwayalerts over the weekend, inspired by Jesse, one of the Threads engineers.

It pulls real-time delays from the MTA’s data feed and posts to Threads via the API.

The bot has a few different components:

  • index.js coordinates the whole thing
  • subway.js grabs realtime data from MTA’s json and filters to just delays from the last 5 minutes
  • threads.js handles creating and posting to threads.

The bot itself is run via cron job on Render that’s triggered every 5 minutes. Environment variables (including Threads API keys) are handled there. I tried to do it via GitHub Actions but it turns out cron job scheduling is quite unreliable. Ultimately each run takes about 20 seconds, so hosting this should cost under $3 a month or so.

I built it pairing with Cursor/Claude, which is an amazing way to do low-stakes code.

Right now it’s set up as a cron job on Render.com, which is a lovely and dependable experience. It checks for updates posted to MTA’s service within the last 5 minutes and then clears the queue:

Post by @nycsubwayalerts
View on Threads

It’s also all open sourced on Github.

If you turn this into something else, I’d love to see. Or if you have feedback on the bot, let me know. Hit me up on Threads.


View this page on GitHub.