Book Image

Hands-On Chatbot Development with Alexa Skills and Amazon Lex

By : Sam Williams
Book Image

Hands-On Chatbot Development with Alexa Skills and Amazon Lex

By: Sam Williams

Overview of this book

Have you ever wondered how Alexa apps are made, how voice-enabled technologies work, or how chatbots function? And why tech giants such as Amazon and Google are investing in voice technologies? A better question is: why should I start developing on these platforms? Hands-On Chatbot Development with Alexa Skills and Amazon Lex covers all features of the Alexa Skills kit with real-world examples that help you develop skills to integrate Echo and chatbots into Facebook, Slack, and Twilio with the Amazon Lex platform. The book starts with teaching you how to set up your local environment and AWS CLI so that you can automate the process of uploading AWS Lambda from your local machine. You will then learn to develop Alexa Skills and Lex chatbots using Lambda functions to control functionality. Once you’ve come to grips with this, you will learn to create increasingly complex chatbots, integrate Amazon S3, and change the way Alexa talks to the user. In the concluding chapters, we shift our focus to Amazon Lex and messaging chatbots. We will explore Alexa, learn about DynamoDB databases, and add cards to user conversations. By the end of this book, you will have explored a full set of technologies that will enable you to create your own voice and messaging chatbots using Amazon.
Table of Contents (13 chapters)

What makes up a chatbot?

A chatbot is very different in the way that it interacts with a user, and therefore how it works is also very different. There are three main components of a chatbot: intents, slots, and utterances.


Intents are the most important part of a chatbot. They are the tasks or conversations that the chatbot can process. They are called intents because they are the things that the user intends to do.

Intents can vary in complexity from very simple to extremely complicated. A basic intent may just be SayHello, which just says "Hi" to the user. A more complex intent may be booking a holiday, choosing and buying a pair of shoes, or ordering a pizza. They can be designed to be as elaborate as your imagination allows.

They are started or triggered when the user says one of the sample utterances. The sample utterances are a list of words or phrases that the user might say when they are trying to start an intent. Each intent can have lots of sample utterances. In the SayHello example, they might be "Hello chatbot", "Hey there chatbot", or just "Hi".


To allow the chatbot to be really useful, it has to be able to gather details about what the user is asking for. If you are wanting to order a pizza, the chatbot needs to know what toppings you want, what style of base you want, and where you want it delivered to. This information is collected and stored in slots.

Slots are designed to only accept certain types of information. If you were trying to find out whether they wanted a large, medium, or small pizza, it wouldn't be very useful if they could enter any random information. Defining the information that can be stored in a certain slot is called creating a slot type.

To make use of the information gathered in the slots, they can be accessed in the next stage of the chatbot logic. This could be as simple as saying "You have ordered a large Hawaiian pizza", where the size and topping are exactly what the user previously ordered.


An utterance is a word or phrase that has been said. This is key to chatbots as this is how a user interacts with the chatbot.

These utterances can trigger which intent the user is trying to access and they can also be used to get the exact information needed to fill the slots.