Create your own Hubot (2) - Install and set up your first Hubot

Apr 14, 2017 Hubot 中文版

In the first post, we already got necessary packages and set up a basic environment for running Hubot. Now, let’s continue to install Hubot and create your first Hubot.



Prerequisite

Makre sure you have Node.js and npm installed on your machine:

# Check Node.js version
nodejs -v

# Check npm version
npm -v


Install Yo and Hubot Generator

Yo (Yeoman) is a cool tool that helps you to quickly build the backbone of a web project, and you can make a Generator (Yeoman workflow) that defines how do you want Yo create a project for you. Luckily, Github team already provided a well-defined Generator for Hubot. To install Yo and Hubot generator:

# Install Yo and Hubot generator
npm install -g yo generator-hubot


Create your Hubot

Normally, you would face many permission issues when you run Yo’s commands as root user. It would be better to create a new user and switch to it for creating and running Hubot. To create a new user:

# Create a new user named hubot-user
useradd -d /hubot-user -m -s /bin/bash -U hubot-user

After switching to the new user, create your Hubot by below commands:

# Create a directory for you Hubot
mkdir hellohubot

# Change the current working directory
cd hellohubot

# Create Hubot and integrate it with Slack
yo --no-insight hubot \
   --owner="your-name" \
   --name="bot-name" \
   --description="Put some content here" \
   --adapter=slack

Once initialization is completed, test your Hubot:

bin/hubot --adapter slack

For now, your Hubot cannot offer any customized services due to lack of core component: Scripts. The next post will show you how to create a custom script.


You might also like:




If you have any suggestions, questions or even find some typos, feel free to contact me. Thank you! :)

zeckli.devforgalaxy@gmail.com   © 2015-2019 zeckli, thanks to Jekyll and GitHub.