Amazon Alexa Skill Development

Haritha Senevirathne
4 min readFeb 14, 2020

--

Basic skill development in Alexa Developer Console

Before anything else you have to create an Alexa development account. Then you will come to a screen as below,

alexa developer console

If you are logging in for the first time, you won’t be seen any ongoing skills in the table as above. Now press the Create Skill button on the right side.

In here you have to include a name for your skill. I’ll add as “first skill”. Then leave the model as Custom since we are going to develop a simple skill.

In here, select Alexa-Hosted (Node.js). Then the system itself will create a node server for us. If you are done with this screen hit create skill button at top right corner.

In here keep the default selection and press choose button. Then system will take couple of minutes to create development environment for you.

main screen

Then you will come to a screen like this. Under skill builder checklist, select Invocation Name. Invocation name is the key word that you will be using to call/run your skill.

Skill Invocation

There you will see an invocation name as “first skill”. This name is the one you’ve given when creating the skill. You can change invocation name as you desire in here.

“Open first skill” or “Alexa open first skill”

Next important one is Intents. Intent is like an event that triggers base on user input(text/voice). You will see the system itself has created 4 built-in-intents for us. Those are some common intents that will be using in every skill. There you will see HelloWorldIntent, select it.

HelloWorldIntent

Here you will see that there are 7 ways you can trigger/call this intent. In here you can add new utterances if you want.

If you still can’t understand how this works don’t worry, read along.

If you have done any changes here, hit save model and then build model. Once it is done saving select code tab from the top panel.

index.js

In the index.js you will see complex code segments. Since this article talks about simple skill development I will only focus on above mentioned 2 methods.

Go the the Test tab.

Select Development from the drop down menu.

Test 01

Let’s start your skill by typing open first skill(invocation name). If first skill is the invocation name, LaunchRequestHandler method activates.

LaunchRequestHandler

Then Alexa will respond with what’s in the speakOut variable.

Test 02

Then type hello(don’t forget that you can trigger this intent in 7 different ways as I mention in HelloWorldIntent tab). This will trigger the HelloWorldIntent (see HelloWorldIntentHandler in index.js). Response will be of course Hello World since speakout variable container Hello World string.

“Utterances trigger the relevant intent”

Basic understanding,

Here you will see 2 methods, canHandle() and handle(). If canHandle() returns true then handle() executes. This applies everywhere.

So back to the code,

return Alexa.getRequestType(handlerInput.requestEnvelope) === ‘LaunchRequest’;

Here the system trying to find out whether the user input is a ‘LaunchRequest’. WHAT DOES THAT MEAN? Which means this returns true when user triggers Invocation Name.

“Open first skill” or “Alexa open first skill”

If it returns true, then handle() method should run.

Hope you understand basics of Alexa skill development. In the next article I will be talking about how to add variables to intents. :D

Conclusion

Creating a Alexa developer account is very simple and free. It is fun to create a skill that can do some work by triggering a simple voice command. Today, Alexa APIs are used heavily on educational purposes. Lots of institutes and universities are using these systems so that students as well as lecturers can perform well and easily.

--

--