- Some familiarity with command line tools like terminal (mac) or CMD or bash shell (Windows).
- Node.JS version 6 or higher installed on your laptop
Recommended
- Git for cloning this project
- AWS CLI or ASK CLI for zipping and deploying your project to AWS Lambda.
- Clone this repository to your laptop:
- Open a command prompt (black background is best)
- Type
git clone https://github.com/robm26/testflow
- Or, download and extract the repository from the green button on the project home page.
The test project is ready to run, however you can review or update configuration settings defined in the testflow.js file.
- Open
testflow.js
in your favorite text editor - Review
SourceCodeFile
andhandlerName
values. These currently point to an included sample project source file and function. Adjust these as necessary.
const SourceCodeFile = './sampleskill/index.js';
const handlerName = 'handler'; // 'lambda_handler'
- Notice the folder
/dialogs
which contains dialog sequence files. The default dialog file is called default.txt but you can override this when executing a command.
let MyDialog = './dialogs/default.txt';
- Review the options object. These values can be changed as you wish.
Your code project likely contains some dependencies on other Node modules.
These are listed at the end of the package.json file.
You can install all required dependencies by typing npm install
from within your project folder.
- From the command prompt, CD into the sampleskill folder
- Type
node install
to install required dependencies. If this fails, trysudo node install
- Execute
node testflow
and observe the skill code respond to a LaunchRequest, Help, and Stop command. - Execute
node testflow breakfast.txt
and observe the skill code respond to a custom dialog sequence.
Note: You may want to install the AWS-SDK globally for use by any project.
Simply run npm install aws-sdk --global
This will setup your laptop with the AWS-SDK, similar to the AWS Lambda runtime environment,
which also has the AWS-SDK available.
All other Node.JS packages must be installed directly into your project and included in the zip file you publish to AWS Lambda.
You can further optimize your project by removing the aws-sdk folder from your node_modules folder. The ask-sdk installs it, however if you are using AWS Lambda then it would already be available. Removing this one module should greatly reduce the size of your project, so that it is small enough to support the AWS Lambda Code9 code editor.
You can copy testflow into your own project folder.
- Copy and paste the
testflow.js
file and/dialogs
folder to your project folder. - Customize the settings within the top of the
testflow.js
file
- Adjust the path defined by
const MyLambdaFunction
to the location of your source file, typically'./lambda/custom/index.js'
;
- Create a new dialog sequence file with your Intents in sequence, such as
mytest.txt
- Run from the command line:
node testflow mytest.txt
Follow the tutorial to learn more! TUTORIAL