This repo is used as template for an alexa skill. It uses a best practice setup with the ask cli and serverless framework. All tools come out of the box and you can deploy not only the code but also the developer console stuff like intents, models and skill-store informations. The example skill in the repo is configured for us-english and german.
The details and motivations are explained in a medium post.
- Node & NPM
Typically you create a new skill with ask new
command but as this will create a slightly different folder structure
that is used in this template here you should create the skill once in the developer console. Just create the skill,
add a name and invocation and then grab the skill id. All other stuff will be configured in the config files from this
template.
After you have created the skill in the developer console do the following:
- Clone this repo
- Setup your aws credentials
- Rename the
config.example
toconfig
and replaceYOUR_SKILL_ID
with the skill id you copied - Run
npm install
- Deploy the skills function with
npm run deploy:init
. - Display the functions ARN with
npm run deploy:info
. Copy the ARN, but without the trailing number (should be ':1') to point to the latest version every time you redeploy your code. - Replace
YOUR_LAMBDA_ARN
with the ARN you copied in theconfig
file - Run
npm run deploy-skill:init
to connect your setup with your amazon developer console - Deploy your skills information with
npm run deploy-skill
You can now go to the skill store, activate your skill and try it out :)
All of your skills code is in the src
folder.
There are 4 commands in the npm scripts that do most of the stuff you need:
npm run deploy
: upload the skills codenpm run deploy:init
: do an initial setup of all AWS components and upload your skills code (this is only necessary when you initialize the project or update theserverless.yml
file)npm run deploy:info
: display all lambda infos, for example the ARNnpm run logs:tail
: get a stream of the lambda functions logs into your console (very helpful for "console debugging")
Most of the time you will only need the deploy
and logs:tail
script.
All the commands are based on serverless, which is configured in the serverless.yml
file. This file
defines your infrastructure and "links" it to code.
All settings from the developer console are defined in the .ask/config
, skill.json
and
the language specific models in the models
folder.
npm run deploy-skill:init
: connect this project with your amazon developer console (you only have to do this once)npm run deploy-skill
: upload the configuration files to the amazon developer console
Note: The current ask cli doesn’t support updating the models json when you changed it with the skill builder. It can only clone the complete project and overriding the current one. A workaround after doing some stuff with the skill builder would be to clone the project into a new folder and then copy&paste the models json into the current project.