By Sam Kummary and Walter Olivito
We love fun new gadgets – especially those of the variety that can talk to you and play your favorite song titles and give you the lowdown on the latest Mariners game. An Amazon Echo is a wireless speaker and voice command device capable of all of these things and more. It can also control several smart devices throughout your home or office.
Last May, when ModusBox hosted a booth at MuleSoft’s Connect 2016 event in San Francisco, we took along an Amazon Echo to play with – and later, raffled one away.
However, simply lugging the 2.5 pound talking-cylinder through airport security, overhead luggage compartments, and Uber rides to the event wasn’t enough for us – as is often the case. We wanted to integrate it with Mule Cloudhub but the question was what to integrate it with.
We brainstormed several different integration scenarios possible. Our favorite was, “Alexa, please make me a coffee.” We’re still working on that one. Ultimately, we landed on tying it together with a Google form and spreadsheet used to record visitors at our booth and capture entries for the Echo giveaway.
To do so, we had to first teach Alexa (the wake word and name that the Echo is affectionately known as) a new trick – or skill as Amazon puts it. Along with the inbuilt functionalities, Amazon provides the Alexa skill kit – a developer platform that contains APIs, tools, and documentation to develop these custom skills.
Upon invocation of the registration skill that we created, Alexa prompts the user with specific questions and gathers information based on the responses. Using Cloudhub, these responses were then populated in the Google form and thus loaded into the same tracking spreadsheet used by our team at the event to record visits to our booth.
Alexa to Cloudhub to Google Forms Workflow
How Amazon Echo Integration Works:
- Echo receives data from the user through Alexa asking questions and prompting
- These requests are handled by a function hosted on Amazon Web Services’ (AWS) Lambda (nodejs code)
- The AWS code handles requests/information based on invocation phrases
- The data is then consolidated into a single JSON object that contains the details needed to register a guest
- A POST request is made to an API hosted on Cloudhub, sending the JSON object (with authentication headers etc)
- This API is HTTPS based and uses basic authentication
- The API receives the JSON and prepares the data into values that can be used as parameters in the Google form
- The API makes a POST to the Google Form with the data
The Amazon Echo integration with Cloudhub was a big hit at the event but in the end our team probably had more fun building it than attendees did using it. Connecting Alexa using MuleSoft technologies has us thinking about the thousands of other interesting use cases possible with the Amazon Echo and other such home automation devices.
Do you have an idea for an integration like this? We’d love to hear about it in the comments section below.