Hands-On Chatbot Development with Alexa Skills and Amazon Lex


Hands-On Chatbot Development with Alexa Skills and Amazon Lex (2018) .. by Sam Williams


Table of Contents

Preface

Chapter 1: Understanding Chatbots

What are chatbots?
What makes up a chatbot?

Intents
Slots
Utterances

Designing conversation flows

Starting with the perfect conversation diagram
Conversation flow diagrams
Creating a conversation flow diagram
User stories

Best practices

Handling errors

Missed utterances
External APIs
Errors in your code

Tone of voice
Identifying suitable use cases
Designing the information for the delivery method

Amazon Alexa and Lex

Amazon Alexa
Amazon Lex

Summary
Questions

Chapter 2: Getting Started with AWS and Amazon CLI

Technical requirements
Creating an account

Setting your region
Navigating around AWS

Creating a Lambda

AWS Console
Setting up the Lambda
Writing your Lambda function’s code
Triggering Lambdas

Methods for working with Lambdas

Method 1 – Lambda Console
Method 2 – Cloud9 editor
Method 3 – Local editing

Creating the best local development environment

Choosing an IDE
Installing Node and NPM
Folder structure
Setting up AWS CLI
Creating a Lambda using AWS CLI
AWS CLI build script
Git
Local development setup

Summary
Questions

Chapter 3: Creating Your First Alexa Skill

Technical requirements
Alexa Skills Kit
Creating a Lambda to handle the request

Creating handlers
Building and configuring the Lambda
Finishing skill configuration

Testing your skills

Troubleshooting your skill

Creating a more useful skill
Conversational flow diagram

Creating the Alexa Skill

Creating an Intent

Internal Slots
Finding the Skill ID

Creating the Lambda

Handling the whichCar Intent
Amazon S3
Accessing our S3 data

Adding S3 permissions
Dealing with our data
Testing our Lambda

Finishing the Alexa Skills Kit Configuration

Testing

Launching your skill
Summary
Questions
Further reading

Chapter 4: Connecting Your Alexa Skills to External APIs

Technical requirements
External APIs

Open Weather Map API

Creating our weather skill

Conversation flow design
Creating the skill on Alexa Skills Kit
Building Lambda to handle the requests
Making an API request
Final setup and testing

Improving user experience

Error-handling our API calls
Session memory
SSML
Testing

Summary
Questions
Further reading

Chapter 5: Building Your First Amazon Lex Chatbot

Technical requirements
Creating an Amazon Lex chatbot

Setting up the chatbot
Creating an Intent
Testing your chatbot
Publishing your bot
Using Slots

Creating an FAQ chatbot

Setting up Lex
Gathering the data
Creating the Intents
Creating the Lambda Handler
Creating a response
Lambda fulfillment
Building and testing

Lex responses

elicitSlot
elicitIntent
confirmIntent
close
delegate

Summary
Questions

Chapter 6: Connecting a Lex Bot to DynamoDB

Technical requirements
Designing the flows

Perfect conversations
Flow diagrams

Building the chatbot

Product find

Creating the Lambda
Creating the data
Lambda testing
Completing the intent

Add to cart

Creating the Lambda
DynamoDB
Adding Dynamo permissions
Testing

Checkout

Creating the Lambda
Testing

Saving our cart

Creating the Lambda
Dynamo changes
Testing

Retrieving a saved cart

Creating the Lambda
Testing

What’s in my cart?

Creating the Lambda
Testing

Testing the whole bot
Summary
Questions
Further reading

Chapter 7: Publishing Your Chatbot to Facebook, Slack, Twilio, and HTTP

Technical requirements
Integrations

Facebook Messenger

Creating and connecting a Facebook Messenger app

Slack

Creating and connecting a Slack app

Twilio

Creating and connecting Twilio

HTTP endpoint

Creating the Lambda

Testing

Connecting API Gateway

Testing
Building the API

Web user interface

HTML
Creating our script
Styling the frontend

Summary
Questions

Chapter 8: Improving the User Experience for Your Bots

Technical requirements
Response cards in Amazon Lex

Creating a card
Using cards in chats

Alexa search queries

Google Cloud Platform
Continuing Lambda building
Rebuilding the skill and testing

Lex utterance monitoring
Summary
Questions

Chapter 9: Review and Continued Development

What we’ve learned

Conversation design
Amazon Web Services
Amazon Alexa
Amazon S3
Using APIs
Amazon Lex
Dynamo DB
Publishing Lex chatbots
Advanced features

Continuing your learning

Alexa

Amazon Echo Spot and Amazon Echo Show
Building a library of functions

Lex
Alexa and Lex

Improving the build process
Integrating more AWS services
Integrating other APIs

The future of chatbots

Language understanding
Working with spoken interactions
Improved device interaction
Connected devices
Unique voice-based systems
General Artificial Intelligence
Improving people’s opinions

Summary

Appendix A

Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8

Appendix B

Debugging
Debugging Alexa Skills

Check the utterances
Save and build your model
Check your Endpoint
Added Alexa as a trigger for your Lambda

Debugging Lex chatbots

Check your utterances
Check the intent response
Save intents, build, and deploy
Check your connected platform
Check your Lambdas are working

Debugging Lambdas

Install all of the required packages
Check your permissions
Correct your Lambda code
Check external services

Other Books You May Enjoy

Index