You are on page 1of 20

Abstract

Chatbots are software agents used to interact between a computer and


a human in natural language. Just as people use language for human
communication, chatbots use natural language to communicate with
human users. The main aim of their creation was to resemble a human
being in the way they perform said interaction, trying to make user
think that they are writing to a human. In this paper, we analyse some
existing chatbot systems namely ELIZA and ALICE and then
concludes that it is easier to build bots using ALICE because of its
simple pattern matching techniques that building one for ELIZA since
it is based on rules. Finally, we discuss our proposed system. In
particular, the proposed system is the implementation of ALICE
chatbot system as a domain specific chatterbox which is a student
information system that helps users in various queries related to
students and universities.
Introduction
Chatbot stands for chatter robot. It is a computer program which has
the ability to chat with human users. Audio or text can be used as
medium of communication. The primary aim of writing these
conversational programs is to have a powerful tool that chat in such a
way that the human user cannot realize that he is talking to a software
program. Chatbot programs are also referred to as Artificial
Conversational Entities, talk bots, chatterbots and chatterboxes. It is
Michael Mauldin who coined the term, chatterbot.
To have a meaningful and intelligent conversation, intelligence,
knowledge and linguistic skills are the basic requirements. So,
Artificial Intelligence and Natural Language Processing techniques
should be heavily used. There are ready-made tools available to create
chatbots online.
The Personality Forge is an AI platform that helps creating chatbots.
It offers a scripting language known as AI Script. Personality Forge
has an AI engine that integrate memory, emotion, knowledge, patterns
and AI Script. It provides Chat Bot API, a simple RESTful Web
Service API using JSON, to support integration of chat bots into any
project including web applications, desktop applications, mobile apps,
text messages, chat networks, and robots.
Tools and Requirements
 Software Requirements
1. Any operating system
2. Programming Language: Javascript , JSON
3. Facebook / Messenger
4. Internet
 Tools:
1. Dialogflow : Dialogflow for writing source code.
2. GitHub: GitHub is a web-based hosting service. It is used for
source code management and version control.
Analysis
 Existing Chat Bot:
The maximum chat bots are using Customer services,
Ecommerce services, Banking services, Health services etc.
Because the database is same for all the clients.
 Proposed Chat Bot:
Chatbot is created by using Dialogflow it an one the Api
which is used to flow data from database to Facebook Application.
This chat bot is used in the educational institutions purpose such as
some of them are suggest book for students according to the
subject, details of the students such as marks, attendance, address
etc each educational institution have different database.
Architectural Design
CHAT BOT DESIGN

Flow Chat Diagram:


Data Flow Diagram:
Use Case Diagram:
MODULES
The chat bot is divided into two modules they are
1. API.ai
2. Messenger Module

API.ai Module:
Api.ai matches the query to the most suitable intent based on
information contained in the intent (examples, entities used for
annotations, contexts, parameters, events) and the agent’s machine
learning model. Api.ai transforms the query text into actionable data
and returns output data as a JSON response object. The Api.ai is
connect the facebook page through the tokens id.
Now it is possible to integrate your Api.ai agent with Actions on
Google that lets you build applications for the Google Assistant,
which is the only assistant in Google Home. Google Home enables
users to interact with services through voice commands.
Messenger Module:
First you need to connect your Auth0 application to Facebook. This is
summarized in the following steps:
 Setup a Facebook app
 Get your Facebook App ID and App Secret
 Copy these keys into your Auth0 settings
 Enable the Facebook social connection in Auth0
Module Diagram

I have implemented a Facebook Messenger Bot to get an overview of


