This is a sample Chatbot using the Lex Lambda SDK. It also uses Java 8 and Amazon's Lex and Lambda services.
These instructions will get you up and running with your first Chatbot!
Here's what you'll need to use this SDK:
- Java 8
- Maven 3+
- The Lex Lambda SDK installed locally (see here)
- AWS Command Line Interface (CLI) installed locally (optional)
You will need to build the bot locally before you can use it.
First, clone this repository:
git clone https://github.com/SoftwareByMark/lex-lambda-hellobot.git
Then perform a Maven package to build the JAR files:
mvn clean package
This will create two JAR files in the target folder:
- A JAR with the compiled classes from this project
- An Uber JAR with compiled classes from this project and all dependant projects
The Uber JAR (named lex-lambda-hellobot-<version>-jar-with-dependencies.jar) is what you will manually upload to Lambda when your first create your function.
After you have created the Lambda function, you can subsequently update the Lambda function JAR file directly from Maven without having to log into the AWS Console! Note: you must have the AWS CLI installed locally for this to work.
To update the Lambda function, package up the code and execute the Exec plugin:
mvn clean package exec:exec -DLAMBDA_FUNCTION_NAME=<function name> -DAWS_ACCESS_KEY=<access key> -DAWS_SECRET_ACCESS_KEY=<secret access key>
The LAMBDA_FUNCTION_NAME define is the name of your Lambda function.
The AWS_ACCESS_KEY and AWS_SECRET_ACCESS_KEY defines are your IAM access keys that have permission to update your Lambda function.
This Chatbot is intended to have three Intents configured:
- HelpIntent
- HelloIntent
- GoodbyeIntent
You can use the built-in AMAZON.HelpIntent for this Intent.
This Intent has one slot named "Name" with type of AMAZON.US_FIRST_NAME. Sample Utterances would include:
hello {Name}
hey {Name}
yo {Name}
Sample Utterances would include:
Goodbye
User: hello, I'm Mark
Lex: Hello Mark
User: help
Lex: I'm a friendly bot. Just say: hello I'm <insert your name here>.
User: goodbye
Lex: Goodbye Mark
- Maven - Dependency Management
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Mark Borner - Initial work - SoftwareByMark
This project is licensed under the Apache License v2.0 - see the LICENSE.txt file for details