Project github repository link: master branch
Pull Request made during GSoC: Pull Request
Project tree of my work: here
For many of our users today, chat is a much more familiar form of user interface for them and it would be valuable to provide an extensible chatbot connected to Mifos/Fineract. This chatbot appllication will allow user and Fineract platform to interact directly. During GSoC 2019, I worked on enhancing and adding additional features to this application for providing integration with major chat platforms like Slack, Telegram and Facebook messenger, also improving NLU integrated.
Chatbot and adapter to Apache Fineract is a Spring application build on Spring Boot framework. It provides a chatbot service to assist consumers and this chatbot service is implemented on Slack, Telegram and Facebook messenger. This project is divided in the following modules:
- server - Server module is responsible for starting of Spring application with the configured properties of protocol module and adapter module.
- adapter - Adapter module acts as adapter to nlp, client and protocol module. This module provides all the handler which handles requests coming from protocol module and return mifos response back to protocol module.
- client - This module is responsible for handling client request and communicating with Fineract API and generate and return mifos response back to adapter module. It is also responsible for authentication of client.
- core - Core module provides skeleton of the application. Interface for NLP service, chat service, adapter service, intent and small talk service are defined in this module.
- nlp - Rasa NLU is implemented in this module. Models are trained using Rasa NLU trainer and trained models are placed in models directory (here).
- protocol - Integration with all chat platforms are defined here.
- database - Authentication is provided by storing user information in database. All database related methods and templates are defined in this module.
Initially, I proposed to improve Slack integration, Apache open-NLP module, resolve bugs and issues, create authentication solution, Integrate of chatbot on Skype, Telegram, Facebook messenger and small talk feature in NLP. But during the community bonding period (after discussion with Mr. Aleksandar, Mr. Raul, Mr. Ramit and the community members), We decided to replace Apache open-NLP with Rasa framework and rest of the tasks are good to go.
All my commits are under one Pull Request.
- move hardcoded string to application.properties
- remove redundant annotation with @SpringBootApplication
- Update application.properties
- Create server config
- Disable Cross Site Request Forgery(CSRF)
- remove sout and update authentication logic
- Improve ApiClient constructors
- implement authentication in handlers using ApiClient
- code cleanup: remove print statements
- Add log statements
- Update chatCallback method parameters
- remove redundant variables and code cleanup
- moved protocol beans from MifosChatbotApplication to ProtocolConfig
- fix grammatical error
- Encode password for more security
- import optimize
- Replace getter and setter methods with annotation
- Code cleanup
- Add skypeChatService
- Add skype dependency
- remove skype as API depreciated
- remove skype dependencies
- small bug fix in debug statement
- Add slack(deleted accidentally)
- typo fix
- Code Cleanup
- Bug fix with message length max limit
- Added checks to handle exceptions
- Add messenger4j dependency
- Add facebook messenger chat service
- add login method to get credentials
- minor bugs fix in FB messenger integration
- create Basic HTTP auth method
- Update authentication in FB messenger integration
- Minor bug fix in authentication in FB messenger integration
- minor bug fix in authentication (FB messenger integration)
- add logic to handle logout
- minor bug fix with authentication
- improve bot response and login logic
Following commits are for implementing database used for Authentication by storing user information.
- create database setting component
- add database properties in application.properties
- create database configuration
- Create Database handler
- add database build.gradle
- Remove old implementation of JDBC and reimplement with JPA and JDBC template
- Create user model, add dependencies and implement query methods
- fix bad grammer MySQL
- temporarily changing slack integration
- Add Slack database handler methods
- add authentication to slack integration
- Small fixes in SlackChatService
- code cleanup: slackChatService
- Add telegram API dependency
- Integrate telegram bot
- Add Telegram database handler methods
- add login logic to telegram integration
- bug fix with dependency conflict related to telegram API
- standardizing method name
- add Rasa NLU dataset
- add more Rasa NLU dataset
- add Rasa NLU dataset for loan handlers
- add Rasa NLU dataset for loan product handlers
- add Rasa NLU dataset for saving handlers
- add Rasa NLU config
- add RasaNLUService component
- implement Rasa handler
- fix dataset issue
- implement rasa NLU service
- add dependencies for json and apache http
- add Rasa NLU model
- update NLPService recognize method
- fix chatbot adapter service handler method
- Improve intent handlers
- Add isSmallTalkRequest method
- implement isSmallTalkRequest method
- Add SmallTalkHandler base
- Add isSmallTalk method implementation
- Implement SmallTalkHandler and Update SmallTalk class
- Add more intent response
- Add handle logic for SmallTalk request in Slack
- add dependencies for joestelmach parser
- Improve date and id finding logic in RasaNLUService
- Increase and add response to intents defined in SmallTalkHandler
- Integrate small talk in facebook messenger and telegram
- Add small talk dataset
- Replace Rasa NLU model
https://mifosforge.jira.com/wiki/spaces/RES/pages/823590915/2019+Google+Summer+of+Code
Response from Fineract API to Slack platform.
Response from Fineract API to Slack platform.
Small Talk feature implemented in chatbot.
Chatbot integrated with Telegram.
Chatbot integrated with Facebook Messenger.
There are still some future improvements that you can make if you are interested in this project.
- NLP: Generalise Rasa more, so that it can handle more use cases.
- Reduce code redundancy and improve it.
- Improve response format.
Thank you to all who helped me throughout GSoC. Special thanks Mr Ed Cable for reviewing my proposal and giving me valuable updates and giving me suggestions in weekly updates. And I will always be thankful to my mentors(Mr. Raul, Mr. Ramit and Mr. Aleksandar). Thanks for guiding me on the right path and helping me to resolve problems. Thanks for being a good mentor.
It's a great experience for me. I would say GSoC is the best program to help you learn new technology, learn best practices and reading awesome codes. Thank you The Mifos Initiative and GSoC community for giving me this great opportunity.