Debugging your Node voice apps locally Bespoken

This tutorial shows you how to get started developing for Alexa Skills Kit using a Nodejs Lambda.

Prerequisites

Getting Started

Clone the Amazon Alexa Skills Kit for JavaScript repo:

$ git clone https://github.com/alexa/skill-sample-nodejs-hello-world

Go to the source code directory of the sample:

$ cd skill-sample-nodejs-hello-world/lambda/custom

Run npm install to bring in dependencies:

$ npm install

Start bst proxy

For Nodejs Lambdas, bst proxy command, in addition to setting up the proxy, will run your lambda for you and even reload it on changes.

This will start the helloWorld lambda:

$ bst proxy lambda index.js

Configure your Skill

From the Alexa Skills Kit list within the Amazon Developer's Console:

Click on the "Create Skill" button

Fill out the Information tab

  • Give your skill a name, 'greeter' for example
  • Click on the "Create Skill" button

Leave the default "Start from scratch" option and click on "Choose"

Fill out the Interaction Model

  • Copy the Interaction Model from here
  • Click on the "JSON Editor" from the Interaction Model Options
  • Paste the Interaction Model
  • Click on the "Save Model" button
  • Click on the "Build Model" button

Configure the Endpoint

When you started the proxy, bst printed out a URL that you need to configure your skill:

$ bst proxy lambda samples/helloWorld/src/index.js
BST: v2.3.14  Node: v8.9.4

Your public URL for accessing your local service:
https://your-proxy.bespoken.link

Copy this URL as your endpoint, then:

  • Select the "Endpoint" option in your skill configuration
  • Select "HTTPS" for your service endpoint type
  • Paste the proxy url
  • On the SSL Certificate Option, select the middle option "My development endpoint is a sub-domain of a domain that has a wildcard certificate from a certificate authority"

Test

  • Go to the "Test" tab in the skill Configuration
  • Enable testing for development by clicking in the selector on the top of the page, it starts in "Off" by default.
  • On the service simulator, type: "Ask hello world".

You should get a valid JSON in reply: