"Improve the integration of bots on Rocket.Chat" proposal for Google Summer of Code 2018
- Name: Mikael Mello
- Education: 3rd year student of Computer Science at University of Brasilia
- Location: Brasilia, Brazil
- Email: [email protected]
- Homepage: https://github.com/mikaelmello
When I first heard of GSoC a couple weeks ago, I found it a great opportunity to improve myself both as a developer and as a person by contributing to open source (something I had never done until last month) and bonding with the community behind it. Rocket.Chat really caught my attention for a couple reasons: First, it has a well-built codebase in a language I am familiar with and second, it is a Brazilian company, that alone makes me want to contribute to it regardless of GSoC.
My work with Node is mainly composed of back ends of a couple websites using WebSockets, Steam bots and Express. Regarding general knowledge about bots, I am somewhat familiar with the architecture of Telegram bots and, as previously said, Steam bots.
For about 2/3 of the Coding phase I will balance this work with my classes, which take approximately 20h/week, leaving me able to work from 30 hours per week on this project. Apart from that, I have a scheduled event from May 30th to June 3rd, but this will not delay any milestone since I'll produce more in the previous week
Rocket.Chat currently has 2 fronts when it comes to bots.
One of them includes the Rocket.Chat Node SDK, an agnostic interface for bot adaptors, and the connectors/adaptors from varying bot frameworks. The SDK is still under development along with the Hubot adapter and a few more connectors from frameworks such as BotKit or BotPress in the future.
Even though the tools available to deploy new bots to Rocket.Chat are improving, the integration with the Administration Panel is stagnated and basically outdated, some of the problems are:
- The Internal Hubot tab's package (
internal-hubot
) has its own (worse) adapter than the one at hubot-rocketchat, which is in the process of converting to ES6 and to use the SDK. - The Bots tab has a few settings for the
bot-helpers
package that is not used anywhere. - There is no information regarding external bots that are connected to the server.
The goal of this project is to develop a basic UI to monitor and manage existing bot users along with setting the foundations to create and deploy a new one according to the selected framework.
Regarding management of existing bots, all users with bot roles will be listed along with information about each one of them, such as:
- Status: Tells if the bot is connected, running or paused, etc.
- Framework: Tells which platform the bot is running on (Hubot, BotPress, etc) along with informations about the adapter being used.
- General stats: e.g. total messages received/sent, uptime, ping, etc.
- Management options: Monitor logs, ability to pause or disconnect the bot if the adapter supports it, list available commands (if something like RocketChat/Rocket.Chat#1086 is implemented), etc.
When creating a new bot, the admin will fill a menu with the initial set of configurations of the bot, such as basic info of the bot account, and choose the framework from a list of the ones supported by the server. Then each framework will have different ways of deploying their bots.
In order to do all of this, a new package will have to be created and new features will be added to the Node SDK, along with new standards to future adapters/connectors.
The development of the new package will first add the most basic features and then extend them to support all current needs.
From May 14th to June 10th
Before starting to code there are a few important things to study and review with help from the mentor, the second section will most likely take more time than the second.
- Rocket.Chat's architecture as a whole, mainly Meteor and Asteroid.
- Study at depth the Rocket.Chat's Node SDK and the current implementation of the Hubot adapter.
- Get information about the development of other adaptors (if there is someone developing them at the same time).
While some of the information provided can be retrieved on-the-fly, some will need to be persisted on the database, in this section I will make the necessary aditions or changes to the database in order to persist whatever is needed for future features to become available.
These changes can have a meaningful impact on this project and on the core of Rocket.Chat and even though there is the need to be careful, the flexibility of Mongo allow us to make changes later due to misconceptions in this phase or future change of plans.
From June 11th to July 1st
In order to get this new set of data, we will refactor the rocketchat-bot-helpers
package (basically recreate it from scratch using the same name) by implementing functions that wrap the ones that are current used, but requiring and/or storing additional information that we find useful.
For example, instead of logging in with loginWithPassword
, we could implement botLoginWithPassword
that requires the adapter to tell its Framework, version, etc. and then store this data along with others such as IP address.
We will implement the functions and wrappers to gather the less complex data that will not change while the bot is connected (framework, version, IP).
In this section we will implement the functions and wrappers that will be constantly updated as the bot remains connected (ping, number of messages, logs, uptime)
From July 2nd to July 29th
Once we have a way to gather and store the data, it is time to implement the UI in the Admin section to showcase the stats and then implement the functions that will act on the bots, such as pausing the bot.
This will be implemented under a new package, not rocketchat-bot-helpers
.
In this basic UI the admin will be able to easily see general data about the existent bots (connected or not).
All the bots will be listed with the general information about them, with an option to view more details about it in a new page.
In this section we will build some basic options that can later be extended by the community, they are:
- Basic creation of bots, for now we will at most create the bot user and then guide the admin to the installation and connection of the bot.
- Pausing, resuming or even disconnecting a bot from the admin panel.
From July 30th to August 6th
The documentation will be written during the entire project, however we reserve this last week to finish any pending pages, review everything and do general fixes.
@mikaelmello when do you see having support for a botkit bot with just static data showing in the Administration Panel? Also, what all types of bots do you intend to support? Will api.ai/dialogflow be one of them?