How to integrate Hubot with Slack to create an efficient Chatbot

Read Time: 8 mins

In this article, let me get you through the steps to integrate  Hubot  (a chatbot app) with  slack . Have you thought of having a chatbot who can automate most of your office works? like Jarvis of Tony Stark  (not exactly 😛 ). If yes, go ahead and read this article.

If you are not familiar with Hubot, visit official page here >>. You should already be familiar with Slack which is a popular office chat application. Let’s start integrating Hubot with Slack.

Step 1: Install NodeJS and NPM for Hubot.

This is the first step to integrate Hubot with Slack. Let’s bring up a Linux box and install NodeJS  and NPM (NPM is a package manager of javascript modules) on it.

In Ubuntu/Debian:

In CentOS/RedHat:

Once done, check version of NPM and NodeJS to verify it was properly installed.

Step 2: Install Hubot on the box.

Once you have installed NodeJS and NPM. You can proceed with installation of Hubot package. Let’s start by installing Yeoman which would be used to kickstart our Hubot  chatbot.

Output would look like this:
Now create a directory jarvis  and switch to the directory. Note: This directory name would be your bot name.
Now use Yeoman to kickstart your chatbot Jarvis , for that run below command.
Output would look like this:
Once done, start your Jarvis chatbot by running below command.

Output would look like this:
At this point, you will see a prompt where you can interact with your chatbot. Let’s talk to our chatbot for the first time. For example,

Step 3: Integrate Hubot with Slack.

Let’s integrate Hubot with Slack. To do this, you need to install hubot-slack  on the box. Let’s do it.

Open Slack account in the browsers . And then expand your Workspace settings by clicking Workspace name on the top-left side of your page. Here my Workspace name is easyaslinux .


Then Click on Customize Slack .

Then Click  Configure apps .


You will see a new tab opened on your browser. Search our Hubot application and Click on it.


Next, Click Add Configuration .


Next, give a name for your chatbot. I gave Jarvis  –  the one and only. Then Click  Add Hubot Integration .

Make note of API token shown on the next page and Click Save Integration .


Now go to the box where Hubot  is installed, and run below command.

Output would look like this.

This command should be running for the chatbot to be online. You should see Jarvis  online now under Apps  section.


Now invite Jarvis  to a channel like you invite a person.

And say first Hello.


Congratulation! You have intergrated Hubot with slack. Now make your chatbot to do anything you want. You can add more intelligence to the chatbot by writing JavaScript or CoffeeScript and put it in directory scripts which located in the main bot directory . More info here >>

Step4: Daemonize Hubot service for production(Optional):

Now the Hubot  service is a foreground process. Whenever you exit terminal, the process also exits. It cannot be like this if you are planning to setup the chatbot for production. Let’s daemonize it.

As all Linux distributions are adopting Systemd  as initsystem, I will explain how you can daemonize Hubot service with Systemd.

Let’s create a run file for the Hubot service. Create file /root/  and add content given below.

Make it executable.
Now create a Systemd unit file for the Hubot service.
And add following content.
Now Reload Systemd units and start the Hubot service.
Let’s check status of the Hubot service.
Use the enable  command to ensure that the Hubot service starts whenever the system boots.

Hurray 🙂 You have completed the course for integrating Hubot with Slack.

As I mentioned above, you can add more intelligence to the chatbot by writing JavaScript or CoffeeScript and put it in directory scripts which located in the main bot directory . More info here >>

Thanks for the time taken to read my blog. Subscribe to this blog so that you don’t miss out anything useful (Checkout Right Sidebar for the Subscription Form) . Please also put your thoughts on this article as   comments .


A Site Reliability Engineer and an automation enthusiast.
Posts created 35

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top