Building an Alexa Skill in 5 minutes with NodeJS or Python without installing any software!

The Sigma IDE has added Alexa skill development support that makes skill development in NodeJS or Python a breeze! This post includes the tutorial walk-through for the YouTube video which you can find below.

Getting Started

The following lists the prerequisites, and the links to register for them if you do not have them. None of the prerequisites require any cost or payment, although the registration of a new AWS account would require a credit card, it will grant you a free tier which is awesome! Following this tutorial will not require you to download or install any software, edit configuration files with weird syntax’s, or struggle with multiple command-line arguments and invocations. In-fact, you do not even need to install or be very familiar with NodeJS or Python either, as you will drag-and-drop most of the code of your Alexa skill 🙂

Overview of the Alexa Application

Our Alexa skill will tell a user his Chinese Zodiac animal along with some personality traits, based on the birth year of the user. The tutorial consists of three parts as follows. Although the Chinese Zodiac animal can be calculated mathematically, we will instead use a DynamoDB lookup in our application, to show the users how easy it is to incorporate the dozens of AWS resources when building Alexa skills! We will also show how code changes of your skill can be applied almost instantly, and how you can test and debug the backend as it executes live within AWS.

Part 1: Creation of the Alexa Voice User Interface (VUI)

This section will walk the user through the creation of the VUI portion of an Alexa skill. Any Alexa Skill developer needs to perform this part using the Alexa Developer Console, and create the voice user interface of the application, which is able to understand the natural language utterances of the users and match them to defined intents of the backend application.

Part 2: Creation of the AWS Lambda function backend

This section walks through the creation of an AWS Lambda function as the Alexa skill backend service. While it is possible to use an Alexa hosted service or another REST service of your own, a Lambda function is the most natural and ideal solution to implement the backend of your Alexa skill. The Sigma IDE which we will be using is a much richer, more powerful, and simple to use development environment than the basic editor provided by the Alexa hosted environment. The Sigma IDE offers a completely Browser-based IDE with drag-and-drop code generation, and one-click deployment, testing and live debugging capabilities.

Part 3: Using other AWS services such as DynamoDB

This part is an introduction to what’s possible, going beyond the boundary of a Lambda function. AWS offers dozens of services that can be used to build any complex components of an Alexa skill. Databases such as DynamoDB and RDS, storage with S3, message queuing with SQS or notifications with SNS, and dozens of other services exist to make more meaningful and useful voice-first applications. Finally, this section will introduce you to how you can debug your Lambda function live, while it executes on the real AWS cloud, without any gimmicks, tricks, or simulations.

Checkout the final results

If you are in a hurry, check out this live unedited recording where we develop everything within 5 minutes for NodeJS and Python!

 

Part 1: Creation of the Alexa Voice User Interface (VUI)

Log in to the Alexa Developer Console to start defining your new Alexa skill. This part is independent of the Lambda function implementation language you will use. Click ‘Create Skill’ and provide the name of your new skill as ‘Chinese Zodiac Animal’. Select ‘Custom’ as the model, and ‘Provision your own’ as the skill’s backend, and click ‘Create Skill’ to complete the action.

When asked to select a template, select ‘Start from Scratch’ and click ‘Choose’. You will be taken to the ‘Build’ tab of the Alexa Developer console.

Alexa developer console

The Alexa developer console should already have ‘Chinese Zodiac Animal’ set as your Invocation Name. This is what you will need to tell Alexa to invoke your skill. If you wish, you can change it. However, the main sections we will focus right now are the Intents, where five built-in intents namely Fallback, Cancel, Help, Stop, and Navigate Home are already defined by default, and where you can add your own intents. Click the ‘Add’ button to add your own intent, and create a custom intent named ‘ChineseZodiac’.

create custom intent

Now you will be taken to the Intent definition, where you will need to provide the sample utterances that will invoke this intent. In addition, you will see ‘Intent Slots’ which are like variables, which will be interpreted as per the slot definitions, and passed onto your intent handler, if you wish to use any. Let’s define our intent to with the following sample utterances, where ‘year’ will be defined as a slot so that we will be able to understand the user’s year of birth stated as ‘Two thousand and one’ or ‘Nineteen seventy-five’ as the number 2001 or 1975 etc. Enter the first utterance as “What is the Chinese zodiac animal for {year}“, and as you type the curly braces, a popup would appear to either select an existing slot definition, or to define a new slot. Click ‘Add’ to define a new slot ‘year’ and click the ‘+’ icon at the right of the text box to add the utterance to the list. Next, specify another utterance as “What is my Chinese zodiac animal for the year {year}” and this time, select the existing ‘year’ slot definition, and click ‘+’ icon to add the utterance.   Finally, specify the Slot Type as AMAZON.FOUR_DIGIT_NUMBER for the slot ‘year’. Your final definition should now appear as follows.Alexa intent definition

To complete this section, click ‘Save model’ and then ‘Build model’ at the top row of the page. Once the model has been built, the last step is to go to the ‘Endpoints’ from the left navigation pane and note your Skill ID, which can be copied to your clipboard.

Alexa endoint definition

Full Tutorial

Here is the complete walk-through of building these applications in both Python and NodeJS with detailed instructions.


Next Steps

If you want to use NodeJS for your Alexa Skill implementation, follow Creation of the AWS Lambda function backend for Alexa with NodeJS article next, or if you wish to use Python, follow the Creation of the AWS Lambda function backend for Alexa with Python article next.