Amazon Alexa Console is one of the Platforms to develop chatbot that can be integrated with Amazon’s virtual assistant Alexa. The chatbot we create for Alexa is called Skill. “Skill” means developing some flow of conversation to make proper interaction with users such that it will provide information or do specific task on Alexa. Here we are going to build a skill — means design an interaction model for providing information about one business. We will call our store information model or design as “storeinfoBOT” for new skill in Amazon Alexa Console.
There are mainly three elements that we need to learn while developing Alexa Skill: intents, sample utterances and invocation name. Slots and Dialog components also play important roles to build skill more flexible and interactive with users. We’ll discuss about Slots too in this tutorial.
Let’s get started with creating your very first Amazon Alexa skill. We have created a step-by-step tutorial which you can easily follow and have your own skill created at the end of the tutorial.
1. First of all, open https://developer.amazon.com/ and click on sign-in button at the top-right corner. (In case you are new to Alexa, make sure to do registration first.)
2. After signing in you will land on a page which should look like below screenshot.
Click on Alexa option from menu bar and in sub menu, select Alexa skills kit which will land you on default Alexa Skills Development page where you can view all the skills you have created.
3. After following second step now you are in Alexa developer Console. To Create a new skill, click on Create skill option.
4. Provide Skill name in skill box. For developing store information skill we are choosing Custom model and choose Alexa-Hosted method for provision of backend design resources of model. See below screenshot for selection and click on Create Skill.
5. After fourth step, you will see below screen in that you can view your skill name on top left side as shown in figure and on right side you can see Skill Builder checklist for complete building skills.
6. Next step is to create invocation name.
Invocation name is required to initiate the conversation with Alexa. It is like identifier of our skill. When we build new skill, invocation name is already provided by default as per the skill name we have selected but if you want to change name you can change and give your invocation name. Eligible Invocation name has to follow the criteria given by Amazon Alexa.
To check invocation name, first we will go to the invocation page by clicking on Invocation option on left hand side menu. We will see default invocation name given by console. In green sentence they have given example of sample invocation.
7. Create custom intent:
Intent is one of the important elements of building skill. Set of intents represents action that users can do with our skill. For example, if user wants to know our store name and we have to provide him with the store name then we create custom intent named “storename”. When user will ask for store name this intent will be invoked and provide user with requested detail. Let’s check the below steps for better understanding of creating intent.
We can add custom intent by clicking on add. You can see below screen after clicking on add button:
After creating a new custom intent, alexa console will open detailed page of intent. In that, first we will add some “sample utterance”. Sample utterances are user phrases or utterances about particular intent to invoke that intent.
Now click on Intent confirmation toggle button which will open the box of Alexa prompt. In Alexa prompt we can add Alexa’s replies or responses to users for particular intent. We’ll discuss more about Intent Slots in later part of this blog.
8. You can see Save model and Build model Options on the top of screen. Click on Save Model to save your changes till now. Then you can click on Build Model which will train the model on latest changes you have done. If the skill is built properly you will see as below screenshot.
Now, to test your changes, you can use Utterance profiler.
9. By clicking on Utterance profiler you can check model response as given below. You can make multiple intents as per requirement of conversation flow and for better interaction with users.
10. Create a custom slot inside intents:
Slots play important role for gathering information when we have to deal with multiple values or parameters. For example, say suppose we want to collect information about colors in our intent so we make one slot named colors. That slot will be used to make list of all the colors we are going to user in the conversation. Let’s take an example for creating and better understanding of slot:
For “storeinfoBOT” we will create a custom intent named “storeproducts”. In this intent, we are adding some utterances which users may use to find information about product details.
Now, in the sample utterances we have added, we can select a word (in our case, product name) by double clicking on it which will open a box where we can configure custom slot. The box will already have a custom slot name, which we can change as per our preference. In our example, we double clicked on “pixelfour” and then re-named the slot to “multiproducts”. Click on add button to create the custom slot.
In previous step, we created a custom slot. If you want to use that custom slot again in another utterance then simply add one curly brace which will open a box where you can select previously created custom slot. Alternatively, if you select a text (by double clicking) then also you will get the box to select previously created custom slot. You can see in below screen shot we replaced “iphone XII” with slot named “multiproducts”.
We can also user custom slot in Alexa prompt response same as sample utterance using curly braces. When we use it in response, it will have dynamic value as per user’s input.
11. Manage custom Slot Types:
Alexa has many built-in slot types (we call them system defined slots) which can be used in utterances. System defined slots have names starting with AMAZON, so to add those, you can simply start typing AMAZON. and it will show you the available system defined slots.
Where system defined slots are not useful for our requirement, we can create our own custom slot types. Custom slot types are used for proper organisation of data for particular slot. Let’s take a look at an example for that.
Go to Slot types in left hand side menu bar and click on add button. Now in custom slot types page give name for your custom slot type. As you can see in screenshot, we give our custom slot type name “phonename”.
Now on left side menu under “Slot Types”, you can see phonename — the custom slot type we created in previous step. By clicking on “phonename”, you can add multiple values in that slot type as shown in screenshot.
As our Slot Type (named “phonename”) is created, now we can use it in “Intent Slots”. To do that, click on “storeproducts” intent on left side menu. Scroll down to “Intent Slots” section where you will find “multiproducts” slot. Here, under “Slot Type” column, we can add the slot types for “multiproducts” slot. In below screen we can see our custom slot type named phonename with other built-in slot types as discussed earlier.
At the bottom of “storeproducts” intent page, you can see that we are using custom slot as parameter for alexa prompt response too.
12. In Utterance Profiler we can test our “storeproducts” for custom slot “multiproducts”. As you can see in the screenshot, user input is “provide details of pixel four” out of which alexa detected “pixel four” as slot value and uses it in response.