The Amazon Dash Button is a $5 button with a battery and a WiFi connection. The online mega-store wants you to keep these throughout your home to quickly order refills of your favorite household items, everything from Glad Trash Bags to Gatorade… They literally make ordering things from Amazon as easy as pushing a button, and at $5 (plus a $5 rebate), they’re basically giving them away.
I recently wrote a separate blog post about hacking one of these buttons to order Domino’s Pizza:
Hacking Amazon’s $5 Dash Button to order Domino’s Pizza
An Amazon Dash Button is a $5 button with a battery and a WiFi connection inside that Amazon wants you to stick inside…
Within that article I describe my original inspiration for hacking the button and why I chose pizza. I posted the article on a Sunday night and come Monday morning it was featured on the likes of The Verge, Gizmodo, Consumerist, and Lifehacker to name a few sources. I’ve never had anything like that go “viral” (if that even counts) and it was kind of cool to read/see all the comments, tweets, and shares they all generated. I even received a few ideas for other buttons that I could hack together, but there was one idea that was never requested and it was staring me in the face. As I was eating that delicious pizza of mine, I was enjoying it with a nice hoppy IPA (my favorite kind of beer).
I then jumped on Google and began searching, I was sure there was something like that out there already. Heck, even the Pizza button idea was somewhat thought of before with the PiePal and there is an entire company that does exactly that: Push For Pizza! So here my next idea was born, find a way to get beer ordered and delivered to me from the push of a button. I quickly thought; Why has no one thought of this!?!
The Search for Alcohol
The first thing I needed to do was find a way for this to happen. There are several apps out there that provide alcohol delivery across the country — mostly at a local scale — but I researched great services like Liquor Limo, Drizly, Saucey, Thirstie, Minibar, and Klink to name a few. There was only one service that I could find that offered an API (Application Programming Interface), which allows me to send and receive information between their application and mine; that service happened to be Drizly. As I live in the Greater Boulder Area of Colorado, it didn’t leave me too much choice to begin with, but luckily Drizly just happens to deliver there!
More than that, when I reached out to Drizly and told them my idea, they absolutely loved it! So teaming up with Drizly, I was allowed access to their API and after a handful of days/nights of working on it, I sent it off to the engineering team at Drizly to take a look at it. As it was a different experience working with the Drizly team as it was using an unofficial Domino’s API in my last hack, it was kind of cool to show the individuals who work on the product each day what an outsider can do with it!
Creating the Apps
The Amazon Dash Hack App
Similarly to my PizzaDash, I am using a npm module to listen for the button press and place the order: hortinstein’s Node-Dash-Button along with Drizly’s official RESTful API. While the main application to order your alcohol isn’t that much code, I also created a setup file that one could run after they have created a consumer account on Drizly using my accountCreation.js script and have filled out their default address and credit card information. This setup script will have you login and save all of the personal information needed to complete a successful order in an environment file. This is a bit different than the last button I created and I wanted to do this to allow someone who doesn’t 100% understand their API to be able to create their own button if desired and a lot more technical. I have all of the code on my GitHub using them both together for anyone interested in reading my in depth Read Me.
This article shows you what you can do with a Raspberry Pi to set this up as a node server running all the time on your network and it literally would be the press of a button whenever you wanted! You can see the example I made on GitHub here:
DrizlyDash - This is an application that "hacks" your Amazon Dash Button to order you alcohol from Drizly!
Even More Technical (but Cooler) AWS IoT Button App
An Amazon AWS IoT Button is basically the same thing as an Amazon Dash Button but it is intended to be “blank” and hooks up to Amazon’s AWS servers so it is always running and taking care of the Raspberry Pi part for you! This new button simply connects to your network like the Dash Button and sends a payload to AWS IoT whenever it is pressed and you can trigger different “rules” based upon the press such as an AWS Lambda function (see code gist below). You can also set a different color pattern for the buttons LED feedback on success/failure as well as intercept a Short, Double, or Long type of click!
In the process of creating the Dash hack version of this application, a representative from Amazon reached out to me mentioning my first article and would like me to reinterpret it on AWS. So the fact that Amazon sees potential in what developers can do and are sending me one of their new IoT buttons for free is pretty amazing, as they technically are not available for purchase at all. So I took this opportunity to create two versions of my Drizly ordering application!
The process was a little different, when you get the IoT button you can follow Amazon’s getting started guide, and setup the button on the IoT platform in a few minutes. After this setup you should have 4 objects in your AWS IoT dashboard: The button (which is a Thing), a Certificate for your button, a Policy for your button, and lastly a Rule (which is what action you want to take) for your button that is defaulted to something you pick in the setup process.
To implement the above code you can create a new Rule or edit your existing default one and make sure you select the Action as “Insert this message into a code function and execute it (Lambda).” Then you can create a new Resource and skip the blueprint and paste the above modified version of your Lambda function.
You may have noticed my above code has a switch statement that chooses different ITEMS based off of a Single, Double, or Long press. For my own preferences, I set up two great beers for a Single press, and the same two beers but double the quantity for a Double press, and then I have some liquor setup for a Long press because it might be quite a long night. 😏
If you have just the Amazon Dash Button, all you have to do is run the accountCreation.js and setup.js files, login with your Drizly account, customize your favorite order by running the setup.js file again, get it up and running either locally on your own personal computer or local server, and then BAM! You favorite liquor store stop can now be delivered in under an hour at the press of a button! 🍷🍸🍺
Using the example app, someone would have to be a bit more technical than my previous PizzaDash button, but they could wire one of these Drizly Dash buttons up with their own delicious custom drink order. It’s been fun to defy the odds of what you can build at the “press of a button.” The only bummer about this method is that you have to have a computer or spun-up server always running…
If you happen to be lucky and receive one of Amazon’s recently announced AWS IoT Buttons, which is basically a blank dash button that can wire up to the new AWS IoT platform so you do not need to have a computer or server running, Amazon takes care of all that for you with AWS. Then you can use my Gist above and follow my steps to wire up your truly always on button, that leverages the cloud! Also check out Geoffrey Tisserand’s article about using an IoT button to summon his daily commute to work via Uber!
I’m still thinking about reinterpreting the PizzaDash this way with the IoT Button. Again, If you think about any other ideas or uses for an Amazon Dash Button or the new AWS IoT Buttons, shoot me an email. Cheers and happy hacking! 🍻