Setting up the Alexa Skill
This section of the guide is sequential in nature. While each step is self-contained, they should be completed in order to avoid unnecessary complications.
Installing the Repository
# Clone the Git repository
git clone https://github.com/elasticpath/alexa-skill.git
# Go into the cloned directory
cd alexa-skill/lambda/main
# Install all the dependencies for the project
npm install --production
Deploying the Skill to AVS (Alexa Voice Services)
- In the Alexa Developer Console, create a
Custom, Self-Hosted
skill - Select the Start From Scratch template
- In the Interaction Model, select the JSON Editor
- Drag the
models/en-US.json
file into the JSON Editor - Build the Model
Setting up the Lambda
Zip the contents of the
alexa-skill/lambda/main
directory, including thenode_modules
folderIn AWS (Amazon Web Services), create a Lambda function with an Alexa Skills Kit trigger.
Note: Currently, only the following AWS regions support Alexa Skills Kit triggers:
- EU (Ireland)
- US East (N. Virginia)
- US West (Oregon)
Enter the Skill ID from the Alexa Skill configured in Deploying the the Skill to AVS in the Configure Triggers input (This can be retrieved through the Alexa Developer Console)
Upload the zip file you created to your Lambda
Create an environment variable called
CORTEX_URL
that points to a publicly available Cortex endpointSave the function
Deploying the Skill to AVS (Alexa Voice Services) - Part 2
- Return to the Alexa Developer Console, and navigate to the skill you created in Deploying the the Skill to AVS
- Select the Endpoint link
- Enter the ARN (Amazon Resource Names) for the Lambda you created in the Setting up the Lambda section, or an HTTPS endpoint where you host your skill
- Save the Endpoints
- In the header menu, select Test
- In the Skill testing is enabled in field, select Development
- You can now begin testing
Setting up a Development Environment
If you want to customize the skill, enable local development by using the alexa-skill-local module.
Before You Begin
Complete the Deploying the Skill to AVS section before you develop locally
Procedure
- Modify the
asl-config.json
file, replacing the placeholderskillId
value with your Alexa Skill ID - Run the
npm install
command to install depenedencies - Create an environment variable called
CORTEX_URL
that points to a publicly available Cortex endpoint, or a valid Elastic Path development environment - For more information, see The Starting Construction Guide
- Run the
npm start
command to start thealexa-skill-local
server - In a browser, go to
localhost:3001
to link your local development environment to your Amazon Skill Note: Note thengrok
URL from the command line output - Go to the Endpoint link under your Alexa skill
- Select HTTPS enpoint
- Enter the URL from step 7
- Save Endpoints
- New sessions are directed to your local skill. Changes are hotswapped, and local Node debuggers can be attached
Setting up Account Linking
You may now proceed to setup the login server as described here.