Developing an Alexa Skill (App)

Several times in the house you want to take some actions. To do that, you need to drop what you are doing, find your phone, enter your password, open an app and then do what you desire. This is often a hassle in busy life when your hands are full.

Amazon has addressed this sweet spot by introducing Amazon Echo/Alexa. With the Echo, you can use your voice to get the things done. The backend does a phenomenal job of recognizing natural language, associating it with the predefined commands, invoking Amazon lambda for the commands. This is a new exciting platform for app development.

Using one of its built-in skills, Alexa can tell you the time in different time zones, and/or in different cities and countries. Being a pilot, I like to know the GMT (Greenwich Mean Time). However, Alexa does not tell that. I decided to get my hands dirty and developed a skill (similar to an app) for retrieving the current GMT.

It has two parts:

  1. Alexa Skill
    The skill defines the identity, interaction model i.e. the utterances that user can speak and intents (i.e. the actions to be taken for utterances). It maps the utterances with the intents. Amazon voice model is smart enough to translate natural language to corresponding intents.
    Skill also points to the AWS lambda functions that it will invoke when certain utterances is spoken.
  2. AWS Lambda
    AWS lambda function is the master stroke of AWS. Where you can invoke a certain function with no server needed. When an Alexa skill invokes a lambda function, it can be for one of the following request types.
    1. LaunchRequest – This is called when user invokes your skill with no other parameters e.g. user says “Alexa, start Greenwich Time”. In this case, you can build a speech text that will prompt the user to take the next action or ask a question. (e.g. “Ask Greenwich Time to say GMT.)
    2. IntentRequest – This is called when user’s talk maps to one of the utterances that was defined in the skill. E.g. if user is asking for GMT/Zulu Time in the utterance, this skills will map it to “ZuluTime” intent. The intent will calculate the current GMT, convert it to speech and return it to Alexa skill. It will then be converted to audio stream and sent to Amazon Echo and user will hear it.
    Please make sure that your lambda accounts for “help intent”. Else the skill will get rejected.
    3. SessionEnd – As the name goes this is invoked at the end of a session and your cleanup logic would go here.

It is a simple app to understand the concepts in this new voice Ux paradigm. It also, gives the knowledge about AWS lambda , the app workflow and the architecture behind it.

You can see the code on GitHub.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s