Software apps and online services
While I started my career as a software developer, I've been an engineering manager and director and haven't done hands-on coding for several years. As my team has started project work to move our services into AWS, I wanted to learn some of these technologies first-hand by writing a few coding projects on the side. Alexa Skills seemed like the perfect way to practice my coding as I can easily create a Lambda function to practice new development skills and learn new technologies.
There are plenty of restaurant finding applications for Echo, including built-in functionality by Amazon. So what sets this skill apart? For starters, I didn't like the voice interface offered by many of the other solutions - they either require you to use the companion Alexa app, or make it difficult to navigate back and forth through a list of matching options. In addition, while several skills let you filter based on the type of cuisine - few let you search based on ratings ("good" or "great") or prices ("cheap" or "expensive").
For this project, I integrated with the Yelp APIs and used DynamoDB to store the state of the user interaction as they go through the list
The user can start by searching for a restaurant in a location ("find a restaurant in Seattle"). If the skill doesn't hear a location, it checks to see if a preferred location is stored in the database for this user ID. If not, the user is prompted to set a preferred location ("set location to Seattle"), so that this preference can be used for subsequent queries.
The query is processed for qualifiers (currently open options, type of cuisine, price, and rating), an a Yelp request is generated. My code associates different price or rating ranges for several different qualifiers that the user might say to build up these parameters.
The response from this call is stored in the user session and in the DB. The user is told the number of matching results, and if five or fewer matches are found, these are read to the user. If there are more results, the user can read them five at a time. They can read the next set of five by saying "more" or the previous set of five by saying "back." Of course, "repeat" allows you to hear the same set of restaurants again.
If you want to hear additional details about the restaurant - the address, phone number, price range, and Yelp rating, you can ask for more details about any of the restaurants that are presented. Again, you can go "back" or "read the list" if you want to return to the full list of restaurants.
While the main reason I wrote this skill was to learn some new technologies (specifically for this skill DynamoDB), I found myself soon wrapped up in testing the nuances of the voice interaction model and fixing issues found from testing. For example, Yelp provides a list of categories in a JSON format at https://www.yelp.com/developers/documentation/v3/all_category_list. This list, however, is meant for programmatic access - providing the alias (e.g. "vietnamese") that is passed into the API. However, when my son tried to test my skill, he wanted to search for "pho" restaurants. I realized that I'd need to add aliases for some of the restaurant cuisines based on alternatives that people might speak when searching.
I also found it difficult to allow the user to set the location. Alexa has built-in support for an AMAZON.US_CITY type, but this only includes larger cities - not cities like my mid-sized hometown. I decided to add support for setting locations by US ZIP code as well (using AMAZON.Number for this type). To aid users that are trying to set their location, my skill reminds users that they can query by city or ZIP code.
My overall time on this project was pretty evenly spent in three main areas - (1) designing the flow and coding against the Yelp API, (2) learning and configuring DynamoDB to store and retrieve the user state and preferred location, and (3) fine tuning including testing, bug fixes, and polishing the skill. While I had a quick-and-dirty solution up and running in a few hours, I spent a good 10 hours to hook everything up and perfect the interaction model.
Overall, it was a great learning experience for me. While I'm by no means an expert after coding this project, I have started having better design discussions with the developers on my team at work and have found a better appreciation for the designs of the projects that we are building. It's definitely been a fun experience and I hope to continue writing Alexa skills as I continue to learn and grow.