Book Image

Building Slack Bots

Book Image

Building Slack Bots

Overview of this book

Slack promises that its users will "be less busy." Slack bots interact with users in Slack chatrooms, providing useful immediate information, and automating work. This book gives you everything you need to build powerful and useful Slack bots. You’ll see how to hook into the Slack API to create software that can read and post to chatrooms, respond to commands and hints given in natural conversational language, and build fun and useful bots for your own place of work, both as a front end to your own service and to distribute and share as apps. You can even sell your bots and build a business as a Slack bot developer. Throughout the book, you’ll build useful and fun example applications that you can modify for your own situations. These range from simple, fun applications to liven up discussions to useful, data-driven apps to help you make decisions quickly and manage work.
Table of Contents (14 chapters)

Slack as a platform


What many users perhaps don't know about Slack is that underneath the messaging client, a highly extensible platform exists that can be used to create apps and business tools that can simplify the development cycle, perform complex tasks, or just be downright silly.

Slack's UI with its own Slack bot in action

This platform or API can be utilized to integrate third-party services into Slack's platform and leverage their extensive reach and user friendly interface. The said third-party applications can send data into Slack via incoming webhooks, execute actions outside of Slack with commands, or respond to commands as a bot user. The bot user or bot is the most interesting; they are so named as they can mimic human users by performing the same actions that any human can.

Note

Slack bots are software applications that run on the Slack Real Time Messaging (RTM) platform. Bots can be used to interact with external applications or your custom code in a conversational manner.

Some of the more popular bots include GitHub's multitasking Hubot (https://hubot.github.com/) and Meekan's scheduling bot (http://meekan.com/slack/), but many more of varying complexity are developed each day.

The most obvious and well known bot is Slack's own Slack bot, used for built-in Slack functions such as:

  • Sending feedback to Slack

  • Scheduling reminders

  • Printing a list of all users in a channel

Another widely popular bot is Hubot. Originally developed by GitHub and ported to Slack by Slack themselves, Hubot can provide useful functionality such as GitHub activity tracking, which can keep you up to date with GitHub repositories.

GitHub integration showing branch and pull request activity

You can also add infrastructure monitoring through Jenkins:

Jenkins integration bot showing build automation logs in Slack

Bots can transform Slack from a simple messaging client to an important business tool, benefitting any company that uses custom bots unique to their workflow. The beauty of the Slack platform is that anyone can create a functional bot in a few simple steps.