How to Create an Internal Bot With Node.JS and Hubot?

Photo of Nikodem Strawa

Nikodem Strawa

Jan 21, 2019 • 5 min read
image (1)-3

In our everyday work we use many tools that help us create many things better and faster - Confluence, Github, Jira, Google Calendar etc. We are growing fast and the number of tools we use can be a little overwhelming for newcomers and even for veterans.

It's sometimes difficult to find all the needed pieces of information without getting disturbed. Some of the tools we use don’t provide the kinds of summaries or insights that could help us to better monitor our work progress.

As an IT company, we always try to use our skills to automate internal processes that are indispensable parts of our job to allow us to focus on the most important things. Internal projects also serve as idea validators and experimental laboratories.

Because Slack is the de facto means of communication in our company, we decided to use it as the interface for our solution. We wanted to create a chatbot that would help us reduce work on repeatable and tedious tasks that could be easily integrated with our favorite tools and automate some internal processes.

Most important requirements

  • Ability to communicate with the bot through Slack

  • Providing an architecture that allows us to enhance the bot through new plugins easily

  • Ability to create periodic notifications

  • Make the bot a member of our team!

Technology choice

We went with Node.js for our chat-bot. It’s well known for being performant under heavy loads and one of the go-to solutions for messaging applications.

This choice allows us to use many well-developed libraries. Many of them are created to make the integration process with 3rd party platforms easier. For example, we have integrated our bot with services like GitHub, Slack, and CircleCI using vendor-provided packages, most of which were built by the companies whose services we integrated with. Communication with data providers is asynchronous, thanks to async/await & promises - Node.js makes that process much easier and faster to implement. As mentioned before, we had to communicate with multiple services, therefore, considering all the advantages that this solution provided us with, we started developing our own bot. We knew that by using this technology the development process would be much faster. We wanted for our bot to be easy to extend so that new features could be added by anyone knowing Node.js. This technology allowed us to build the perfect environment for our bot to run and to grow.


Another foundation of our bot is Hubot. It’s an open source framework created to build chat bots made by GitHub. Hubot can be easily integrated with many team collaboration tools, such as Slack or HipChat, through adapters. It’s also easily extendable by writing your own scripts. All scripts are Javascript modules that are automatically handled by the bot on startup.

The challenges we had to face up were:

  • Creating a flexible architecture for the project

  • Lowering the entry threshold for new developers

  • Preparing a testing environment

The biggest challenge was to prepare the bot’s architecture in a way that would allow feature developers to add new plugins with minimal effort. We have done our best to make the entry threshold low.

We have made all the plugins self-contained Javascript modules, which makes them easy to debug, test, and maintain. Each plugin consists of script files with business logic, unit tests, and configuration details. It makes them easy to separate in the future as stand-alone services.

Because of our decision to use self-contained plugins, some parts of the code were repeated in multiple places. It is not a good practice to repeat the same lines of a code, as it makes refactoring take much longer and makes the software harder to maintain. Knowing that, we decided that creating our own library called `bob-utils` would be the best option here. Thanks to that solution the plugins stayed self-contained and the redundancy problem was resolved.

The unified plugin architecture made it possible to build a generator that creates the structure and the schema of the new plugin as well as configuration files and a test suite. The plop library has helped us with that process.

The biggest problem during development was writing tests. Thankfully, a couple of open source libraries came in handy. After a few modifications to adjust them to our needs, they became a fundamental ecosystem for writing sufficient, web-like, tests.


As a result of our work, we created Bob, our Netguru bot. Thanks to Node.js, we built an extendable tool in a small amount of time. As time goes by, we are able to add new features that solve problems and automate our workflow.

We have done our best to make the process of adding new features to the bot as easy as it could be. Now we have the possibility to add new features when needed, with minimal time required to do so. This means that the bot will be extended with new features and integrated with different services as time goes by. We have many passionate people with many extraordinary ideas for new features! The bot keeps the track of the most frequently used commands. That data can be used to improve this tool or even implement a machine learning process to make Bob even more flexible.

Photo of Nikodem Strawa

More posts by this author

Nikodem Strawa

Node.js Developer

We're Netguru!

At Netguru we specialize in designing, building, shipping and scaling beautiful, usable products with blazing-fast efficiency
Let's talk business!

Trusted by:

  • Vector-5
  • Babbel logo
  • Merc logo
  • Ikea logo
  • Volkswagen logo
  • UBS_Home