- Reference Alexa Skill
- Overview
- Setting up the Skill
- Project Structure
- Intents Reference
- Terms And Conditions
This document provides guidelines to setup and configure the Reference Alexa Skill. However, this document is not a primer for JavaScript and is intended for professionals who are familiar with the following technologies:
The Reference Alexa Skill is a flexible IoT skill, which communicates with Elastic Path’s RESTful e-commerce API, Cortex API. Through the Cortex API, the skill uses the e-commerce capabilities provided by Elastic Path Commerce and interacts with data in a RESTful manner.
Ensure that the following software are installed:
- Git
- Node.js
- A publicly available Cortex API endpoint.
- A publicly available Account Linking Server
- A valid Amazon Web Services (AWS) Account
- A valid Amazon Developer Account
-
Clone or pull the
alexa-skill
repository. -
In the Alexa Developer Console, create a Custom, Self-Hosted skill.
-
Select the Start From Scratch template.
-
Select the JSON Editor from menu on the left, under Interaction Model.
-
Drag the
models/en-US.json
file into the JSON Editor. -
Build the Model.
-
Select the Endpoint link from the menu on the left.
-
Enter the ARN for the Lambda you create in the Setting up the Lambda section, or an HTTPS endpoint where your skill is being hosted.
-
Save Endpoints.
-
Select Test from the header menu.
-
Select Development from the Skill testing is enabled in dropdown.
-
You can now begin testing.
-
Clone or pull the
alexa-skill
repository. -
Navigate to the
alexa-skill/lambda/main
. -
To install dependencies, run the
npm install --production
command. -
Zip up the contents of the current directory, including the
node_modules
folder. -
In AWS, create a Lambda function with an Alexa Skills Kit trigger. Currently, only the following AWS regions support Alexa Skills Kit triggers:
- Asia Pacific (Tokyo)
- EU (Ireland)
- US East (N. Virginia)
- US West (Oregon)
-
Enter the Skill ID from the Alexa Skill in the Configure Triggers input
-
Upload the zip file you created to your Lambda
-
Create an environment variable called
CORTEX_URL
that points to a publicly available Cortex endpoint. -
Save the function.
Local development is enabled using the alexa-skill-local module.
-
You must complete the Deploying the Skill to AVS section before developing locally.
-
Clone or pull the
alexa-skill
repository. -
Run the
cd lambda/main
command. -
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, navigate to
localhost:3001
to link your local development environment to your Amazon Skill. -
Take note the
ngrok
URL from the command line output. -
In a browser, navigate to the Endpoint link under your Alexa skill.
-
Select HTTPS enpoint.
-
Enter the URL from Step 8.
-
Save Endpoints.
-
New sessions will be directed to your local skill. Changes will be hotswapped, and local Node debuggers can be attached.
- Set up the Reference Account Linking server found here
- Log into to your Alexa Developer account at
developer.amazon.com
and navigateAlexa
>Your Alexa Consoles
>Skills
><Your Skill Name>
- On the left sidebar, scroll down and select
Account Linking
- Set "Do you allow users to create an account or link to an existing account with you?" to On
- Under Security Provider Information select Implicit Grant.
- Fill in the fields under Security Provider Information. Refer to the chart below
Field name | field |
---|---|
Authorization URI | Set to the endpoint of the Account Linking server you set up in step one (Note: An https:// endpoint is required) |
Client ID | An identifier for your skill |
Scope | An optional list of scopes that indicating the access the Alexa user needs. |
Domain List | Set to the Domain of your Account Linking endpoint |
- Press the save button
- To test, go to the Test tab and invoke the skill. Alexa should respond with asking the user to link account. You can find more information on account linking with Alexa Skills here.
The lambda function lives under lambda/main
.
You will find the Interaction Model for the skill under models/en-US.json
. For more information on the Interaction Model, visit the Alexa Developer Documentation
Below is a quick table of the intents the skill uses, the actions they represent, and some sample phrases you might use to trigger them. If you are relaying any errors found to the developers, it may be helpful to tell them which intent triggered the error.
For a complete list of sample phrases, check the Interaction Model.
Action | Sample Utterance | Intent Name |
---|---|---|
About Store | "What do you sell?" | DescribeStoreIntent |
Search | "Search for {item}" | KeywordSearchIntent |
Next | "Next item" | NextItemIntent |
Previous | "Previous item" | PreviousItemIntent |
Describe Current Product | "Tell me more about that" | DescribeProductIntent / DescribeListedProductIntent |
Add to Cart | "Add that to my cart" | AddToCartIntent |
Add to Wishlist | "Add that to my wishlist" | AddToWishlistIntent |
Explore Cart | "What's in my cart?" | GetCartIntent |
Explore Wishlist | "What's in my wishlist?" | GetWishlistIntent |
Move to Wishlist | "Move item two to my wishlist" | MoveToWishlistIntent |
Move to Cart | "Move item three to my cart" | MoveToCartIntent |
Remove from Cart | "Remove item number three from my cart" | RemoveFromCartIntent |
Remove from Wishlist | "Remove item number one from my wishlist" | RemoveFromWishlistIntent |
Checkout | "I'd like to check out" | CheckOutIntent |
In addition to these, the Alexa Reference Skill incorporates several out of the box Alexa intents.
Action | Sample Utterance | Intent Name |
---|---|---|
Yes | "Yes" | AMAZON.YesIntent |
No | "No" | AMAZON.NoIntent |
Help | "Help / What are my options?" | AMAZON.HelpIntent |
Exit | "Alexa, stop / exit" | AMAZON.StopIntent |
Cancel | "Cancel" | AMAZON.CancelIntent |
- Any changes to this project must be reviewed and approved by the repository owner. For more information about contributing, see the Contribution Guide.
- For more information about the license, see GPLv3 License.