Overview

"PeraChatBot is an intelligent chabot capable of providing useful information to students and staff of the department, using realistic natural language responses, on conversational interfaces such as Facebook messenger, Viber or Twitter."

Functional Description

PeraChatBot is capable of converting the user’s text into structured data that is used to construct realistic natural language responses. As with all bots, PeraChatBot is restricted to its domain knowledge and therefore capable of responding to the following types of queries.

  1. Time table queries
  2. Course content information
  3. Grades / GPA related queries
  4. Deadline notifications [Future Improvement]

PeraChatBot is supported on conversational interfaces such as Facebook Messenger, Viber or Twitter. As a future improvement we hope to develop a bilingual interface to enhance the user experience.

See the Project on Github
UX/UI
Team
Cinque Terre
Chandima B Samarasinghe

github linkedin web email
Cinque Terre
Sanoj Punchihewa

github linkedin email
Cinque Terre
Yuvini Sumanasekara

github linkedin email
Milestones

2017
NOV

09

Milestone 0 : NLP API Selection

Try different NLP APIs and make a comparison. Select the most suitable NLP API for your project.

2017
DEC

06

Milestone 1 : Implementation of Timetable Query and Secure chat client registration method

Implementation of time table querying for the mid evaluation.

Implementation of secure chat client registration method.

2017
DEC

15

Milestone 2 : Implementation of Course content information

Implementation of course content related information querying.

  • Step 1: General electives related implementation.
  • Step 2: Technical electives related implementation.

2017
DEC

Milestone 3 : Implementation of Grades / GPA related queries

Implementation of grades/gpa related information querying.

2017
DEC

Milestone 4 : Implementation of Contact information search

Implementation of contact information search functionality.

2017
DEC

Milestone 5 : Deadline notifications

Implementation of deadline notification functionality.

Log

2017
NOV

07

Setup botpress.io / First Meeting with the Project owner

We setup botpress.io and deployed a sample chatbot while familiarising ourselves with the bot development platform. The sample bot was not connected to any messaging client. The sample bot worked perfectly.

We had our first meeting with the project owner where we discussed about the main requirements of the project. We were asked to provide a comparison of the possible APIs we could use for the bot development by 13th November 2017 (Milestone 0).

2017
NOV

08

Project team meeting

The project team gathered and discussed about the overall structure of the project and the key issues we need to address before starting the actual implementation.

  • Dialogflow – to build the conversational interface
  • Node.js, MySQL – for connection implementation and querying
  • Moodle – for the database schema/structure.
  • What are the possible user authentication methods we can use?
  • Botpress.io and email services integration.


Initial Structure of the Design

2017
NOV

09

NLTK Natural Language Processing API

DialogFlow Language Processing API

  • Link https://dialogflow.com/
  • Already built-in features (context, intents, entities, existing knowledge bases etc).
  • Can focus more on the purpose rather than the design.
  • Can directly connect to chatting clients.

*** Given the time allocated for the project completion we decided to use Dialogflow as our NLP API tool.

2017
NOV

14

Change of initial design

Initially we have decided to process the user requests in the botpress Node.js server itself. Since it is very time consuming and unreliable to handle NLP parts ourselves from scratch, we have decided to forward all the input requests to Dialogflow API and then extract the relevant parameters from the user request and make relevant actions through the botpress Node.js server.

But we found that we can easily connect the chatting clients directly to Dialogflow. Therefore, we changed the initial design of our project and omitted botpress from the Node.js server since it is unnecessary.

The Basic Structure

2017
NOV

16

DialogFlow Implementation

  • Implemented Dialogflow completely without using botpress. We found out that it was easy to implement and that we can integrate it with many platforms (E.g. Facebook Messenger).
  • We also learned that the feature; follow-up intents can be used to format the response so that process of building sample dialogs was easier and more visual.
  • Docs https://dialogflow.com/docs/events

2017
NOV

21

Officially started the project

Up to now we did some background work and have chosen the most suitable api and methods to use in our bot. From today onwards we will officially start to work on our chatbot PeraChatBot (development name : infoBot).

Step 1: Create intents in DialogFlow api

2017
NOV

22

DialogFlow - student registration number identification error

We had an issue of correctly identifying the student registration number from the Dialogflow API. We had to go back and reconsider our decision on using Dialogflow. We checked all the top most NLP-APIs to determine whether there was more suitable API than Dialogflow which might resolve the issue. Since we were unable to find a relatively better API than Dialogflow, we decided to approach the issue using a different strategy while continuing to use Dialogflow. Now the issue was solved.

2017
NOV

24

Where to store time table details?

To store timetables we have decided to use the Google calendar feature, rather than implementing that in our database. We are going to use the Google Calendar API to do those manipulations

  • Today we are going to get familiar with Google Calendar API.
  • We are going to use Heroku cloud services to deploy our Node.js application and the main database.

2017
NOV

25

DBMS and the nodejs Server

We are using PostgreSQL as our DBMS (since we deployed our server on Heroku which supports PostgreSQL)

2017
NOV

28

Google Calender API

Authentication of the Google Calendar API was completed. Successfully ran the sample code in a Node.js server.

However to integrate Google Calendar API we have to put in an extra effort. Since the semester timetables are the only thing we are planning to put there, we should discuss the practicality of using it, in the next meeting. That is, whether we are to proceed with Google Calendar or to use our databases to do that.

2017
NOV

29

Setup DBMS and connected to the nodejs server