how chatbot is build. During this implementation, I understood the
flow of control for a chatbot service with other services which is
explained below.
The architecture flow is explained below.
1. User sends message to Chatbot from Facebook Messenger (a Chat
Client)
2. Chatbot sends message to Wit.ai (a Machine Learning Natural
Language Processing Engine)
3. Wit.ai extracts user’s intent and entities from message and sends
back to Chatbot.
4. Intent is used to call upon external data service to find desired
data.
5. The data is returned to chatbot from external service.
6. Chatbot builds data into a proper response and sends to Facebook
Messenger for display.
In order to create a Facebook Messenger Bot, a developer needs to be
authenticated and approved by Facebook to converse with the public
and the web server for security reasons. For a Facebook Messenger
Bot, I have created a simple web application using Node.js by
installing the necessary dependencies using npm. I ran this locally.
I also downloaded and installed ngrok and started it - npm run ngrok.
This launched a Forwarding URL to the local running server, that
means any requests to Forwarding URL will hit the locally running
server. This url is used as a Callback URL in Facebook App which
will be explained further. To set up the Facebook App, I have created
a Facebook Page and Facebook App using my Facebook account.
While setting up a Webhook in the app settings, I have given the
Forwarding URL as Callback URL and added code for
verification.The access token in page settings is stored as environment
variable as it will be used in integration. In order to make webhook to
receive messages from this page, the app is subscribed to the page
created. To set up the bot to handle the POST calls at webhook, I have
created a webhook endpoint in the sample application.
I also defined constant variables Page Access Token and
Verification_Token in the application. They are used to verify that the
callback is coming from Facebook page. So far I have connected web
application to Facebook Messenger using a webhook and have gained
access to a facebook page using an access token. Next is to add
artificial intelligence to the application using Wit.ai To set up the
Wit.ai, I have created a new app in Wit.ai console which enhances the
ability of the bot. The token from app setting is used as WIT_TOKEN
in Node.js application. The Node-Wit module is used to access Wit
application in Node.js application.
Messenger Module:
A user who joined the group can start a thread with other group
members. When a user starts a new thread or comments to an existing
thread, several people will be notified via email provided they have
their email address configured properly. For a comment to a thread,
excluding the commenter, the group's owner, the person who started
the thread, and anyone else who has commented on the thread except
the bot users would be notified via email. The bot users who have
commented on the thread will be notified by hitting callback URL
with recent post as a parameter.
In this, I will describe how the bot conversation implementation is
done. For testing purpose, I created few bot accounts with unique
token and callback URLs. In order to converse with the bot in a
group, the bot users must have joined the group. To converse with the
bots, user has to mention bot name with ‘@’ in the post
(@bot_name). I have implemented a functionality where the bot name
is retrieved using regular expression and checks whether requested
bot is the bot user (isUserBot) and also checks whether it has joined
the group. If it is a bot user and joined the group, then the message
after the bot_name in the post is sent to the requested bot callback
URL as a parameter. The bot callback URL is called using
FetchUrl::getPages method which returns the pages from the bot
callback URL. These pages are posted as responses by the bot user to
the post in a thread. This functionality also includes multiple bot
conversation i.e., a user can mention multiple bots in a post so that he
can converse with multiple bots in a thread.
Appendix
Code in Api.ai for an Intents:
Eg: Books for data structures
Sample Output:

Student details:
Conclusion
The main objective of the project is to develop an algorithm that will
be used to identify answers related to user submitted questions. The
need is to develop a database where all the related data will be stored
and to develop a web interface. The web interface developed will
have two parts, one for simple users and one for the administrator.
A background research took place, which included an overview of the
conversation procedure and any relevant chat bots available. A
database will be developed, which will store information about
questions, answers, keywords, logs and feedback messages. A usable
system will be designed, developed and deployed to the web server
Future Enhancements
This Chat bot has few limitations, including:

 More Responsive
 Speech recognition
 Chat bot is Connect to website
 Add maps to chat bot
All the above limitations can be overcome in future. Many more
built-ins can be added like backend data base etc.
References
[1] J. Bang, H. Noh, Y. Kim and G. G. Lee, "Example-based
chatoriented dialogue system with personalized long-term memory,"
2015 International Conference on Big Data and Smart Computing
(BIGCOMP), Jeju, 2015.
[2] E. Haller and T. Rebedea, "Designing a Chat-bot that Simulates an
Historical Figure," 2013 19th International Conference on Control
Systems and Computer Science, Bucharest, 2013.
[3] S. J. du Preez, M. Lall and S. Sinha, "An intelligent web-based
voice chat bot," EUROCON 2009, EUROCON '09. IEEE,
St.Petersburg, 2009. [4] Y. Chen, W. Wang and Z. Liu, "Keyword-
based search and exploration on databases," 2011 IEEE 27th
International Conference on Data Engineering, Hannover, 2011.
Index
Sl.no Topic Page no
1. Abstract
2. Introduction
3. Tools and Requirements
4. Chat Bot Analysis
5. Architectural Design
6. Chat Bot Design
7. List of Modules
8. Modules Diagram
9. Appendix
10. Conclusion
11. Future Enhancements
12. References

You might also like