Skip to content

Latest commit

 

History

History
87 lines (60 loc) · 3.34 KB

Readme.md

File metadata and controls

87 lines (60 loc) · 3.34 KB

Amazon Alexa Skill in Node.js

An example Amazon Alexa node.js skill integrated with Dialog Analytics running on AWS Lambda. Built with Amazon's alexa-sdk.

Getting started

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.

Creating an Amazon Lambda function

Before creating the Alexa Skill, let's create a Lambda function that will be invoked by asking Alexa, ask hello world ....

  1. Go to aws.amazon.com and login
  2. Create a lambda function. Leave all defaults, except the following configurations.
  3. In the select blueprint section:
  • Select Node.js 4.3
  • Select Blank Function
  1. In the configure triggers section:
  • Select Alexa Skills Kit
  1. 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 the lambda_basic_execution role.
  • Set environement variables with your Dialog API token and bot Id. Use DIALOG_API_TOKEN and DIALOG_BOT_ID as variable names.
  1. Click Next and then Create function.
  2. Copy the ARN from the top right to be used later in the Alexa Skill Setup.

More information on AWS Lambda.

Creating an Alexa skill

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:

Configuration Model

Intent Schema

{
  "intents": [
    {
      "intent": "HelloWorldIntent"
    },
    {
      "intent": "AMAZON.HelpIntent"
    }
  ]
}

Sample Utterances

HelloWorldIntent say hello
HelloWorldIntent say hello world
HelloWorldIntent hello
HelloWorldIntent say hi
HelloWorldIntent say hi world
HelloWorldIntent hi
HelloWorldIntent how are you

Global Fields

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!

Usage

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.

Service Simulator

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

Your Skills

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.

Go further

Read more on how to make the most out of the possibilities offered by Dialog here: https://dialoganalytics.com