Chatbot Diploma Thesis
Chatbot Diploma Thesis
Faculty of Informatics
Master’s Thesis
Master’s Thesis
i
Acknowledgement
I would like to thank both my advisors, Carlos Ruiz Moreno, Ph.D.
and RNDr. Adam Rambousek, Ph.D., for their valuable advices, great
supervision and time they invested in me and the thesis. I would also
like to thank Adrián, the CTO of Mr Jeff, because he helped me with
setting up the external server, connecting to Mr Jeff’s internal system
and a lot of other technical tasks. For helping me with evaluations,
translations and many other things needed to complete the chatbot, I
would like to thank Mr Jeff’s employees. Last but not least, I would
like to thank my family for their patience and support.
ii
Abstract
This work presents a chatbot for laundry and dry cleaning service. At
first, a chatbot on Facebook Messenger is introduced. This chatbot was
used to acquaint interactions with users and to bring new customers.
Based on the experience with the first prototype, the In-chatbot, which
is believed to increase customer retention and decrease load on call
centers, is created. It is integrated into an existing application of Mr Jeff
company to offer users a simplified process of creating and changing
orders. In addition, users can use the chatbot to contact a customer
support from within the chat. To see the chatbot in a wide context, the
In-chatbot is then compared to one chatbot from the Czech Republic
and one international chatbot.
iii
Keywords
chatbot, Mr Jeff, In-chatbot, Jeff, laundry and dry-cleaning, Facebook
Messenger, Android, Python
iv
Contents
1 Introduction 1
2 Chatbots 3
2.1 History of chatbots . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Rule-based Chatbots . . . . . . . . . . . . . . . . . . . . . 4
2.3 Chatbots Driven by Artificial Intelligence . . . . . . . . . . 4
3 Company Overview 6
3.1 Laundry and Dry Cleaning Service . . . . . . . . . . . . . 6
3.1.1 Pick-up and Delivery . . . . . . . . . . . . . . . . 7
3.1.2 Washing and Dry Cleaning Centers . . . . . . . 8
3.1.3 Subscription . . . . . . . . . . . . . . . . . . . . . 8
4 Chatfuel Chatbot 9
4.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.2 Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.3 Analysis and Design . . . . . . . . . . . . . . . . . . . . . 13
4.4 Implementation . . . . . . . . . . . . . . . . . . . . . . . . 16
4.5 Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5 In-chatbot 23
5.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.2 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.2.1 Existing Platforms . . . . . . . . . . . . . . . . . 23
5.3 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.3.1 Components . . . . . . . . . . . . . . . . . . . . . 25
5.4 Implementation . . . . . . . . . . . . . . . . . . . . . . . . 29
5.4.1 Prototypes . . . . . . . . . . . . . . . . . . . . . . 29
5.4.2 Current Status . . . . . . . . . . . . . . . . . . . . 31
5.5 Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.5.1 First Evaluation . . . . . . . . . . . . . . . . . . . 38
v
7 Conclusion 47
Bibliography 48
vi
1 Introduction
In the current world of services, we can see a huge shift from what
services looked like in the past and what they look like now. The
changes are spread from sharing economy companies, such as Uber or
Airbnb, to companies like SpaceX with its reusable rockets. Although,
this is just a beginning, since we are, for example, very close to use
autonomous cars to travel from one place to another on a daily basis.
Because today’s world is changing dramatically, the technology
behind the services is being changed quite fast as well. According to
Gartner [1], the technology trends for 2017 include artificial intelli-
gence and advanced machine learning, virtual and augmented reality,
intelligent applications, intelligent things and conversational systems.
Virtual personal assistants, like Apple’s Siri, Google Now, Microsoft’s
Cortana or Amazon’s Echo, already make everyday tasks easier. In
addition to virtual personal assistants, another type of intelligent ap-
plications that can enhance user experience and make our lives better
are chatbots. [2]
Chatbots can change the way how services are provided. Instead
of using websites or installing another new applications, users could
simply order a service via a chat interface. For example, when ordering
a new laptop from an e-commerce, instead of going through the whole
process on the website, a user could simply type: I want to order a
new laptop. This is more natural and close to real conversations. What
is more, it can also be faster than a regular process in the current user
interfaces. Especially, when buttons are used to replace the typing.
My aim in this work is to create a chatbot for Mr Jeff company.
The chatbot will be integrated into an existing Android application
focused on a full laundry and dry cleaning service. By providing an
additional functionality, the chatbot will simplify the current processes
and enhance the interaction with users. To achieve this, the chatbot
will be using Mr Jeff’s internal system to get relevant data.
In Chapter 2, a chatbot is defined and the history of such systems
is introduced. Then, Chapter 3 follows with an insight into the Mr
Jeff company and its service of laundry and dry cleaning. Chapter 4
shows how the first prototype was designed, implemented and which
platform was used. It also includes examples of interactions with users
1
1. Introduction
which was important for designing the main chatbot. In Chapter 5, the
In-chatbot is described from the design phase through its implementa-
tion to the evaluation. Chapter 6 contains a comparison between two
successful chatbots and the In-chatbot.
2
2 Chatbots
Many chatbots have been developed so far and they differ in what
they do and how they do it. To clarify what a word chatbot refers to
in the context of this work, its definition will be provided. Then, the
history and different types of chatbots will be introduced.
There are many words refering to chatbots. These words include
conversational agents, conversational systems, chatterbots, chat robots
or simply bots. [3] These terms are often used as equivalents. For
purposes of this work, a chatbot is defined as:
3
2. Chatbots
4
2. Chatbots
5
3 Company Overview
The chatbot that is created in this work arose during my internship
as a requirement from a Spanish company branded Mr Jeff. In this
chapter, the company will be introduced together with the service
it provides. The source of the information is the official page of Mr
Jeff. [18]
Mr Jeff is a company focused on a full laundry and dry cleaning ser-
vice. It was founded by three entrepreneurs Eloi Gómez, Rubén Muñoz
and Adrián Lorenzo in August 2015. They wanted to change the sector
and to free their customers of doing the washing. Eloi himself comes
from a family of laundresses, so he is more aware of the customer
needs. By providing flexible hours and personalized approach, they
have come with a solution for everyone.
3. take the clothes from Jeff at the arranged time and place.
6
3. Company Overview
In Mr Jeff company, Jeff is how delivery boys, who are responsible for
clothes pick-up and delivery, are called.
The service is currently available for customers in Madrid, Valencia
and Barcelona in Spain and since May also in Mexico City in Mexico.
Before making an order, a customer can check whether the service is
available in his area by entering a zip code in the application, website
or by asking Mr Jeff’s customer service via phone.
To choose clothes that will go into an order, a customer can use
one of these four options:
∙ Android application,
∙ iOS application,
∙ Mr Jeff’s website,
When using the application, users receive discounts every week. The
website on the other hand features a live chat with Mr Jeff’s customer
service team to answer customers’ questions. With both the website or
the applications, a customer does not need to register anywhere, the
user account is created when the first order is made. In comparison to
the previous options, an order made by telephone is the fastest one.
7
3. Company Overview
∙ until 12:00 for the orders that are delivered or collected from
14:00 to 16:00,
∙ until 17:00 for the orders that are delivered or collected between
19:00 and 22:00,
∙ until 00:00 the previous day for the orders that are to be delivered
or collected on Saturday.
3.1.3 Subscription
For those, who have to do the washing frequently, Mr Jeff offers a
monthly subscription.
The subscription includes washed and folded laundry and shirts
that are washed, ironed and delivered sheathed on a hanger. The only
items excluded are items for dry cleaning, carpets, curtains, furs and
duvets. The service consists of washing in water, drying in a dryer
and ironing of shirts. The clothes are picked-up the day chosen by a
customer and delivered weekly with the next pick-up. Time slots are
the same as for regular orders.
To know how many clothes are remaining, a customer can use the
application containing the remaining visits, kilograms of laundry and
the number of shirts left. In addition, customers are informed by an
email on a regular basis, so they know their consumptions.
The subscription is offered in two variants, individual and students.
The individual variant offers 20 shirts and 15 kg of laundry for 65 e a
month. In contrast to the individual variant, the variant for students
costs 45 e and includes 20 kg of laundry and 15 shirts per month.
8
4 Chatfuel Chatbot
Before starting to work on the chatbot, it was required to know the
users’ behavior, interactions and get an initial evaluation. Therefore,
the first prototype was created as a chatbot deployed on Facebook
Messenger. It was named simply Chatfuel Chatbot due to the platform
used and it was evaluated and enhanced continuously until sufficient
information was obtained.
4.1 Purpose
The main purpose of the Chatfuel Chatbot was to get new customers
by providing users with a basic information about Mr Jeff, its service,
products and subscription.
Mr Jeff had a significant number of followers on Facebook and the
easiest way to build a chatbot was to use an existing platform and
deploy the chatbot on Facebook page of the company. So, users could
chat with the chatbot and a required feedback on interactions could
be obtained.
4.2 Platform
Not to build everything from scratch, the Chatfuel platform was cho-
sen, because it provided an easier interface and more features to build
a chatbot than other platforms.
The company started with the goal “to make bot-building easy for
anyone.” [19] They started in 2015 with the Telegram instant messaging
service and now they are focused mainly on Facebook Messenger. [19]
To build a chatbot on this platform, no programming skills are
required and the platform is free of charge. Furthermore, an artificial
intelligence engine is used to enhance the communication with users.
The only requirement when creating a chatbot for Facebook Messenger
is to have an existing Facebook account, that will be used to login to
Chatfuel Dashboard, and to have a Facebook page associated to that
account. As a result, many chatbots from various fields have been
9
4. Chatfuel Chatbot
Figure 4.1: Get Started Button Figure 4.2: Welcome Message Block
developed using the platform. This includes chatbots for Adidas, ABC
News, MTV, Uber, TechCrunch and others. [19]
The basic building tool in the platform is a block which consists
of one or more message cards that are sent together to a chatbot user.
Blocks are linked together using buttons and can be grouped into
groups. When the chatbot is created, there are already two blocks
«Welcome message» and «Default answer». The welcome block is
intended for new users and appears when the chat is started by tapping
«Get Started» button (see example in Figure 4.1). An example of an
existing welcome block can be seen in Figure 4.2. The welcome block
is created with a link to the main menu, but the link can be deleted.
The block containing the default answer is used when a user sends a
message that is not recognized by the artificial intelligence. It is also
possible to start a live chat session with a Facebook page administrator
when the message is not recognized. Within a block, there are text
10
4. Chatfuel Chatbot
cards, image cards and gallery cards. A text card can only contain text
with a length up to 320 symbols and a maximum of 3 buttons. An
image card supports most types of images and also GIFs. A gallery
card consists of two required fields: title and one of image, subtitle
or buttons. Titles are allowed to have up to 40 symbols, subtitles up
to 80 symbols and there can be up to 3 buttons in each card. A card
can contain up to 9 items in a slider. A gallery item may consist of
an image, title, subtitle, URL and up to 3 buttons. GIF images are not
supported in galleries. [20]
Another important part of the platform is the artificial intelligence
accessible via AI setup tab in the dashboard, which can be seen in
Figure 4.3. Here, developers can set the expected phrases which do
not need to be exactly the same as the sentences a user writes. Hence,
it saves a lot of effort for developers, because they do not need to write
every possible sentence for a specific answer. When the triggering
phrases are defined, it is required to assign a block that will be shown
as an answer or a text that will be shown immediately. [20]
Beside blocks, cards and the artificial intelligence, there are various
plugins available. From Google search to JSON API and Live Chat.
JSON plugin can be used, for example, to generate different cards
from JSON files which are placed in an external server. Live Chat (see
Figure 4.4 for more information), on the other hand, allows users to talk
to a human operator instead of the chatbot. The chat is then stopped
either by the user or after a specified time. When a user enters the live
chat, a push notification together with a link to the conversation is
sent to the chatbot manager. [20]
11
4. Chatfuel Chatbot
12
4. Chatfuel Chatbot
Since the first prototype was developed, new features have been
introduced including:
∙ Quick Replies,
∙ User Variables,
∙ typing block,
∙ Chat Room,
∙ Location plugin.
13
4. Chatfuel Chatbot
Figure 4.5: The basic flow of the first prototype in its early stage
14
Figure 4.6: The flow of the chatbot conversation
15
4. Chatfuel Chatbot
4. Chatfuel Chatbot
4.4 Implementation
The prototype was being developed in a testing environment in a way
that the chatbot was not connected to Mr Jeff’s Facebook page, but it
was connected to a temporary page created only for the development
purposes. When testing the chatbot, a new conversation was started
between the chatbot and the Facebook account associated with the
chatbot in the Chatfuel platform.
The key features that were implemented in the first prototype
include:
∙ show products with pictures and price,
16
4. Chatfuel Chatbot
17
4. Chatfuel Chatbot
4.5 Evaluation
The Chatfuel Chatbot was being evaluated continuously; however, the
required feedback was obtained after the chatbot was deployed on
the Facebook page of Mr Jeff.
The first evaluation was made by the marketing department. Af-
terwards, more people from inside the company were involved. When
the chatbot was approved and made public, users who followed the
Mr Jeff’s Facebook page were informed about the functionality and
motivated to try the chatbot. The motivation was a discount voucher
which they would receive after communicating with the chatbot for
a while. Still, it took some time until there were enough interactions
with users, because they were not used to message the Facebook page.
In the meantime, Chatfuel announced a new key feature – analytics.
With this tool, valuable information could be acquired, such as:
∙ user retention,
∙ user activity,
During the first month, the total number of users stopped at 33. The
progress can be seen in Figure 4.7. In addition, Figure 4.8 shows that
the biggest user activity was present in the beginning when users
were informed via Facebook and motivated with a discount voucher.
After that, the activity got more stable at around 2 users interacting
with the chatbot a day. The user retention ended on 6 users. In terms
of the content, the most popular blocks were Default Answer, Menu
and Zip Code. The most popular button, on the other hand, was the
Get Started button used to start the conversation with the chatbot.
After 5 months, the total number of users increased to 102 and the user
retention to 7 users. The most popular blocks were Default Answer,
Welcome Message and Zip Code. The most popular user inputs were
zip codes that were used to check the availability of the service in an
area.
18
4. Chatfuel Chatbot
19
4. Chatfuel Chatbot
20
4. Chatfuel Chatbot
21
4. Chatfuel Chatbot
22
5 In-chatbot
Since the interactions and users’ behavior was analyzed in the Chatfuel
Chatbot, there was a need to design and implement a more sophisti-
cated solution based on that data. Such chatbot was meant to be used
in the application for current users and not to attract new customers.
It was named the In-chatbot, because many internal and external
services were expected to be integrated.
5.1 Purpose
The main purpose of the In-chatbot was to increase customer retention
and decrease load on the customer support. This was intended to be
done by:
5.2 Analysis
The In-chatbot was planned to be integrated into different channels,
such as Android application or website. In addition, it was obvious that
various components of the chatbot would require different external
services, not a framework that would include everything together.
Due to the complexity, a deep analysis was required.
23
5. In-chatbot
24
5. In-chatbot
5.3 Design
Since the beginning, the development of the chatbot was agile meaning
that an iterative and incremental approach was followed. Also the
prototyping technique was used in the early stage.
At first, the chatbot was designed as a simple application running
on the chosen platform where Mr Jeff application already ran. This
was intended to test the functionality of the chatbot backend and to
display a conversation. The backend, on the contrary, was planned
to include the main processing on a separate server. The information
about customers, orders and products was meant to be obtained from
Mr Jeff’s internal server. The same approach is currently used within
the applications and the website. Beside the basic functionality, the
chatbot was expected to contain many connections to other external
services.
5.3.1 Components
To see which components would be part of the chatbot, the architecture
was discussed and modeled. Then, interactions between components
followed.
The architecture uses a client–server model, where clients repre-
sent the chat interface and the server is the chatbot itself. From the
25
5. In-chatbot
∙ Messaging Platform,
∙ Analytics,
∙ Notification,
∙ Logging,
∙ Selling,
∙ Localization,
∙ Rule-based Engine,
26
5. In-chatbot
27
Figure 5.2: A component diagram showing the In-chatbot architecture
28
5. In-chatbot
5. In-chatbot
5.4 Implementation
5.4.1 Prototypes
29
5. In-chatbot
30
5. In-chatbot
∙ user login,
31
5. In-chatbot
∙ Android platform,
∙ Amazon Linux,
∙ MongoDB database.
32
5. In-chatbot
33
5. In-chatbot
∙ /api,
∙ /authorizedusers,
∙ /authorize.
API route is used for the communication with client applications. The
route for authorized users stores users into the database of authorized
users. The authorize route decides whether to authorize the current
user in the client application to use the chatbot or not. The decision is
made based on the contents of the database of authorized users. Inter-
nally, the requests coming from Smooch or Stripe are preprocessed, so
they fit the uniform structure defined in the backend. There are four
types of requests defined:
∙ text,
∙ button,
∙ image,
∙ payment.
34
5. In-chatbot
35
5. In-chatbot
a selected category (Jeff is late, Items are missing, Bad quality, Other)
or talk to an operator immediately within the chat. An example of
raising an issue can be seen in Figure 5.6. The live chat example can be
seen in Figure 5.7. Timetable Service, on the contrary, provides data
about available hours and dates. It calls the external PHP script placed
on one of Mr Jeff’s servers.
The backend also includes an authorization service used to store
users, which are authorized to use In-chatbot, into the Authorized
Users collection in MongoDB database. Authorization service enables
to add users to the authorized group or to find out whether a user
is a part of the group or not. This approach allows to incorporate
the chatbot functionality into the running application without users
36
5. In-chatbot
∙ pay directly,
∙ report an issue,
5.5 Evaluation
All the versions of the chatbot have been evaluated continuously by
the advisor Carlos and the marketing team. When the first completed
version of the In-chatbot was released, more people from Mr Jeff were
involved and the first evaluation begun.
37
5. In-chatbot
∙ redirect the user to support when chatbot does not know the
answer,
∙ other things related to the service, not just with the order.
38
Figure 5.8: Closed Questions Figure 5.9: Open Questions
39
5. In-chatbot
5. In-chatbot
40
6 Comparison With Existing Chatbots
There are already plenty of chatbots available on various platforms,
such as Facebook, Kik or within a standalone application. The In-
chatbot is compared with two successfull chatbots in this chapter.
These chatbots differ in country of origin, release date, platform and
many other factors.
∙ a creative content,
41
6. Comparison With Existing Chatbots
6.2 Lemonade
Lemonade is a chatbot developed by the Lemonade insurance agency,
a startup located in New York. It is a peer-to-peer insurance company
focused on insurance for homeowners and tenants in New York. They
have used chatbots and artificial intelligence to automate the process
and replace brokers and papers. Based on two real employees, the
chatbot uses two personalities: Maya and Jim. [37] [38]
Likewise the In-chatbot, Lemonade uses a friendly informal lan-
guage and a personalized greeting. Users are also able to use buttons
to communicate with the chatbot. In contrast to the In-chatbot, Lemon-
ade does not provide a customer support option within the chat. It
also does not follow the minimum viable approach, because the chat-
bot is a primary tool used to communicate with customers. When
summarizing the order, chat environment is left and a new page with
tabs appears as shown in Figure 6.6.
42
6. Comparison With Existing Chatbots
43
6. Comparison With Existing Chatbots
44
6. Comparison With Existing Chatbots
6.3 Summary
Both the chatbots compared to the In-chatbot are similar in the lan-
guage used, but differs in the technology. The summarizing table 6.1
shows that MVP approach has been used by both the In-chatbot and
45
6. Comparison With Existing Chatbots
46
7 Conclusion
This work shows how chatbots can contribute to an existing laundry
and dry cleaning service by enhancing customer satisfaction, simpli-
fying current processes, increasing customer retention and decreasing
load on call centers. Based on interactions obtained by the Chatfuel
Chatbot, the In-chatbot has been created. During many iterations, a
few prototypes have been developed. The current version of the chat-
bot allows its users to create or change an order based on the previous
one and to contact the customer service from within the Mr Jeff’s
Android application. The chatbot itself uses many external services to
provide relevant data to its users.
The first evaluation has already been done. The option to contact
the customer support directly, which has been required by some of
the testers, has already been included in the current version. How-
ever, there is a big need of having more testers involved and start the
evaluation from outside of the company as well.
This leads to the future plans with the In-chatbot. At first, an op-
tion to change products in the order will be added. Then, another
evaluations will run. In terms of bigger changes, usage of artificial in-
telligence has already been tested with api.ai and will be integrated as
soon as there is a feedback on the current solution from the customers.
Likewise, a new GUI is being developed, so the limitations of the GUI
provided by Smooch will no longer be a problem.
When a more distant future is discussed, an extension to the chat-
bot is an integration into the iOS application and website. It is also
planned to extend the functionality with analytics, push notifications,
cross-selling and up-selling.
47
Bibliography
1. PANETTA, Kasey. Gartner’s Top 10 Strategic Technology Trends for 2017 –
Smarter With Gartner [online]. Gartner, Inc. and/or its affiliates, 2016
[visited on 2017-03-28]. Available from: http://www.gartner.com/
smarterwithgartner / gartners - top - 10 - technology - trends -
2017/.
2. BUTLER, Martin. Top 10 Strategic Technology Trends for 2017 | Martin
Butler | Pulse | Linkedin [online]. 2016 [visited on 2017-03-29]. Avail-
able from: https://www.linkedin.com/pulse/top-10-strategic-
technology-trends-2017-martin-butler.
3. LUN, Erwin Van. 161 Humanlike Conversational AI Synonyms | Chat-
bots.org, facilitating the community for professional chatbot developers
[online]. 2011 [visited on 2017-03-31]. Available from: https://www.
chatbots.org/synonyms/.
4. KERLYL, Alice; HALL, Phil; BULL, Susan. Bringing Chatbots into
education: Towards Natural Language Negotiation of Open Learner
Models. In: Applications and Innovations in Intelligent Systems XIV:
Proceedings of AI-2006, the Twenty-sixth SGAI International Confer-
ence on Innovative Techniques and Applications of Artificial Intelligence.
Ed. by ELLIS, Richard; ALLEN, Tony; TUSON, Andrew. London:
Springer London, 2007, pp. 179–192. ISBN 978-1-84628-666-7. Avail-
able from DOI: 10.1007/978-1-84628-666-7_14.
5. SCHLICHT, Matt. The Complete Beginner’s Guide To Chatbots – Chat-
bots Magazine [online]. 2016 [visited on 2017-03-30]. Available from:
https : / / chatbotsmagazine . com / the - complete - beginner - s -
guide-to-chatbots-8280b7b906ca.
6. KAR, Rohan; HALDAR, Rishin. Applying Chatbots to the Internet
of Things: Opportunities and Architectural Elements. International
Journal of Advanced Computer Science and Applications. 2016, vol. 7,
no. 11. Available from DOI: 10.14569/IJACSA.2016.071119.
7. KLÜVER, Jürgen; KLÜVER, Christina. Introduction: Historical
Methodical and Conceptual Frames. In: Social Understanding:
On Hermeneutics, Geometrical Models and Artificial Intelligence.
48
BIBLIOGRAPHY
49
BIBLIOGRAPHY
50
BIBLIOGRAPHY
51
BIBLIOGRAPHY
52