Misframe

Jun 24, 2021

Finding COVID vaccine appointments with GitHub Actions

To help folks get vaccinated, I made a GitHub Action to scrape appointment slots and post to Discord.

Santa Clara County made all adults eligible for a COVID vaccine on April 15. I wasn’t sure if there would be a rush to get appointments and whether I could get a slot, so I started looking into how I could notify myself and others when there’s a slot available.

I used the web inspector on the appointments page and saw that there was a JSON API. After a couple of hours of messing around with curl and jq, I ended up with a script that I could run on GitHub Actions on a schedule.

It’s available on my GitHub: https://github.com/Preetam/vaccine-availability

There’s no doubt it’s one of the weirdest scripts I’ve ever written. It uses curl and jq to write SQL statements into a text file, which is then loaded into a SQLite database, which is then queried with SQL (with CTEs and window functions) to generate Markdown lines which are piped to the README. šŸ¤Ŗ

But hey, it works. I was surprised by how much could be done with just a shell script.

For the first iteration, I told my colleagues to subscribe to the GitHub repo so they could get notified via email when new issues are created. I used the GitHub API to create issues in the shell script. This was only to get notified as soon as slots were available April 15 or later.

After April 15th, I stopped the issue creation because there were always slots available. The next iteration was to start sending messages via webhooks to a few Discord communities. One has over 1,000 users. Instead of everyone going to several appointments pages to look for slots, they could just look at the messages posted by the script every few hours:

Discord vaccine bot

I don’t know exactly how many people found an appointment this way, but based on what folks have told me it’s at least a couple dozen. Many Discord users shared the links with their friends and family outside of Discord.

This was one of the best things I worked on this year. šŸ™‚

Next read these:
Mar 5, 2015