Create an Alexa Skill Part 1: Building a Voice Interface and Interaction Model

Published Jan 05, 2017Last updated Feb 01, 2017
Create an Alexa Skill Part 1: Building a Voice Interface and Interaction Model

What is an Alexa Skill?

Created in 2014, the Amazon Echo is a hands-free speaker you control with your voice. Alexa is the voice service that powers the Echo and allows customers to interact with the device. As third-party developers, we can create apps or in this case, "skills" that users can download and interact with. One Alexa skill might help you find a good book—another might give you information about your favorite TV Show. The possibilities are endless!

In this tutorial, we are going to make a skill that tells you facts about a given Zodiac sign. So with this skill, you could say, "Tell me about Leos," and the echo would respond with "Leos are known to be proud, loyal, charismatic, and stylish" or something like that. You could also say, "Tell me about Virgos," and the echo would respond with a fact about people with the Virgo sign.

Creating a Voice Interface

There are two main parts to creating an Alexa skill. First, we have to build the voice interface, which will consist of what types of things the user can say and what meaning each phrase has. In a future tutorial, we'll complete the skill by adding a lambda function, which will contain the code for the skill's functionality. Although this may seem broad now, we'll be getting into the details soon enough! The most common way to make an Alexa Skill is by using JavaScript.

For this first part, you should be comfortable working with JSON objects in general, but in later parts, JavaScript will play a larger role.

Sample Utterances

To create our voice interface, we have to figure out what the user will say. We do this through something called Sample Utterances. For our skill, some utterances might include

  • Tell me about {Zodiac}
  • Tell me about a {Zodiac}
  • I want to know more about {Zodiac}
  • I want to know more about a {Zodiac}
  • Talk about {Zodiac}
  • Talk about a {Zodiac}
  • Tell me some facts about {Zodiac}
  • Tell me some facts about a {Zodiac}
  • What are the zodiac signs?
  • What are the zodiac signs again?
  • Tell me the zodiac signs
  • Tell me the zodiac signs again

Notice, we have some of the zodiac phrases in handle bars—this is because Zodiac will be the name of a slot. A slot is like a variable that will have a specific value when implemented. For example, when the user says "Tell me about a Libra," the zodiac slot has the value Libra or if the user says "Talk about Cancer," the zodiac slot would have the value Cancer. We will need to enumerate the possible values for the zodiac slot, but that will come later. For now, it is just important to know that the value of the zodiac slot from what the user says will determine what Alexa says back to the user.


Lots of things we say have the same meaning and with Alexa, we handle this with Intents. Each sample utterance is mapped to an Intent that represents its true meaning. For example, Talk about {zodiac} and Tell me about {zodiac} would be mapped to the same intent because they both represent the same type of request, asking Alexa for facts about a specific Zodiac sign. Furthermore, Tell me the zodiac signs and What are the zodiac signs? would also map to the same request as they ask Alexa to list all of the Zodiac signs. There are also built-in intents like AMAZON.YesIntent and AMAZON.HelpIntent that already have utterances assigned to them. We can map more utterances to these built-in intents, but that will come later in this tutorial.

Put it in the Cloud

With the basics down, let's go to to get started. Your web page will probably look something like this.

Alexa skill

Click the sign in button in the upper right-hand corner and sign into (or create) your Amazon account. Once you're in, you should see something that looks like this.

alexa skill

Click Alexa at the top and then click Alexa Skills Kit.

alexa skill

Click Add a New Skill on the right and we'll go ahead and start creating our skill. Once you're on the page, add a skill name — here, I'll put Zodiac Facts — and an innovation name. The skill name is how the skill will be named on Amazon and the Alexa store and the innovation name will determine what the user says to start a skill.

For content not built into the Amazon Echo, the user must first download the skill and then to start the skill, the user must say "Start [Innovation Name]," where Innovation Name is the skill's innovation Name. With the skill name and innovation name added, your page should look something like this.

Alexa Skill

Clicking next, we'll move into the Interaction Model, which will hold the code for our voice interface. The first part is called the Intent Schema. The intent schema will have all of our possible intents — in other words, all the possible meanings our sample utterances can have. For this skill, our intents will include:

  • GetZodiacFactIntent
  • AMAZON.GetHelpIntent
  • AMAZON.CancelIntent
  • AMAZON.StopIntent

The user will be able to get facts about a certain Zodiac sign, get help if they can't remember the Zodiac signs, and cancel or stop the skill at any time. Our intent schema is going to be a JSON object that includes all of our intents so it should look something like this:

  "intents" : [ {
    "intent": "GetZodiacFactIntent", 
  }, {
    "intent" : "AMAZON.HelpIntent"
  }, {
    "intent" : "AMAZON.StopIntent"
  }, {
    "intent" : "AMAZON.CancelIntent"

However, we are missing one thing — our Zodiac slot! In the utterances mapped to the GetZodiacIntent, we'll need to specify exactly what Zodiac sign we want facts about. To add this slot in, we'll just add a slots attribute to the specific object, name it zodiac, and give it the type LIST OF SIGNS (with underscores).

  "intents" : [ {
    "intent": "GetZodiacFactIntent", 
    "slots": [
        "name": "Zodiac",
        "type": "LIST_OF_SIGNS"
  }, {
    "intent" : "AMAZON.HelpIntent"
  }, {
    "intent" : "AMAZON.StopIntent"
  }, {
    "intent" : "AMAZON.CancelIntent"

Pasting this into our intent schema on Amazon, your screen should resemble something like this:

alexa skill

Next, we'll enumerate the possible values for our custom slot, Zodiac. Click Add Slot Type and for Type, write LIST OF SIGNS (with underscores) and for values, write:


In the end, it should look something like this.

alexa skill

When you are finished, click Save. The last part of creating our Interaction Model is listing the sample utterances as well as what intents they map to. We'll use the sample utterances we created above and write the intent associated with each in front of the each phrase. Be sure to make each sample utterance (not intent or slot name) lowercase and remove any punctuation.

GetZodiacFactIntent tell me about {Zodiac}
GetZodiacFactIntent tell me about a {Zodiac}
GetZodiacFactIntent i want to know more about {Zodiac}
GetZodiacFactIntent i want to know more about a {Zodiac}
GetZodiacFactIntent talk about {Zodiac}
GetZodiacFactIntent talk about a {Zodiac}
GetZodiacFactIntent tell me some facts about {Zodiac}
GetZodiacFactIntent tell me some facts about a {Zodiac}
AMAZON.HelpIntent what are the zodiac signs
AMAZON.HelpIntent what are the zodiac signs again
AMAZON.HelpIntent tell me the zodiac signs
AMAZON.HelpIntent tell me the zodiac signs again

Here, we correlate any phrases about getting facts for a certain Zodiac sign with the GetZodiacIntent and any phrases about hearing a list of Zodiac signs with the AMAZON.HelpIntent. The AMAZON.CancelIntent and AMAZON.StopIntent already have sample utterances connected to them and there are no phrases we'd like to add so they are not included in the sample utterances portion. Once inputted, it should look like this.

Alexa skill

When you are ready, click the Save button and this will build your interaction model. If you have any syntax errors, this is when you will get a warning and you'll be able to edit your code appropriately.

Now what?

We have our voice interface and interaction model down, but all we have is an interface. Our skill doesn't actually do anything yet. In the next tutorial, we'll learn how to connect a lambda function to our skill to give it some functionality. Check it out here.

Discover and read more posts from Kathryn Hodge
get started