The author chose to make this story unlisted, which means only people with a link can see it. Are you sure you want to share it?

Still can’t get a 5S? Get a phone call when they are in stock!

Still can’t get a 5S? Get a phone call when they are in stock!

Make a Twilio/Heroku mashup in 5 minutes, get a phone call when your local Apple Store has iPhones in stock.

I didn’t manage to get an iPhone on launch day. I was banking on using the “reservation” system to get it the next week, but Apple Store’s website doesn’t update squarely at 10pm anymore with what’s in stock, rather, around the clock.

While using the availability checker on Apple’s website, I noticed that is used a simple JSON request:

The response is a fairly clear:

I thought, what if I write a script that repeatedly checks this JSON, and notifies me when the item I want is in stock? It turns out, it’s very easy. Check it out:

To begin with, create an empty folder, initialize git, and put two empty files in it: Gemfile and alerter.rb.

You should replace account_sid, auth_token, and the to/from parameters of @call with your own Twilio account info (from will be your special Twilio number, to will be your regular number). Put your zip code in zip.

To find out the correct model number for the phone you want, go to Apple Store and select the color/capacity/carrier configuration you want, then click “Continue”. The next page will have the model number in the URL.