A long time ago (like 2013), we though it would be great if we could just press a button anytime we wanted our favorite pizza order, and so we set out to build the Holy Grail of American food convenience mechanisms: The Dominos Pizza Button. This is our story.
What the hell is a Pizza Button?
When it comes to ordering pizza, we’ve noticed something interesting about our personal habits: we tend to stick to a standard order. True, sometimes we may get a wild hair and order something special, but typically, we don’t venture too far from our favorites.
Any good developer see’s repetitive behavior and wants to find a way to automate it, and thats just what we did. We reverse-engineered Dominos’ API (used on their website to order pizzas), and we hacked into a Staples “Easy Button” to program it to communicate with Dominos and order our favorite pizzas when clicked.
Because we weren’t feeling particularly creative, we named it “The Pizza Button”. Sorry.
Okay, but why?
One night back in 2013, while in the middle of an urgent deadline, we found ourselves frustratingly looking for easy options for dinner. We wondered: wouldn’t it be awesome if we could just press a button and have our favorite pizza show up at our doorstep. Way back then, the “Internet of Things” wasn’t a common phrase, and typically, the internet was confined to a browser. Things like ordering pizza online were still a novelty, so the convenience we are used to today simply wasn’t there.
On a lark, we wrote down the idea “make pizza button” on a slip of paper for later. At Wonderful, we’ve always had the stance that creativity is a muscle that must be conditioned. As such, we find a lot of seemingly asinine ideas being tossed around our team on a regular basis, and when time permits, we pick one from the deck and work on it.
Also, it’s a Pizza Button, and it doesn’t need justification.
We had to figure out how to Dominos’ ordering system
Our first goal was to figure out how to connect to Dominos and actually create an order on the behalf of a user. If we could figure this out, then the options for how to apply it would be endless. Want a Chrome bookmarklet that orders your favorite pizza? Sure. Want to hack your garage opener to put in an order as you arrive? Yup. Titillated with the potentials, we began putting ideas to paper.
We could write a bot
Our first idea was to script up a bot and teach it how to literally operate the Dominos website on behalf of a user. A user would have to supply it a set of login credentials, and the bot would go to the website, log in, and order a pizza. This is one of the oldest tricks in the book (see also: spam bots), so on its face, it seemed like our most promising option; however, these bots aren’t effective on every website – including this one.
So, that was out.
Or, we could do it the same way Dominos does
Alright, we realized we couldn’t operate the site on someone’s behalf, but maybe we could just pretend to be the website and trick the server into taking an order from us?
This seemed pretty daunting at first. There wasn’t (and still isn’t, as far as we can tell) a public API that Dominos has made available to do this type of thing, which means that this whole idea could be over before it really began. For example, if Dominos doesn’t give us instructions on how to order from their server, what are our options?
After a little more poking around, we had a moment of clarity. We realized that the Dominos website is a client-side application that calls home behind the scenes. For anybody that doesn’t understand what this means, it means that if we open up the Chrome networking panel and walk through the various steps required to order a pizza on the Dominos site, we can literally watch the conversation it has with the main Dominos server — the URLs that it hits, the data it sends to those URLs, and the data it receives from those URL’s.
The good news? We found the actual Dominos API that the website uses to manage the online ordering process. The bummer? We still had no documentation on how to use it, so unless we wanted to manually record every request the site made, unpack the requests and responses to learn how to rebuild them, and tediously trace how each request relates to the next by trial and error (doing it the hard way), we were out of luck.
Sometimes you just have to do it the hard way
Naturally, we just did it the hard way. We manually recorded every request the site made, unpacked each request and response to learn how to rebuild them, and tediously traced how each request related to the next by trial and error. Whatever. Like we had anything better to do. After a couple of long nights, we had whipped up a basic middleman service that was able to communicate with Dominos and successfully order a pizza.
Making the prototype
Now that we had a service that could technically place a valid order, we had to decide on how we actually wanted to place that order. The team had a few interesting ideas for this, but the one that really stuck out was a big, friendly button that somebody could stick to their refrigerator and press whenever they were hungry for their favorite pizza.
Fun fact: if you accidentally mess up your logic and you send 2–3 completely separate orders to Dominos in a fraction of a second to the same delivery address, they don’t call you to see if anything weird happened, they just send you the pizza you bought multiple times.
We joined up with our good buddy Rob Rohan and worked up a recipe for a prototype button: a Raspberry Pi and a Staples Easy Button.
We whipped up an application and loaded it into the button, and just as we hoped, when someone pressed the Easy Button, it fired up the Raspberry Pi, which used our Dominos service to place an order. Sweet!
Time to test it
After all that hard work, it was time to take the button out for a test drive. Rob fired it up and pressed the button. It said the order went through, but then silence.
…And then the doorbell rang.
Silly isn’t bad – it can have a purpose
This was pretty fancy stuff for such a silly project, especially for 2013. Raspberry Pi’s were relatively new things, and expensive. The Dominos online ordering system was still a novelty, and reverse-engineering it took a lot of hours. Honestly, it was a risky thing to put the company credit card on the line to test a cobbled-together hardware ecommerce solution (we really had to look out for endless loops). Many people would look at this as a complete waste of time — even dangerous, for a small company.
For us, though, things like this are imperative. We cross-train ourselves on weird ideas so that when opportunity presents itself on something viable, we know we can handle it – like the time we were approached to build IOT for racecars.