Initially we have planned to use Google Calendar to store timetable information. But after discussing with the group members, we have decided to store time table information in main the database.

We created user information schema (table) in PostgreSQL to store user data and connected the Node.js server to it to store values at the sign-up.

2017
NOV

30

Designed the Database Schema

Designed the database schema for students, course details and timetables.

2017
DEC

01

Implemented the Databases

  • Implemented the database schemas.
  • Populated the database tables.
  • Successfully connected the database with the main Node.js server.
  • Implemented database manipulation functions in the Node.js server.
  • Changed the ‘getting started’ intent design and the webhook functions.

2017
DEC

02

Time table query implementation , Verification Procedure

  • Discussed about the verification procedure required when integrating Facebook Messenger as a conversational interface.
  • Implemented the email verification functionality to link the facebook chatting client to the respective users.
  • Implemented the time table query functions in the Node.js server with the help of PostgreSQL commands. Here as the initial step we have completed the queries related to time only.
    • Ex : "What do I have at 8 a.m.?"
    • The bot will respond to this with the respective data given through the webhook.
    • Also if the user asks a question like ‘What do I have next?’’
    • The bot is capable of responding to that as well will (here the previous data that was stored in the server is used to maintain the context).
    • Similarly the user can ask questions like ‘What did I have previously?” and query back.

2017
DEC

03

Implemented the time table queries related to days.

Implemented the timetable queries related to days.

  • E.g. "What do i have on Friday ?"
  • The bot will respond to this with the respective data given through the webhook.
  • The user can also ask “Next” or “Previous” following the first query.

Implemented the chatting client verification method.

Implemented an email based verification functionality to link the Facebook chatting client with the respective user accounts.

  • A very secure method, therefore only the particular user can access the information related to him/her.
  • This method of verification is simple and easy to use.

2017
DEC

04

Time table query implementation - Representation.

  • Tested some templetes which we could use to represent timetable information on messenger.
  • Almost all the templetes from the facebook developer page, and dialogflow have limitations to use in certain time table related queries.
  • We had to make custom messaging templetes and look in to other options to overcome this situation.

2017
DEC

05

Time table query implementation - Representation.

  • Discussed with the team and selected some of the templetes given by facebook developer page and dialogflow.
  • For large time table responses, user will be given a link to a dynamically generated time table related to his/her query.

References and APIs
botpress API

Botpress is an open-source bot creation tool written in Javascript. It is powered by a rich set of open-source modules built by the community. They like to say that Botpress is like the Wordpress of Chatbots; anyone can create and reuse other people’s modules.

NLTK Natural Language Processing API

The Natural Language Toolkit, or more commonly NLTK, is a suite of libraries and programs for symbolic and statistical natural language processing (NLP) for English written in the Python programming language. It was developed by Steven Bird and Edward Loper in the Department of Computer and Information Science at the University of Pennsylvania.

Facebook Developer API

The Facebook API is a platform for building applications that are available to the members of the social network of Facebook. The API allows applications to use the social connections and profile information to make applications more involving, and to publish activities to the news feed and profile pages of Facebook, subject to individual users privacy settings. With the API, users can add social context to their applications by utilizing profile, friend, Page, group, photo, and event data. The API uses RESTful protocol and responses are in JSON format.

DialogFlow API

Dialogflow (formerly Api.ai, Speaktoit) is a developer of human–computer interaction technologies based on natural language conversations.

Heroku

Heroku is a cloud platform as a service (PaaS) supporting several programming languages that is used as a web application deployment model.

node.js

Node.js is a very powerful JavaScript-based framework/platform built on Google Chrome's JavaScript V8 Engine. It is used to develop I/O intensive web applications like video streaming sites, single-page applications, and other web applications. Node.js is open source, completely free, and used by thousands of developers around the world.

PostgreSQL

PostgreSQL, often simply Postgres, is an object-relational database management system (ORDBMS) with an emphasis on extensibility and standards compliance. As a database server, its primary functions are to store data securely and return that data in response to requests from other software applications.

Google Calendar API

The Calendar API lets you integrate your app with Google Calendar, creating new ways for you to engage your users.

Pug

Pug is a high performance template engine heavily influenced by Haml and implemented with JavaScript for Node.js and browsers.


Conclusion

PeraInfoBot was developed to enable students of the department to easily resolve academic related queries and access relevant information. Dialogflow was used as the web-based bot development framework for PeraInfoBot, since its features allows the use of Natural Language Processing and Machine Learning. Platforms such as PostgreSQL, Node.js and Heroku were also integrated for the bot development.

Initially, the chatbot allows a student of the department to register automatically using his/her Facebook ID and student registration number and maps the user to a unique entry in the database. The student can then proceed to interact with the chatbot using Facebook Messenger and inquire information related to the academic curriculum.

The proposed solution was initially designed to allow access to students and staff of the faculty and resolve queries related to such users. However, due to time constraints, the implemented solution was only able to resolve timetable and course content related queries for students. In further developments, the chatbot could be extended to facilitate the staff to use the system as well.

Moreover, another feature that could be implemented is a multilingual interface, which allows a wider variety of users to interact with the chatbot by reducing the limitations of language barriers. For instance, the Sinhala language could be incorporated by referring to the mechanisms and tools used in existing Sinhala chatbots.

Other functionalities which could be implemented are, deadline notifications and queries related to grades/ GPA (E.g. credit deficits) to students. These functionalities can be implemented by allowing necessary authorization to Moodle.