Skip to content

arun-gupta/chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Your Own Chatbot using Java

This repository explains how to create a Star Wars chatbot using Amazon Lex and Java.

logo

The users can interact with this chatbot using the following means:

  1. Voice (Alexa, Phone/Call)

  2. Text (Phone/SMS, Facebook Messenger, Slack)

Here are the key components of architecture:

architecture

Deploy Lex bot and Alexa backend function using Java

You need to install org.sample.aws.lex:lex-java:0.2 dependency as explained at https://github.com/arun-gupta/lex-java#install-jar-locally before building this project.

mvn -f starwars-chatbot/pom.xml clean package install

ARN for Alexa function: aws lambda get-function --function-name StarWarsChatbot --region us-east-1 | jq .Configuration.FunctionArn

Note
Getting Started with Alexa skill using Java is explained at https://github.com/arun-gupta/alexa-skill-java.

JSON Document

Data is loaded as JSON documents in DynamoDB. Here is a sample JSON document:

{
  "dead": true,
  "force-sensitive": true,
  "force-side": "light",
  "id": 1,
  "lightsaber": "green",
  "planet": "Dagobah",
  "quotes": [
    "When nine hundred years old you reach, look as good you will not.",
    "Truly wonderful, the mind of a child is",
    "A Jedi uses the Force for knowledge and defense, never for attack",
    "That is why you fail.",
    "Adventure. Excitement. A Jedi craves not these things.",
    "Judge me by my size, do you?",
    "Fear is the path to the dark side",
    "Wars not make one great",
    "Do, or do not. There is no try",
    "Size matters not",
    "The dark side clouds everything",
    "Impossible to see the future is",
    "Clear your mind must be",
    "Much to learn you still have ... my old padawan"
  ],
  "weapon": "lightsaber",
  "whoami": "Yoda"
}

Create Global Secondary Index on whoami

Different platforms

Twilio/SMS

  1. Send a message to 408-913-9827 as shown below:

sms

Alexa

  1. Test using http://echosim.io or Alexa

Web

TODO

Mobile

TODO

Logging using Amazon CloudWatch

Monitoring using AWS X-Ray

TODO

How to talk to the chatbot?

Use phrase Ask Star Wars for Alexa, otherwise just the text as is. The list of questions is at https://github.com/arun-gupta/chatbot/wiki/Typical-Questions.