BASH Your Way Into WordCamp US 2023

WordCamp US returns to the east coast at the end of August. That’s only 3 months away! This is the big yearly WordPress community conference open to everyone. It’s the one conference I’ve regularly attended since 2015. A huge value in both personal and professional connections. Considering there wasn’t a WordCamp US in 2020 or 2021, and very limited attendance for 2022, I’m anticipating this year’s turn out to be big. So be sure to snag your tickets when you can: https://us.wordcamp.org/2023/tickets/.

Last week the first round of tickets for WordCamp US was released. I somehow missed the announcement on Monday. By the following day, there were no tickets available. How could this be? Did I miss my chance to attend WordCamp this year? Well… no. It turns out WordCamp US tickets are being released in smaller batches due to many factors decided by the WordCamp organization team. Refer to conversations in WordPress Slack channel #wcus.

Only once did I personally help organize a WordCamp. It was for a significantly smaller event here in my hometown of Lancaster, Pennsylvania. Based on my experience I can only say a huge thanks to anyone willing to give up their time to help organize these community events. It’s no small task and a huge reason why the WordPress community has continued to thrive over the last 20 years.

Using BASH to be the first to uncover ticket availability.

So I didn’t want to wait around for some next announcement of tickets in order to snag my ticket. I thought, why not write some BASH code and get notified immediately when they’re available? The first thing I noticed is that requests to https://us.wordcamp.org/2023/tickets/ are cached. Viewing the source code reveals they’re using WP Super Cache.

Monitoring a cache page isn’t that helpful. The WordPress instance behind wordcamp.org is also tied to WordPress forums. If you have a WordPress Forum account then you can most likely sign into https://us.wordcamp.org/2023/wp-admin. Once signed in your see the logged-in bar up at the top of the tickets page. From there we can use Chrome’s DevTools to copy a request to the tickets page with cURL.

Copying a request to /2023/tickets/ with logged in cookies as a curl command.

Put the contents of that cURL command into get-tickets.sh. That will look something like this.

curl 'https://us.wordcamp.org/2023/tickets/' \
  -H 'authority: us.wordcamp.org' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'cache-control: no-cache' \
  -H 'cookie: wordpress_sec_###############=#####################; wordpress_logged_in_###############=#####################;  eucookielaw=############' \
  -H 'pragma: no-cache' \
  -H 'sec-ch-ua: "Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'sec-fetch-dest: document' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-site: cross-site' \
  -H 'sec-fetch-user: ?1' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36' \
  --compressed

Next grant this script execute permission chmod +x get-tickets.sh and run it in the command line ~/get-tickets.sh. This will programmatically fetch the ticket page using our logged-in cookies to see a non-cached version of the tickets page. We can confirm it’s working by checking the last line of the response. If it ends in </html> then we are indeed looking at a non-cached version of the ticket page.

We’re nearly complete with our monitor. Next, we’ll just need to examine the response and do some action if tickets are found. Create another script named check-tickets.sh with the following.

html_response=$( ~/get-tickets.sh )
if [[ "$html_response" != "" && "$html_response" != *"Sorry, but there are currently no tickets for sale. Please try again later."* ]]; then
    echo "opening Chrome"
    /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome "https://us.wordcamp.org/2023/tickets/"
fi

Next, we’ll need to grant execute permissions chmod +x check-tickets.sh. Running ~/check-tickets.sh will check to make sure there is some response, good for ignoring responses when we’re offline. If tickets are found then open Goosgle Chrome to the checkout page. Lastly, we’ll need to schedule this to run in the background at regular intervals. Run crontab -e and add the following.

*/2 * * * * /Users/austin/check-tickets.sh

Running crontab -l shows the cron job is scheduled to run every 2 minutes.

The results couldn’t have been better!

So after running the script for a few days, there I was sitting in a coffee shop when suddenly my browser opened up to the following. I quickly snagged the ticket and proceeded to write this blog post.

With only one ticket remaining, that means someone in the initial batch must have asked for a refund. Whenever someone can’t go to WordCamp that ticket is made available for someone else. That means my BASH script did preciously what I was hoping for. It alerted me to the ticket before any announcement or anyone told me there were tickets available.

There should be plenty more tickets coming so if you haven’t snagged one yet, just keep an eye on the tickets page. No need to do a crazy monitor like I did :). Hope to see you at WordCamp US!