AWS: How to create your first Alexa skill

Step 1 - Register with Amazon Developer + AWS

You will need to register with both of these services:

  • Amazon Developer - Amazon Developer will guide you towards making an Alexa Skill.
  • Amazon Web Services - AWS will help you create a Lambda function to handle the skill requests.

Step 2 - Create a New Skill + Invocation

Skills are built-in capabilities for Alexa to give users new experiences, and we first create our Skill using Amazon Alexa Developer Console.

How do I get started?

Once you log into the Amazon Alexa Developer Console, select Alexa > Alexa Skills Kit to get started.

What do I name my Skill?

Skills require two things to work successfully: an invocation name and an utterance. When you enter a "Skill Name," you are naming its Invocation. Invocations are phrases that link the interaction with a custom skill.

Since I work for Classical KUSC, my Invocation will be titled ninety one point five which means that users will have to say,

"Alexa, ask ninety one point five."


Let's start an Alexa skill from scratch.


You have completed the first step in our checklist. Now let's move on step #2.


Step 3 - Create an Intent + Utterances

Intents

Intents are what a user specifically wants to do. Using the previous Invocation, we're going to help users ask, "Alexa, ask ninety one point five what's playing?"

Utterances

Not everyone is going to ask a radio station "what's playing" in the same way, so we use utterances to consider other ways to ask for the same data. Utterances are derivatives of your original request but said differently. For example, here are two similar requests for information and what's implied by the user that is they want to know what's playing right now.

  • "Alexa, ask ninety-one point five composers ".
  • "Alexa, ask ninety-one point five the composer's name".

Utterances are useful because they will help you improve the accuracy of Alexa and help you reach new audiences from different age ranges. For example, maybe you want to reach a younger audience, and they may be more inclined to ask,

  • "Alexa, ask ninety one point five names ".
  • "Alexa, ask ninety-one point five titles ".
  • "Alexa, ask ninety-one point five 'da name".

Below is a list of my utterances.


Step 8 - Get Your Alexa Skill ID

You will need your Skill ID for the next steps. You can find it by first selecting the menu.

Select "View Skill ID" to access your Skill ID string.


Step 9 - Create your skill response

Once you've configured Alexa to consider your solution to solve a user's request, you'll need to create the actual answer. We will use Node on AWS Lambda so that we do not have to meddle with any servers.

Visit AWS Lambda

Create a new function.

Author a function from scratch.

If you notice, I have a role called role-lambda-basic-execution. This role was created within AWS IAM and looks like this.

Connect Alexa to Lambda

After you've completed the initial lambda from, you'll get the chance to connect the Alexa skill to your lambda function.

Take note that you will need to paste the skill id that you received from step 6.


Step 10 - Build your Skill

Here is the Javascript code we'll use to respond to our user's request.

const Alexa = require('alexa-sdk');

// Register the handlers
const handlers = {
    // A. This is the first thing that happens when Alexa is invoked. 
    //    Think of it as a constructor function.
    'LaunchRequest': function() { 
        this.emit('LaunchIntent');
    },
    // B. This will be Alexa's first response.
    'LaunchIntent': function() {
        this.emit(':ask', "How are you today?");
    },
    // C. This will be called through the intent schema and utterances.
    'HelloIntent': function() {
        this.emit(':tell', "I'm great. You have successfully created your first skill with Amazon Alexa.");
    }
};

exports.handler = (event, context, callback) => {
    var alexa = Alexa.handler(event, context);
        alexa.registerHandlers(handlers);
        alexa.execute();
};

Step 11 - Simulator testing

Now that we've created a skill, created an invocation with utterances, and a Javascript solution, it's time to test our app.


Step 12 - Hardware testing

Your hardware device must match your

Visit alexa.amazon.com to pair your hardware device with your Skill.