Bot Basics, Chatbot Development

How to Get Started With Bots for Slack

Slack bots have become the ultimate productivity tool for working from home. This guide explores the unique features of Slack bots, reviews use cases and covers framework integrations.

January 27, 2021

In the past year, Slack has become a gift to remote teams. By offering a channel-based messaging platform with multiple capabilities, has allowed teams and workplaces to streamline their tasks, schedule deadlines, and virtually communicate—without the need to meet face to face. But the platform’s usefulness goes beyond easy IMs and team video calls. The real magic happens when you add various Slack bots to your channels. And, because of the platform’s great API and user base, developers are outdoing themselves.

Since entering the market in 2013, Slack has also become a community where developers build various kinds of chatbots. Most of these bots perform a function relating to the primary reasons people use the app—team collaboration and productivity. Still, you might be surprised at the variety of ways your bot can interact with Slack users.

Let’s dive deep into the world of Slack bots. We look at what it takes to create one and how to integrate it with the platform. In addition, we offer a slack bots list of best use cases to demonstrate what your bot can achieve on the platform.

Why build a Slack bot?

There are lots of reasons to build a bot for Slack. Here are a few of the most compelling ones:

The main point is that Slack isn’t just another messaging application or social network—it’s a tool that businesses, organizations, and teams use to get work done. As we describe in this article, most bots that gain traction on the platform address an internal business problem or take advantage of an external business opportunity.

Simply put, most Slack bots help people do the things they were already going to do—only faster.

How to make a Slack bot

Start by reviewing the documentation for the Slack API. The first thing to understand is that this API allows you to build apps for Slack—not just bots. Slack apps come in various forms, and chatbots are among them. In other words, you’re really building a Slack app that happens to be a chatbot.

Step 1. Create a Slack app
The Slack API documentation explains how to do this. After following the instructions, you have a Slack app that resides in a single workspace. Over the long run, you can keep your app-turned-bot on that workspace, allow users to communicate with it on other workspaces, or even submit it to the Slack app directory. It’s your call.

Step 2. Review how bots work in Slack
In the API documentation, follow the section on building bots. It shows you how to:

Create a bot user. In Slack, bots are actually considered users. They’re not just peripheral entities that human users seek out; rather, they exist as regular participants in a given channel. After creating it, you set up your bot as a user and configure its settings, including username and display name.

Set up the Events API. Every Slack bot lives in a workspace. The Events API allows your bot to respond to messages and other activities that happen in a workspace.

Install your bot. You have to install the app (that is, your bot) to the workspace where it will interact with users.

Handle events. This includes receiving and responding to messages in the manner you intend and that users expect.

As you follow these steps, be sure to review some of the unique features of Slack apps. All of these are described in the documentation.

Slash commands, for example, are Slack-specific user requests that tell your app to do something. In response to a given slash command, your app will reach for some data on the backend, package it into a message, and reply to the user accordingly. Slash commands are a big part of the overall Slack experience, so your bot will likely need to know how to handle them.

Step 3. Choose a bot framework

Although the documentation can give you a good idea of how these bots operate, it includes this important note: “The real magic of a bot comes when it’s connected with external services, providing a seamless conversational interface for them within Slack.”

In other words, you can—and perhaps should—build your bot with a dedicated bot-building framework. Slack specifically calls out Botkit here, but there are numerous bot frameworks that come with powerful natural language understanding (NLU) capabilities, machine learning features, and integration with select enterprise services. If you need help getting started, check out our guide to bot-building frameworks.

Using a framework, you’ll also have a bot that you can deploy anywhere—not just on Slack. Many bot creators build bots for multiple platforms, such as Slack and Facebook Messenger, and then deploy those same bots on dedicated domains (like .BOT). That way, users can find (and keep using) your bot, even after their team outgrows Slack or moves communication to another platform.

Not sure what kind of domain is best for your bot, or is your preferred domain name already taken? Consider a .BOT domain name, a bot-centric option that’s perfectly suited for this purpose.

How to integrate your bot with Slack

Assume you’re planning to build your bot on a dedicated framework, let’s consider the process of integrating your bot with Slack. Since the Slack API documentation references Botkit, here’s a high-level overview of how the integration process works with this framework. Keep in mind that many of the major frameworks, such as Amazon Lex, Dialogflow, and Microsoft Bot Framework, offer similar integration options for your Slack bot.

Configure a bot in Botkit and Slack at the same time. Botkit documentation covers how this works, but you’re essentially making your Botkit bot interface with the Slack Events API.

Configure Open Authorization (OAuth). This authentication system gives your bot permission to interact with users.
Add a bot user, buttons, dialogs, and other components. Slack calls these interactive components, and you can send the interactions to a specified URL.

Enable event subscriptions. Doing so allows your bot to receive messages.

Add your bot. Log in to Slack, choose a team, and follow the rest of the prompts.

Review Botkit technical procedures. These include creating a Botkit controller, reviewing the different types of events, interactions, and webhooks, managing slash commands, and more. The technical procedures can be found in the Botkit documentation.

List of slack bot examples

Most bots in the Slack app directory perform work-related functions. You can find bot-driven developer tools, office administration bots, chatbots that help with security and compliance, and others. Let’s look at a few examples.

Human resources (HR) chatbots
By using tools like AttendanceBot and TimeBot, the HR office can easily track employee time, approve, or deny time-off requests and can send notifications to personnel.

Among messaging platforms, Slack is unique in providing HR with tools for managing otherwise tedious tasks—using bots, no less! Just consider the process of requesting time off. Normally, an employee might have to send an email or log in to a separate backend system. Then they’d have to wait for an HR manager to approve the request.

With a tool like AttendanceBot, that employee (who’s already logged in to Slack) can send the bot a message, like, Next week, I need to take Wed through Fri off. The bot then notifies an HR manager, who can approve or deny the request with a single click.

Productivity chatbots
Getting things done is arguably the primary purpose of Slack. So it makes sense that there are lots of productivity bots in the app directory.

Take Geekbot, which broadcasts status updates among team members after tracking asynchronous meetings. This could be useful if, for example, you’re waiting on a colleague to finalize a task. Geekbot notifies you where they are in their review process so that you don’t have to waste your time checking in.

Financial chatbots

Bots like Teampay help you manage purchases made by people on your team. You’re able to see costs, vendors, and purchasers. If you need to get permission for certain types of expenses, Teampay lets you do that, too.

Rydoo is another Slack bot that streamlines the management of travel expenses. It allows employees and HR professionals to upload receipt images, send mileage information, and (on the HR side) approve and reject expenses.

Getting started with Slack bots

Start by reviewing Slack’s documentation for building Slack apps. Then read about Incoming Webhooks and slash commands. Understanding these concepts can help you envision how your bot might behave on the platform.
After that, consult your chosen framework’s documentation about Slack integration and review Slack’s bot-building tutorial. There are few limitations with bot apps in Slack. If you’re planning to build a bot that helps teams do better work (and get it done faster), you’ll almost certainly have success.

Moreover, if you’re currently working on a virtual workspace, there's no better time to make your business more accessible between your team members and supervisors. We hope this guide has helped you activate Slack’s superpowers by either designing your own bot or selecting from the vast variety of options that the platform offers to boost your business as we dive into the new year!