An AWS Lambda template for building Alexa Skills. This template provides the shell that can be used to set up a working Alexa Skill on AWS and the Amazon Echo.
This skill will run locally to support development and testing. When ready to push the code to AWS Lambda to test as an actual Alexa skill, AWS Lambda needs to be configured and code pushed to it, and then the Alexa Skill needs to be set up. Prior to the following steps, you will need to set up an AWS Developer account and get set up on the AWS Free Tier to enable development, testing, and hosting for free for 12 months.
After successful sign-up of an AWS account, perform the following setups.
AWS Template Installation
- Clone (or fork) using
git clone git://github.com/rickwargo/alexa-app-template.git my-alexa-skill.
- cd my-alexa-skill
- npm install
- gulp lint
- gulp test
- edit config
- develop app
- gulp build
- gulp push
AWS Lambda Setup
You can view one of the many tutorials (e.g., Creating an AWS Lambda Function for a Custom Skill) on adding a function to Lambda or use the gulp task:
gulp push-lambda. This task will create or update the function with the defaults specified in aws-config.js.
Alexa Skill Setup
- Go to the Alexa Console and click
Get Startedunder Alexa Skills Kit and then click the
Add a New Skillbutton in the top right.
- Set the
nameof the new skill name and an appropriate
invocation name- this is what is used to activate your skill.
- Optionally, set the version number of the skill, I recommend a 3-part version such as 1.0.0.
Lambda ARN (Amazon Resource Name)for the
Endpointand paste the ARN copied from the above step. Click
- Copy the Intent Schema from
assets/speech/IntentSchema.json. This file was created from source during the gulp build step above.
- Create the Custom Slot Types (if any) using the information from
assets/speech/CustomSlotTypes.txt. This file was created from source during the gulp build step above.
- Copy the Sample Utterances from
assets/speech/SampleUtterances.txt. This file was created from source during the gulp build step above. Click
- Go back to the
Skill Informationtab and copy the
Application Id. Paste the
Application Idinto package.json and config/aws-config.js.
- Add the AWS Function Name to config/aws-config.js.
- If the timeout is changed from the default of 3, adjust the setting in config/aws-config.js.
- Fill out the
Descriptiontab. You can use icons in images folder as a start but copy with your own icons.
Prepare for Testing on Echo
- Update the lambda source zip file with this change by using
gulp buildand upload to lambda again. You can also use
gulp push-lambda-codeto build the zip file and upload it to AWS Lambda. This assumes your information has been stored in the environment or in the
- You are now able to start testing your sample skill on the Amazon Echo! You should be able to go to the Echo webpage and see your skill enabled.
- In order to test it, try to say some of the Sample Utterances you created.
- Your skill is now saved and once you are finished testing you can continue to publish your skill. Make sure to pay close attention to the information in Submitting an Alexa Skill for Certification, especially the Submission Checklist.
- At some point prior to Submitting for Certification, you will need to complete the information on the
Publishing Informationtab. This can be done now and saved.
- If there is no response, check the application Id is set up correctly.
This template supports the following development practices through gulp:
|build-assets||Build assets for updating Alexa Skill Model ** Aliases: assets|
|build-custom-slot-types||Build the custom slot types from source ** Aliases: slots|
|build-intent-schema||Build the intent schema from source ** Aliases: intent, intents|
|build-lambda-code||Process source and create dist.zip file to upload to AWS lambda ** Aliases: build|
|build-utterances||Build the utterances from source ** Aliases: utterances|
|build-zip||Process source and create zip file|
|clean||Clean out the dist folder and remove the compiled zip file|
|config||Compile/move config files to dist|
|create-zip-file||Zip the dist directory ** Aliases: zip|
|gather-node-mods||Install npm packages to dist, ignoring devDependencies|
|help||Display this help text.|
|lint||Lints all server side js|
|node-mods||Install npm packages to dist, ignoring devDependencies|
|push-lambda-code||Process source then upload to AWS lambda ** Aliases: push|
|quick-build-zip||Process source and create zip file (without rebuilding node modules)|
|quick-push-lambda-code||Process source then upload to AWS lambda without updating modules ** Aliases: quick, quick-push|
|rm-dist-package||Removes unnecessary package.json from dist so it does not go to AWS Lambda|
|super-quick-push-lambda-code||Process source then upload to AWS Lambda without updating modules|
|test-mock||Run unit tests against AWS lambda ** Aliases: test|
|test-local||Run unit tests against local server|
|test-lambda||Run unit tests against AWS lambda|
|test-and-cover||Run unit tests against local server and run coverage tool ** Aliases: cover|
|upload||Upload zip file to lambda|
|vendor||Compile/move vendor files to dist|
|watch-lint||Watch for changed files and run lint of the file that has changed|
|watch-test||Watch for changed files and run unit tests when a file changes|
|zip||Zip the dist directory|