PROJECT 1: SLACKBOT

For our first project, we will build a Slackbot on top of the popular Github bot called Hubot.

Overview

We've been using Slack to communicate with each other for the first few weeks of the class. Now it is time to build our very own Slackbot to add a fun, interactive component to the chat room. A Slackbot is an integration into Slack that can either respond to specific phrases that are mentioned in Slack or they can post things from outside of slack into a channel or private conversation. There are now entire startups built on top of Slackbots. For example, people have built Slackbots that let you hail an Uber from them or schedule meetings with different members of your team (where it searches your Google Calendar). One of the most popular Slackbot's lets people post random gifs based on phrases into a channel from Giphy.

Hubot is a robot that was created by GitHub, that enhances their company chat. Hubot can deploy their site, act as a source of fun comments, and also automate their daily tasks. It is powerful and can be extended in a way that developers can build whatever they want on top of it.

Hubot scripts are generally written in CoffeeScript, a language that compiles into JavaScript. Thankfully, these scripts can also be written in vanilla JavaScript. Your bot can respond to whatever you like, but it must perform at least three different actions.

Hubot: Basic Functionality


Respond

The respond command will respond to specific text it sees in the Slack channel. You can then use the send command to post a message to the channel.

Send

send lets you send a message to the Slack channel. We usually use this hand-in-hand with respond. For example, when someone says something (i.e. 'Hi') on the channel, we respond by sending "Howdy". Of course, it will only send or respond based on the commands and words you teach it (by adding it to your code).

Reply

reply lets you reply to a certain user or to the person who sent the original message. This includes the @ in front of the user's name so they get alerted.

Random

Hubot also has a random command which will return a random result based on what you give it. Check out the starter code for some examples.

Technical Requirements


Your Slackbot should:

  • Have a message post to Slack based on user input
  • Perform at least 3 different actions.
  • At least one of the commands must send a direct message or reply.
  • Use at least 1 conditional to change the outcome of a command.

Bonus:

  • Leverage a for loop to iterate over a collection
  • Introduce a random component
  • Include an image in the response in addition to text

Necessary Deliverables

A working Slackbot, built by you, that can be run in the class Slack workspace.

A new git repository hosted on Github Enterprise, where your codebase is maintained.

A README.md file with explanations of what your bot does, what commands it responds to, the approach taken, installation instructions, unsolved problems, etc.

Suggested Ways to Get Started


  • Review existing Slackbots and Hubots for inspiration.
  • Begin by writing down what your different commands will be and expected outcomes before writing any code.
  • Write pseudocode before writing any code.
  • Get Hubot working out of the box before writing any custom code.
  • Test small pieces of functionality frequently to make sure everything is working.
  • Use tools such as Stack Overflow, Google and documentation resources to solve problems.

Potential Project Ideas


  • Class today: Ask your bot whether we have class today or not. Use JavaScript to check today's date and then respond back with whether we have class or not.
  • Random quote: Use an array to store a number of your favorite quotes. When you ping your bot, have it return a random quote from your list.