An example Amazon Alexa node.js skill integrated with Dialog Analytics running on AWS Lambda. Built with Amazon's alexa-sdk.
Clone this repository and run npm install
Create an account on https://app.dialoganalytics.com, grab your Dialog API token and bot ID.
If you have any trouble while following the next steps, you may want to refer to this more explicit example.
Before creating the Alexa Skill, let's create a Lambda function that will be invoked by asking Alexa, ask hello world ...
.
- Go to aws.amazon.com and login
- Create a lambda function. Leave all defaults, except the following configurations.
- In the select blueprint section:
- Select
Node.js 4.3
- Select
Blank Function
- In the configure triggers section:
- Select
Alexa Skills Kit
- In the configure function section:
- Name your function
- Select
Upload a .ZIP file
as the code entry type, ZIP THE FILES OF THIS DIRECTORY, NOT THE DIRECTORY ITSELF and upload it. - Drop down the Role menu and select
Create a new custom role
, click Allow to create thelambda_basic_execution
role. - Set environement variables with your Dialog API token and bot Id. Use
DIALOG_API_TOKEN
andDIALOG_BOT_ID
as variable names.
- Click Next and then Create function.
- Copy the ARN from the top right to be used later in the Alexa Skill Setup.
More information on AWS Lambda.
Go to the Amazon Developer Console and create a new Alexa Skill. Then follow the setup wizard and leave the defaults, except for the following configurations:
{
"intents": [
{
"intent": "HelloWorldIntent"
},
{
"intent": "AMAZON.HelpIntent"
}
]
}
HelloWorldIntent say hello
HelloWorldIntent say hello world
HelloWorldIntent hello
HelloWorldIntent say hi
HelloWorldIntent say hi world
HelloWorldIntent hi
HelloWorldIntent how are you
In the Endpoint section, select AWS Lambda ARN (Amazon Resource Name), enable a geographical region and past the lambda function ARN you've created earlier.
Good job, your done!
You can test your new skill in two ways. In all cases the conversation will be tracked by Dialog as soon as the skill is triggered.
In the Amazon Developer Console Test section you can input an utterrance and preview both the request and response of the lambda function. For example you could try: Say hello
Go to your Alexa App in the Skills section, and click on the Your skills button. You'll see the new skill listed, which means you can ask your Amzon Echo something like: Alexa, ask {name of your skill} to say hello
.
Read more on how to make the most out of the possibilities offered by Dialog here: https://dialoganalytics.com