How to Create Alexa Custom Slot Types
Int his article, see a tutorial that explains how to create Alexa custom slot types.
Join the DZone community and get the full member experience.Join For Free
The usability of the skill directly depends on how well the sample utterances and custom slot values represent real-world language use.
As Alexa best practices say:
"Building a representative set of custom values and sample utterances is an important process and one that requires iteration. During development and testing, try using many different phrases to invoke each intent. If you can observe other users during testing, note the phrases that they speak to invoke each intent. Continually update the custom values and sample utterances file to ensure that it includes instances of your users’ most common phrasings."
Custom Slot Types
First of all, what you need is to login to Amazon Alexa Console. Once you have completed this step, you must access any of your skills. If you don’t have a skill created yet, it’s time to create it.
Now let’s create your own custom slot type.
In the Build section on the left, there is an option called “Slot types,” as you can see in the image below. Click there to view the options that Alexa developer console offers to us.
Clicking the “Add” button, you will find a new section with two options:
- Create custom value type: This is the option we need in order to create a full new slot, which will be ready to use in our skill
- Use an existing slot type from Alexa’s built-in library: Here, you have all the slots that Amazon has made for you like months, days of the week, movies, etc.
Creating a slot
We are going to focus on the first option. Now you have to set the name of your new custom slot type and then click on “Create custom slot type button”:
You have two ways to add custom values to this list:
With a bulk edit: This option is very useful for a large set of values. It allows us to enter values with a comma-separated or .csv style. One slot value per line (formatted as VALUE, ID, SYNONYM1, SYNONYM2, …).
Entering one by one your values: To enter a value manually is as easy as filling in the field you have in that screen and then clicking enter. After entering this new value, you can set up the ID and the synonyms (which is the most important part of the custom value!)
Creating a slot
Here you have an example with all pokemons properly set in the Alexa Developer Console:
List of Pokemons
I have created some custom values for you if you want to reuse it. You can find them in this post.
That’s all, folks! I hope it will be useful! If you have any doubts or questions do not hesitate to contact me or put a comment below!
Opinions expressed by DZone contributors are their own.