Hubot Slack setup

  • Log in to your slack workspace from browser

https://<your-workspace>.slack.com/apps/manage

  • Search and install Hubot slack plugin

  • Now, create the hubot username and get the newly generated hubot slack token HUBOT_SLACK_TOKEN

  • Open slack application and invite your bot in the target #channel

  • Open terminal and install the following npm libraries

npm install -g hubot yo generator-hubot coffee-script

  • Generate the hubot template in your local machine

yo hubot

  • Make sure you have some hands on coffee script
  • Create a .coffeefile and write a sample snippet to respond back when you type a string; let’s say, sams hello, where sams is the bot username that I’ve set earlier
module.exports = (robot) ->
robot.respond /hello/i, (msg) ->
msg.send "Hello, Mr. Prashanth Sams!"

  • Run the following cmd to start hubot server that couples with the hubot account created inside your workspace; here, slack is the adapter that we provided while generating the template
 HUBOT_SLACK_TOKEN=xxxx-xxxx-xxxx-xxxx ./bin/hubot --adapter slack

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s