Starter Template for Alexa Development Environment based on alexa-app
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.
Development with this starter template is best done using alexa-app-root, an alexa-app-server derivation that offers a UI/webpage specifically designed for testing and development.
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.
- 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
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.
- Go to the Alexa Console and click
Get Started
under Alexa Skills Kit and then click theAdd a New Skill
button in the top right. - Set the
name
of the new skill name and an appropriateinvocation 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.
- Select
Lambda ARN (Amazon Resource Name)
for theEndpoint
and paste the ARN copied from the above step. ClickNext
. - 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. ClickNext
.
- Go back to the
Skill Information
tab and copy theApplication Id
. Paste theApplication Id
into 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
Description
tab. You can use icons in images folder as a start but copy with your own icons.
- Update the lambda source zip file with this change by using
gulp build
and upload to lambda again. You can also usegulp push-lambda-code
to build the zip file and upload it to AWS Lambda. This assumes your information has been stored in the environment or in the~/.aws/credentials
file. - 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 Information
tab. 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:
Available tasks | Description |
---|---|
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 |
default | [help] |
help | Display this help text. |
lint | Lints all server side js |
make-dist | Compile/move javascript files to dist |
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 | [watch-lint, watch-test] |
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 |