<img alt="" src="https://secure.leadforensics.com/150446.png " style="display:none;">
Go to top icon

Creating your own Alexa skillset is quite exciting

Yash Agrawal Nov 05, 2018

Alexa Amazon Echo

Creating your own Alexa skillset is quite exciting
The digital devices and gadgets are becoming more and more inseparable part of our lives these days. There could be several reasons to explain this high adoption rate for the devices like Amazon Echo and Dot.

I am listing down a few quick ones that probably you also could relate to:

  • It lets us perform multi-tasking more easily than before
  • It lets us do things more quickly as compared to phone or laptop
  • It gets us fast answers to the questions that we have
  • It makes our daily routine easier

So, if you’re looking for a way to create Alexa’s voice-enabled skill then you’re at the right place!
Let’s create an Amazon Alexa skill from scratch using Node Server and using Lambda function service of AWS.

First sign up for an Amazon Developer account, if you don’t have one.

amazon-developer-services-and-technologiesGo to Alexa developer page.

Then go to the Alexa console.

amazon-alexa
Click on create skill.

creating-skillGive a name to the skill, I have named mine as employeeinfo and click on Next.

new-skillChoose a model to add to your skill. I’ve selected custom for my experiments.

Click on Create skill.

model
This way you reach to the Alexa skill dashboard.

get-started

Provide an invocation name. I’ve named it “run employeeinfo” and click on Save Model.

invocation

Click on the Endpoint.

endpoint

Now, we need to provide the endpoint to Alexa console. But before that, we need to set up an endpoint.

For setting up the endpoint we need to use AWS Lambda function service to get there.

Click on ‘Create function’ to create your own Lambda function.

funcs

After clicking, you will see your endpoint is generated at the rightmost corner of the dashboard as ARN.

alexachatbot
Copy and paste the ARN in the Lambda Endpoint Section of Alexa Console.
Click on Save Endpoint.

save-endpoint

Creating a Node server

Create a server which can accept POST requests on default location i.e. “/”.

There are so many techniques for creating a server, I personally prefer a Node.

I am assuming that you’ve Node, NPM and Visual Studio code installed already.

For the specific requirements of this tutorial, we will create a Hello World node app following the steps are given below:

  • Run npm init on a terminal. You will be asked for the package
  • Follow the terminal wizard in the package.json file
  • Run npm i express http - save and this will add the following entry in the package.json file:

”dependencies”: {
“express”: “4.16.3”,
“sql”: “0.0.2”
}

  • Set value to index.js of the main key in the package.json file
  • Add a file index.js on same level
  • Add the following code to the index.js file:
const express = require('express');
const app = express();
app.post('/', (req, res) =>
res.send({
version: '1.0',
response: {
shouldEndSession: false,
outputSpeech: {
type: 'SSML',
text: 'Hello World!',
ssml: '<speak>Hello World!</speak>'
}
}
}));
app.listen(8080, () => console.log('Example app listening on port 8080!'));

  • Set value of scripts to {“start”: “node index.js”}
  • Run npm start on the terminal
  • If everything is fine, you must see the following prompt:

exampleClick on JSON editor and provide the following model:
{
"interactionModel": {
"languageModel": {
"invocationName": "employeeinfo",
"intents": [
{
"name": "AMAZON.FallbackIntent",
"samples": []
},
{
"name": "AMAZON.CancelIntent",
"samples": [
"ya",
"Yups",
"yes",
"i have given wrong input",
"i want to know something else",
"i want to inquire for something else",
"i want something else",
]
},
"name": "AMAZON.PauseIntent",
"samples": []
},
],
"samples": [
"can i know info about {empname}",
"i want to know info about {empname}",
"can i get all info about {empname}",
"can i know about {empname}",
"i want to know about {empname}",
"i want to know full information about {empname}"
]
}
],

Click on Save Model and click on Build Model.

json-editor
Once the skill model is built - we need to test it. Click on the Test tab and toggle ON the “Test is enabled for this skill”.

test
That’s it, you’ve created an Alexa skill connected to your Lambda function on AWS.

This post is written based on documentation of AWS developer portal.

If you have any questions, leave your comments below.

Similar Blog

e-Zest is a leading digital innovation partner for enterprises and technology companies that utilizes emerging technologies for creating engaging customers experiences. Being a customer-focused and technology-driven company, it always helps clients in crafting holistic business value for their software development efforts. It offers software development and consulting services for cloud computing, enterprise mobility, big data and analytics, user experience and digital commerce.