In this tutorial, you’ll learn how to develop bot using Hubot.

What you’ll learn

  • Build a basic chat bot using Hubot.

What you’ll need

  • Node and npm

What is Hubot?

Hubot is your scriptable robot friend. Hubot is open source, written in CoffeeScript on Node.js

You can use Hubot to automate your tasks, deploy website, test your apis and a lot more.

Screen Shot 2016-08-07 at 3.32.41 PM

Getting Started with Hubot

Step 1: Install node


Step 2: Install Hubot Generator

Open terminal and run the following:

%  npm install -g yo generator-hubot

Step 3: Make a bot called ‘hodor’

% mkdir hodor
% cd hodor
% yo hubot

Now, you will be asked a few questions like who is creating the bot and adapter you want to use.

Ignore adapter part for now, will come to it in our next blog,“Integrate Hubot to your Slack”.

Step 4:Run the functional hubot inside “bin/hubot” folder

% bin/hubot

Press enter

hodor>hodor ping

Hodor will reply with PONG.

Type hodor help to see the list of commands supported.

Now to the “hodor” folder in your system.

You can add your scripts inside “scripts” folder. Read more about coffeescript here.

Open “example.coffee” in editor.

Add the following after ‘module.exports = (robot) ->’

 robot.hear /hi|hello|hey|/i, (res) ->

res.reply ‘hey, whats up’

robot.respond /what is your name/i, (res) ->

res.reply ‘Hodor Hodor Hodor’

Stop and run hubot again by % bin/hubot

In script, if you want hubot to reply to chat which is directed to him, use robot.respond

If you want hubot to reply even if it is not directed to him then use robot.hear

Type any of hi, hello, hey and Hubot will reply with  “hey, whats up”

Type “hodor what is your name” and you will get the reply “Hodor Hodor Hodor”.

Screen Shot 2016-08-07 at 2.53.37 PM

Congrats for building your first bot.

Next we will cover adapters and how to integrate bot with Slack.

Subscribe to our newsletter to learn more about bots.

Categories: Messaging

Related Posts


Applozic vs Hyphenate: Which Chat SDK should you choose for In-app Chat?

The messaging app era is here. This isn’t something I am telling out of intuition, but there are a number of statistics and major trends to testify it. For instance all the hype around Chatbots Read more…


Top 20 iOS Developers Blogs Who You Must BookMark

Mobile applications are widening their utility in multiple aspects every day. Technologies like Augmented Reality, IOT, Virtual Reality, GPS, Beacons are becoming part of our life both in a personal or professional sphere. Enterprises, no Read more…


Top 5 tips and tricks to delight customers with Customer Support Chat

With more and more businesses springing up in the digital space, coupled with the rapid rise of the digital natives the customer support landscape needs a major reshuffle. As a business owner or a product Read more…