The Amazon Echo + Slack

Jared Blakney
Mission Data Journal
4 min readMay 16, 2016

This is part of a running commentary for a project that our Labs team is working on. We are interested in non-visual user interfaces. Broadly interfaces that consider the use of people’s other modes of interacting with the world: speaking, hearing, feeling, and gesturing. So we decided to start playing around with the Amazon Echo. You can find other posts related to this project by searching our Labs blog for the tag #Echo.

If you’ve been following along with us on our exploration of the Amazon Echo’s capabilities, then you might remember that we created a skill for Alexa, the voice service that powers the Echo. This skill was one that enables her to tell us what food trucks are outside of our DC office during lunch time. Since that customization went well, we decided to see if we could have her interface successfully with our beacon-enabled MD Office app. If you look here, you’ll see that we created a mobile app that monitors for beacons placed throughout our offices. The app in turn communicated through Slack to identify the specific location of someone in the office.

We thought it would be interesting to expand Alexa’s abilities by integrating her with our MD Office app, so that when asked, she could tell us the last room someone was in at one of our locations. To do this, our first step would normally have been to locate the data needed for the skill in AWS DynamoDB. Fortunately, we already had a DynamoDB table set up from the development of our MD Office app that was architected to leverage a number of AWS services. With the DynamoDB table already set up, the new Alexa skill connects to that database and returns the location of the requested person, when prompted. This is based on the correlation seen in the following example. Each office location was assigned a unique ID in the MD Office app, where a location ID of 0 was assigned to Louisville and a location ID of 1 was assigned to DC, etc. A similar correlation was applied to the beacon ID’s as well.

Based on our experience from the previous Alexa project, we created an intent called TellMeLocationIntent. We accompanied this intent with a handler, so that it would be initiated when someone said any of the following phrases.

{Person} is a variable that represents the name of the individual being asked about. We created a function called getUserName that we called inside the handler, and defined some parameters to use to query the database. The function would pull names from the table SlackBeaconUserInfo, which included columns for both full names and nicknames.

We then queried the table again, so that if for example someone were to ask “where is Evan”, the function getUserFromName would search the table SlackBeaconUserInfo and look for matches associated with the name Evan. If a match is found, then a UserID is provided, and the function getCurrentLocationFromUser will call the table SlackBeaconUserInfo. Each row in that table has the following data, UserID, BeaconID, LocationID, and LastSeenAtTime. The function getCurrentLocationFromUser matches the UserID to the correct row and gives the corresponding information. From there, we match the UserID data to the location and beacon data provided by the initial query and stored in the locationIDToName and beaconIDToName variables, we are then provided with the location of the specified user.

Lastly, we construct the speechOutput response that instructs Alexa on how to respond to our requests. If we were to ask, “Alexa, where is Carson (our head of research and development)?”, then Alexa could respond with, depending on where he is, “Carson is in the Louisville office near the conference room at 9:48 AM December 20, 2015.”

Having done previous work with building Alexa Skills was very beneficial for this project. As we continue our exploration of the limitations and capabilities of the Amazon Echo, one project we may take on in the future is integrating it with our Bus Stop DC app, so that as a preferred bus approaches the stop near our office in DC, Alexa would let us know. We will also continue to explore the implications of IoT and the Echo.

Have a web app, mobile app, or piece of custom software you need designed and developed? Drop us a line

--

--