Professional Documents
Culture Documents
All rights reserved. No part of the material protected by copyright may be reproduced.
or utilized in any form, electronic or mechanical, including photocopying, recording, or
by any other information storage or retrieval system, without the written consent of
the copyright owner.
iii
Table of Contents
Chapter 1: Introduction ..1
1.1 What are Chatbots? .1
1.2 Types of Chatbots .2
1.3 Design considerations for chatbot ..3
Chapter 2: Introduction to api.ai4
2.1 What is api.ai? 4
2.2 Basics of api.ai4
2.3 Agents in api.ai ..5
2.4 Domains in api.ai .6
Chapter 3: Intents in api.ai7
3.1. What are intents? ..7
3.2 Creating new Intent .7
3.3 Actions and Speech responses 9
3.4 Illustration of Intent: Order Pizza 10
3.5 Intent Priority .11
3.6 Operations on Intents .12
Chapter 4: Entities in api.ai 14
4.1. What are entities?14
4.2. Creating new Entity.14
4.3. Using Entities in Intents 15
4.4. Types of entities ..16
4.5 Operations on Entities .20
Chapter 5: Contexts in api.ai .21
5.1. What are contexts? .21
5.2. Types of Context..21
5.3. Need of contexts..22
5.4. Property of Context .23
Chapter 6: Dialogs in api.ai.26
6.1. Types of Dialogs ..26
Chapter 7: Hands-On..31
Resources..35
References 36
v vii
Chapter 1: Introduction
1.1 What are Chatbots?
A chatbot is a computer program that can make conversation with humans. The
conversation medium can be voice or text. Over the last few years, messaging apps have
become more popular than Social Media. People are spending more time on messaging
apps. This makes an attractive proposition for businesses to be available on messaging
apps such as Messenger, Slack, Skype, Telegram etc. to interact with their users or
potential customers. To interact with many users at a time, businesses need to hire more
customer care professionals. A computer application that can simulate human conversation
or simply a chatbot makes it much more affordable for businesses to interact with their
customers on these messaging platforms.
Here is an example to help you visualize a Chatbot. For example, if you wanted to buy
book from Amazon online, you would go to their website, look around until you find book
you wanted, and then you would purchase it.
If Amazon makes a bot, you would simply be able to message Amazon on Facebook. It
would ask you which book you are looking for and find it for you. Instead of browsing a
website, you will have a conversation with the Amazon bot, mirroring the type of
experience you would get when you buy a book from the store.
You might have used Apples Siri which is also an example of a Chatbot.
Fig 17(b): Developer Composite Entity Finally, well use @move entity with alias in the
Robot moves intent.
Chapter 7: Hands-On
Now, that we are familiar with the concepts of api.ai, lets try building our first
conversational bot.
Problem Statement: To build a bot that can book a hotel room for a user.
There are 4 steps involved in building any conversational bot:
1. Conversational design: Define the conversation between the user and the bot after
understanding the objective of building the bot.
2. Sketch a flowchart in order to have a pictorial view of the conversation defined.
3. List down the intents, entities, contexts involved in the building the bot after analyzing
the conversation.
4. Develop the bot by creating the required intents, entities and contexts and test the bot
for expected responses.
Agent : Hotel-Room-Booking
Intents : greeting,to book a room, confirm-booking,reject-booking
Entities :
System defined Entities : from date, to date,email-ID
Developer Entities : roomtype
Action : book.room Contexts : interested,not_interested ,
confirm_booking,reject_booking
Resources
For more examples refer:
https://github.com/getstarted-guru/ebookresource/
References
Api.ai documentation: https://docs.api.ai/
Api.ai blog: https://api.ai/blog/