Thursday, March 31, 2016

Code HelloWorld series: Getting started with Alexa Amazon Echo


Best practices and step-by-step notes from a recent Bloc webinar on how to get started and code HelloWorld app aka skill for Amazon Echo Alexa. This blog post provides step-by-step instruction to create a simple app for area code lookup. It covers the best practice and resource recommendations covered in the presentation. 

slides what is Alexa

Presentation slides hello world with Amazon Echo, getting started step by step:

Scroll to the bottom for presentation slides. 

Background info:

Users interact with Amazon Echo by saying Alexa,  blah blah blah  the utterance is the request to be sent to the skill's web server with data and be given a response back. Alexa will voice over the response specified in the <speak></speak>. Alexa also has online, iOS, Android portals, where users can purchase apps called skills, enable and disable skills, and view info cards.

Mark the Alexa project mentor really thinks Amazon Echo is growing in demand and is experiencing a boom in app creation. The device is growing and gaining in market share. That's where developers will want to be. 

Source: Bloc online coding bootcamp webinar on how to develop with Alexa by Henry and Mark

Bloc mentor sample code for Amazon Echo area code lookup app

Notes & Key Steps to Replicate HelloWorld with Amazon Echo Alexa and Lambda Amazon Web Services:

Amazon Echo Alexa Interaction Model Intent Schema screenshot
  • Concept: each app is called a skill that can be enabled or disabled
  • Concept: interacting with the alexa service involves user sending a request and getting a response from Alexa in audio format
  • Step - App idea generation: come up with an original or semi-original app idea for your Alexa project. Alexa has a relatively small growing app store. It's a good time to get started.
  • Step - obtaining and cleaning data: need to find either static or dynamic API data for your app. For example, a list of area codes is a static data set, versus the latest news from NYTimes via its news API is a dynamic data set. For first try, Henry recommends finding data with no copyright attached. He used a JSON converter to convert his data to JSON, which works well with AWS Lambda. 
  • Step - Get your app to work locally: use your local dev environment or use jsbin to ensure that your code can grab and process the data correctly. Then upload as a zip file. Your zip code should have a minimum of three files: your app, data file, and an Amazon specific library file. Can use the boiler plate file for now.
  • Step - Amazon Web Services Lambda: this is a free tier web services that runs on Node.js. It works well with Amazon Echo demo apps, has great out-of-the-box security. Henry recommends this for those familiar with JavaScript. 
  • Step - Build an interaction model: in your Alexa dev portal, access Alexa skill kit for the menu. This is where you can build the interaction model, make configuration changes, test, publish, twig privacy settings. 
    • Concept - testing: 
      • Testing in the Alexa skill kit does not require an Amazon Echo device. You can simulate your app experience by Entering an Utterance which creates an object to be sent to your lambda service for a response. When the response is given, can click the listen button to hear Alexa respond. 
    • Concept - privacy settings: useful for those apps that collect payment information or personal data that is transacted. 
    • Best practice: test a lot, play around a lot to cover all the scenarios of interaction. Get feedback from the Amazon team to be thorough.
  • Step - Publishing Your Alexa app: Code will be reviewed by the Amazon Alexa team. It's a real world professional code review experience for Bloc students. Once submitted, the app will queue up for a review.
Amazon Echo Alexa interaction model

Best practice:

  • It's possible to write Amazon Echo apps in any language such as Ruby and Python, but using JavaScript and JSON data formatmakes it easy to plug-n-play with Amazon Lambda Node.js server written in JavaScript. 
  • Amazon reviewing team consisted of professional developers will review each app and either approve or provide feedback for improvement.
  • Mark: best developers write the least amount of code. Use Amazon Alexa sample apps and sample code when possible. They are vetted. 
  • Resource: Alexa skill sample apps and core concepts page, demo apps

Bloc Online Coding Bootcamp and Mentorship program:

Amazon Echo Alexa programming is not a stand-alone project as of March 2016, but an integrated project block in each of the four famous Bloc tracks including Software Engineering, Full-stack, Rails and Front-end. 

Submitting the app through the Bloc program in June, students will receive a free Echo from the Amazon team. This is a seriously awesome partnership between Bloc and Amazon. May be the future of building an app store ecosystem is to partner with coding bootcamps and the fresh blood they attract. It's a smart way to build a pipeline of developers.

Next steps:

  • Subscribe to Mark's newsletter
  • Further thoughts: use case for complex Alexa skills including in app purchase, role playing games and writing (not realized skills yet).
  • Further thoughts: experiments have been done on Raspberry Pi which can run Amazon Echo Alexa functionalities. Mark thinks this is proof that Amazon Echo development skills are useful and it is growing in demand. Alexa skills should be able to be applied to run on the internet of things in the future. 

Commonly Seen Errors or Caveats:

  • <say-as interpret-as='digits'>415</say-as> will make Alexa say "four one five" instead of "four hundred fifteen". Useful when decoding area codes and phone numbers.

No comments:

Post a Comment

React UI, UI UX, Reactstrap React Bootstrap

React UI MATERIAL  Install yarn add @material-ui/icons Reactstrap FORMS. Controlled Forms. Uncontrolled Forms.  Columns, grid