Getting started with Voxa: Creating an Alexa skill Part 2

Wuelber Castillo
NicaSource
Published in
7 min readJul 2, 2018

Check out part 1 of this blog post series.

Create the skill in the Amazon Developer Portal

First before anything else we need to create an account in the Amazon developer portal or sign in into your account if you already have one. Once in, you can go to your dashboard to get started or click on the Developer Console link.

In your dashboard, click on Alexa skills kit on the top navigation bar, in the Alexa item.

You should be able to see your created skills (if you have any) and a blue button at the right with a Create Skill label on it, click it to start building our skill and its interaction model.

Choose a name for the skill, we’ll call it “Rock Paper Scissors” since we will build a rock paper scissors game, and choose the default language to be English (US) (you can choose any other language if you want to build a skill for other markets other than the US). Then choose a model for our skill, here we’ll choose custom since we’re building a custom interaction model. At the end of the page you can choose you’ll use to host your skill’s backend, “Provision your own” is the default option and that’s the one we’ll use, the other one is “Alexa-hosted” which is an option for people that want to code and host their skills within the Alexa and AWS environment directly (you can read more about it in here if you want). Anyways, click on the “Create a skill” button on the top right part of the screen.

After that, it’ll prompt you to choose a template for your skill. We’ll use the default option which is “Start from scratch”. Make sure that option is selected and click on the blue “Choose” button at the top right of the screen.

Set an invocation name for your skill

After that, it’ll show you the console of your skill that works to manage several parts of your skill like the invocation name, your interaction model, your endpoint, test your skill in the Alexa simulator, etc.

Let’s begin by setting the invocation name by clicking the “Invocation Name” option in the Skill builder checklist at the right of the screen.

Set the invocation name to “rock paper scissors”. Now if we want to invoke our skill we’ll say “Alexa open rock paper scissors”. Click on the “Save Model” button above the form.

Adding our first intent

Now we’ll add custom intents. You can see all the intents that your skills use at the left of your screen. As you can see there are some default intents built into the skill. Click on the “Add” button to start adding custom intents.

Let’s add an intent that we’ll use to start a new rock paper scissors game. Set “NewGameIntent” in the text input and click on create Custom Intent.

Now in the new screen that showed up, set the utterances for the intent, we’ll set utterances that will help the user start our skill. Enter the following utterances: “start a new game”, “let’s play again”, “start a game”, “let’s battle”. You can set the number utterances you want but I guess that will be enough. Click on the “Save Model” button.

The core intents of our skill

Let’s add the intents following the same steps when we added the “NewGameIntent”. These intents will be the core intents to play our game. Add the following intents with its utterances:

Notice that we added “caesar” (as in caesar’s salad) to the “ScissorsIntent” utterances. This is because “caesar” sounds very like “scissors” and if the user says “scissors” but Alexa understands “caesar” then we can be sure that Alexa will map that response to the “ScissorsIntent”. This is a really good example of how to “think like voice” when building a conversational experience.

Add an intent that uses slots

Before the user starts playing rock paper scissors, we’ll ask the user a wins limit number in order to win a whole game. For example, in order to win, the user needs to beat Alexa at rock paper scissor seven times, of course, if Alexa beats the user seven times then Alexa wins the game, but that limit (which in our example was seven) will be set by the user before starting a new game.

So let’s add a new intent with a name of “MaxWinsIntent”. The utterances of the intent will be: “{wins}” and “{wins} wins” (You can add more utterances if you like as long as you’re setting the {wins} slot). As you can see we are setting a slot which is called “wins” that will have the number the user is setting. When we’re setting an utterance with a slot, the console will show the option to select an existing slot or create one, of course, we’ll create one with the name “wins”.

After adding the slot and utterances we need to define the type of the slot. Below the recently added utterances you’ll see the list of slots you added, of course, you’ll only see the {wins} slot and a dropdown at the right side to select its type, in there search and select AMAZON.NUMBER which is the built-in slot type that Amazon provides to map numbers from the phrase the user said into the slots with that slot type. As you can see there’s a lot more slot type to choose from and also you can build custom slot types. Click on “Save Model” when you finish.

Adding built-ins intents

Amazon also provides built-in intents where we don’t need to define utterances because they’re already defined, for example, a “Yes” intent which has utterances related to an affirmative response like “yes”, “yeah”, “sure”, etc. One important thing to remember is that you can extend the built-in intents by adding more utterances but we’re not going to do that right now.

We’ll add two built-in intents that will be the Yes and No intents. To add a built-in intent click on the same button where we added the custom intents but now choose the ”Use an existing intent from Alexa’s built-in library” option that is below the “Create custom intent” option and search for “AMAZON.YesIntent”, then click on the Add Intent button at the right of the Intent name.

Do the same for the “AMAZON.NoIntent”. Click on the “Save Model” button when you’re done.

Build the whole interaction model

We have everything we need to start coding our skill. But now we need to build the interaction model which basically takes all the information from the intents, utterances and its slots and create an interaction model that Alexa will use to read the user’s responses and pass the information to our skill.

To build the interaction model click on the “Build Model” button next to the “Save Model” button.

Very Important: Every time you make a change in your interaction model you’ll need to build . the model again in order to test the changes. Saving your model will not update the model.

The process of building the model will take a few minutes but after that, we’ll be ready to code our skill using Voxa, let’s go and do that.

--

--