One-page design sheets can be printed and used to sketch out ideas for a conversation with Alexa.
The following tools will enhance your developer experience.
- Have Node.JS on your laptop command-line, and become familiar with NPM, the Node Package Manager.
- Have GIT on your laptop.
- Have the AWS Command Line Interface (AWS CLI) installed and configured.
- Review the ask-sdk documentation.
When creating a new AWS Lambda function, you can choose the alexa-skill-kit-sdk-factskill
application from the Serverless Application Repository which automatically bundles in the ask-sdk. You can delete this code, and paste in sample code from this cookbook.
The online editor will work best if your skill code fits within a single file, however you can .
You may want to develop from a project folder on your local laptop for a number of reasons:
- You can create a project with more than one source file
- You can bundle in external Node.JS modules via NPM
- You can use your favorite text editor or IDE
- You can run unit tests locally
- You can upload your project to your personal GitHub repositoriy easily
You can download the entire Cookbook to your local hard drive in one of two ways:
- Click the green Clone or download button from the home page, and download the zip file. Be sure to extract everything to a new folder.
- If you have GIT installed, open a command prompt and run :
git clone https://github.com/alexa/alexa-cookbook
The examples each contain a /lambda/custom
folder which contains the index.js
source file.
When the code runs within AWS Lambda, it relies on the ask-sdk module, which is installed by default with the Fact skill application.
In order to test and deploy projects from your local laptop, you will need to bundle in required modules such as the ask-sdk within your /lambda/custom
folder.
Follow these steps to install the ask-sdk:
- Open a command prompt and navigate into the /lambda/custom folder where your index.js lives.
- Verify you have Node.JS installed by typing
npm --version
- Type
npm install --save ask-sdk
- You will notice a new folder called
node_modules
which contains anask-sdk
folder. - You can repeat and use any other Node modules to your project with the npm command.
- For example, you could install the open source SSML-Builder module via
npm install --save ssml-builder
Note: You can install the aws-sdk
locally, however it is already available within Lambda and does not need to be bundled into your deployment.
You can now test your project from the command line, or package and deploy it to the AWS Lambda service.
Once you are ready to deploy your local code back into AWS Lambda, you can zip the contents of your /lambda/custom
folder (just the contents, not the /custom
parent folder) and publish the Zip archive to your Lambda function.
Manual steps:
- Within your file explorer tool, double-click into the /lambda/custom folder
- Multi-select the index.js file, any other source files, the node_modules folder.
- Right-click and create a new zip file (zip, or send-to: compressed folder).
- Within the AWS Lambda console, create or locate the Lambda function.
- Within the Code section, locate the Code entry type dropdown.
- Click and select Upload a .ZIP file
- Locate and double click on the new zip file you made previously.
- You will need to click the blue "Save" button, or continue creating your new skill, for the upload to complete.
Using the ASK CLI:
From the folder with your skill.json file, enter ask deploy
.
See also How To Test
Back to the Home Page