What is a Slack Chatbot and how to create it?

By Joren Wouters Updated on

Want to save time and improve efficiency in your Slack workspace? Then you should use a Slack Chatbot.

This step-by-step tutorial will help you understand what Slack Bots are and how you can create one yourself, without writing any code.

We’ll cover:

  • What Slack Chatbots are and how they work
  • How you can make your own Slack Chatbot without coding
  • And how you can add AI to your Slack Bot

This guide is perfect for anyone who wants to use a Slack Chatbot to help their business run more smoothly.

What is a Slack Bot?

Slack Chatbot is a program that can automatically reply to messages on Slack. It can send welcome messages to Slack users who visit the bot and automatically reply to specific words in a Slack conversation or channel.

This bot can answer questions, manage tasks, and send information without needing a person to type each message. It’s designed to make work easier and faster.

Here is an example of a Slack chatbot that automatically tells jokes:

slack-chatbot-example
Source: Slack

 

How do Slack bots work?

Slack chatbots work using a simple plan that helps them talk and do tasks in Slack. This plan has three main parts:

  1. Trigger: This is what tells the chatbot to start talking. It could be a word, a question, or a kind of action in Slack. For example, if someone types ‘help’, the chatbot knows to start helping.
  2. Action: After the trigger, the chatbot does something. This could be sending a message back, sharing information, or doing a job like setting up a meeting. The chatbot is made to do many different things to help out.
  3. Condition: This is how the chatbot decides what to do. It looks at who is talking to it and what they need. If it’s someone new, the chatbot might say hello and offer to help. If it’s someone who’s talked to it before, it continues a previous chat.

For example, when someone talks to the chatbot, it first checks if they are new or have talked before. For a new person, it might say welcome and ask how it can help. For someone who’s back again, it gives them new information or reminds them where they left off last time.

These chatbots can talk to lots of people at once in Slack, making sure everyone gets the help they need quickly. They’re like smart helpers in Slack, making work easier and more organized.

how-slack-chatbots-work

 

How to Create a Slack Bot For Free

To create a Slack Chatbot we need to use a third-party chatbot platform, because Slack doesn’t have its own tool for making bots.

Popular Slack chatbot platforms include Flow XO, Engati, and Xenioo. These platforms are user-friendly and designed for people who don’t have coding skills.

It’s super simple to create a Slack Chatbot. Here’s how you can do it in 3 steps:

 

Step 1: Choose your chatbot platform

The first step is to choose the chatbot platform to build your Slack Bot on. For this tutorial, I am going to use Flow XO, because its:

  • Easy to use: You can get started immediately, even if have no experience with chatbots
  • No-code platform: You don’t need to write any code to create your Slack Bot
  • Free plan: Flow XO is free up to 500 interactions per month. Great to get started!

You can create your free Flow XO account by clicking the button below:

Create free Flow XO account

 

Step 2: Create your first flow in Flow XO

Once you have signed up for your account, we can create our first flow in Flow XO.  Go to Flows and click on + New (top-right corner):

flowxo-new-flow

Here, we can determine if we want to go with a pre-built template or with a Blank Flow. We will select the Blank flow:

flowxo-blank-flow

Then, we need to determine what triggers this flow, which will be a New message:

flowxo-new-message-trigger

We will set it up for all the bots connected to our Flow XO account (we will set this up later):

flowxo-connect-to-all-bots

And then we can determine the word we want to reply to. As an example, we want to reply when somebody asks for the wifi password.

So, we will fill in the following words and phrases:

flowxo-new-message-phrases

And we will set up so that the chatbot will reply in a private conversation and in public Slack channels:

flowxo-message-types

Now your flow will be saved and will look something like this:

flowxo-new-flow-example

If you click on the name of the flow (“Untitled flow”), you can also edit give it a better name so you know what the flow is about:

flowxo-edit-flow-name

 

Step 3: Create your Auto Reply Message for Slack

Now that we created our flow, we need to determine the automatic reply we want to send if someone asks for the wifi password.

You can create this reply by clicking on the + icon in the flow builder:

flowxo-add-action

Choose for Send message:

flowxo-send-message-action

And we can set a simple auto-reply for this message and click on Save:

flowxo-send-message-contents

Lastly, you need to activate the flow in the upper-right corner by clicking on the Off toggle:

flowxo-enable-flow

That’s it! Now, every time a user asks for the wifi password, your chatbot will automatically reply to it.

You can even test this out by clicking on the message bubble in the bottom right and talk to your chatbot:

flowxo-test-console

 

Publish your Bot on Slack

The last thing we need to do is connect our bot to our Slack workspace.

And this is also the trickiest part of the tutorial. But if you just follow every step that I take, you can connect your Flow XO Bot to Slack.

We can do this in a five simple steps:

  1. Create a bot in Flow XO and connect it to a Slack app
  2. Add a Redirect URL and add the right scopes
  3. Add Event Subscriptions to your Slack bot
  4. Add Interactivity to your Slack app
  5. Enable Slash Commands and your Slack chatbot to your workspace

 

Step 1: Create a Bot in Flow XO and connect it to a Slack App

The first step is to go to Bots in Flow XO and click on New in the top-right corner:

flowxo-new-bot

Then, select Slack as your channel:

flowxo-choose-slack-platform

And you can give your Bot a name, such as “Chatimize’s Slack Chatbot”:

flowxo-create-slack-chatbot

Before we can actually create the bot, we first need to add some information to Slack and from Slack to Flow XO.

So in order to do this, we need to create an app inside Slack.

Therefore, you need to go to https://api.slack.com/apps?new_app=1 and click on Create an App:

slack-create-app

Choose to create an app from scratch:

slack-app-from-scratch

And fill in the name of your app (can be the same name as in Flow XO) and pick the right Slack workspace:

slack-create-app-for-workspace

Now your Slack app is created, which we are going to use for our Slack chatbot.

Once you have created your Slack app, you automatically go to the Basic information tab of your app.

If you scroll down, you will find the section App credentials and you need to copy your Client ID and Client Secret to Flow XO:

slack-bot-app-credentials

 

Step 2: Add a Redirect URL and add the right scopes

Next, we need to go to OAuth & Permissions and add a Redirect URL to our Slack App.

You can get this URL from Flow XO. So if we go back to Flow XO, you will see that we have a Slack App Redirect URI, which we need to copy and paste into Slack:

slack-chatbot-redirect-url

Once you have added the Redirect URL, we need to add Bot Token and User Token scopes to our Slack app. We need this to be able to actually receive and send messages from Flow XO to Slack.

So in Slack, you can just scroll down on the same page and add the following Bot Token Scopes:

  • app_mentions:read
  • channels:history
  • channels:join
  • chat:write
  • chat:write.public
  • commands
  • groups:history
  • im:history
  • incoming-webhook
  • mpim:history
  • users:read
  • users:write

And add the following User Token Scope:

  • channels:history

So it eventually looks like this:

slack-app-bot-user-token-scopes

 

Step 3: Add Event Subscriptions to your Slack bot

Following, we need to add Event Subscriptions to our Slack bot.

In Slack, go to Event Subscriptions, set it to On in the top-right corner and add the following Bot User Events (under “Subscribe to bot events”):

  • message.channels
  • message.groups
  • message.im
  • message.mpim

Then, you also need to add the “Slack App Interactive Messages Action URL” from Flow XO to your Slack app:

slack-chatbot-add-event-subscription

 

Step 4: Add Interactivity to your Slack app

Next, we need to add Interactivity to our Slack app.

In Slack, go to Interactivity & Shortcuts, enable the Interactivity and paste the “Slack App Interactive Messages Action URL” from Flow XO inside the Request URL and click on Save changes:

slack-bot-add-interactivity

 

Step 5: Enable Slash Commands and your Slack chatbot to your workspace

Lastly, we need to enable slash commands and our slack chatbot to our Slack workspace.

First, go to your Slack app, click on App home and enable Allow users to send Slash commands and messages from the messages tab:

slack-app-allow-slash-commands

With this feature enabled, people in your Slack workspace can write slash commands and your bot can understand them and possibly process them.

Next, we need to go back to Flow XO and click on Next at the right-bottom of the page:

flowxo-slack-bot-next

Then, you need to click on Add to slack to add your chatbot to your Slack workspace:

add-flowxo-bot-to-slack

Slack will open up and you need to give permission to add the chatbot to your workspace:

allow-slack-chatbot-to-workspace

And now your chatbot is successfully connected to your Slack workspace. You can find the chatbot under “Apps” in the left sidebar and talk to it:

slack-chatbot-in-workspace

 

 

How to Add AI to your Slack chatbot

The next step is to add AI to our Slack chatbot. By using AI, we can automatically train our chatbot on our own website or documents, without manually creating flows (like we did above).

And luckily, Flow XO has AI built in their platform. So what we will do, is that we are going to upload our own document, and then Flow XO can automatically answer questions about that document.

To do this, go to Knowledge Base and click on New Knowledge Base:

Add a New Knowledge Base to Flow XO

Give it a name and click on Next:

Name your Knowledge Base in Flow XO

And decide what type of knowledge base you want to use. In Flow XO, you can use 4 types of knowledge bases:

  • Your complete website
  • Upload documents
  • Specific URLs of your website
  • Or manual (typing in text)

For now, we will just go with Manual (this is available on the Free plan) and click on Next:

Types of Knowledge Bases in Flow XO

Now, your knowledge base is created and we can upload our first document by clicking on Add Documents:

Add documents to a knowledge base in Flow XO

Then, select Upload and select a document from your computer and click on Complete:

Add a specific type of document to a knowledge base in Flow XO

Once you have done this, you will see that your knowledge base has a new document. Now, you can also test the answers of the knowledge base by clicking on Test:

click on the Test Button to test your knowledge base in Flow XO

Here, you can fill in your question and then the Knowledge Base automatically answers the question:

Ask a question to your Knowledge Base in Flow XO

Additionally, you can also change a few settings such as the OpenAI model and additional instructions.

Now that we have created our knowledge base, we also need to create a flow so we can use the AI in our Slack Bot.

To do this, create a new flow (just like we did above) and set the trigger to Catch-all:

Add a Catch-All Trigger to your chatbot flow in Flow XO

By using the Catch-All trigger, we can use our knowledge base as a fallback flow. The catch-all will trigger when no other flow in Flow XO is triggered when we get a new message. So, we can send this message to the knowledge base and hopefully it can answer the question for us.

To do this, we must click to add an action:

Add an action to your chatbot flow in Flow XO

Choose for Answer Question under Knowledge Base:

Add the Knowledge Base Answer Question Action to your flow in Flow XO

Here, you need to click on the Flow XO icon and select the Message variable:

Use the Message Variable from your catch-all message trigger.

Now, every time a user says something, their message will be sent to the knowledge base. If you click on Next, then the knowledge base action is added to your chatbot and your flow should look like this:

Knowledge Base Chatbot Flow in Flow XO

The only thing you need to do left is click on On and now you have AI added to your Slack Chatbot!

You can test it out quickly by clicking on the chat bubble (down right corner) and asking a question:

Test AI in your Flow XO's chatbot via the Test Console

 

How to Add your Slack Bot to a channel

When you’ve added your chatbot to your Slack workspace, it isn’t automatically added to every channel.

If you want to add your chatbot to a channel, you can just mention it inside the channel and Slack will automatically ask if you want to add it:

invite-chatbot-to-slack-channel

Now, you only have to click on Invite them and when you say “wifi password” the chatbot will reply inside the channel:

slack-bot-in-channel

 

Now It’s Your Turn

And that’s how you create a Slack chatbot, without writing a single line of code.

Now I have a question for you: How are you planning to use Slack chatbots for your business?

Please let me know by leaving a comment below👇

 

Frequently Asked Questions

Can Slackbots talk in group chats?

Yes, you can add Slackbots to channels where they can join in group conversations.

Do I need to know coding to make a Slackbot?

No, you can create a Slackbot without writing any code using platforms like Flow XO.

Can a Slackbot work all day and night?

Yes, Slackbots can operate 24/7 and handle multiple conversations at once.

How does a Slackbot know when to start talking?

It uses a ‘trigger’ which tells it when to start a conversation based on specific conditions.

Can I make my Slackbot reply to specific words?

Yes, you can set up your Slackbot to respond to certain words or phrases in Slack.

What if I want my Slackbot to send different messages to new and returning visitors?

You can program your Slackbot to recognize new versus returning visitors and send appropriate messages.

Do I need a separate platform to create a Slackbot?

Yes, since Slack doesn’t have its own bot creation platform, you’ll need to use a third-party service like Flow XO.

Can my Slackbot automatically reply in private and public channels?

Yes, you can set up your Slackbot to reply in both private conversations and public Slack channels.

Comments (9)

  1. Ricky

    I can get this to work in a channel, but not in a private DM chat. Is this just a matter of setting the BOT token scope? Or will I need to do something else to make this work in a DM chat? I’ve tried to @ my bot (invite) to a DM chat, but it doesn’t actually invite them.

    1. Joren Wouters

      Hey Ricky! What do you mean by a private DM Chat? Is this a group chat or a 1:1 chat with the Slack chatbot?

  2. Ricky

    OK, so looks like you can’t integrate the bot to an existing DM chat or an existing DM group chat. If you create a new DM and @ the bot into the conversation, then it’ll respond to messages. However, if you @ the bot in an existing chat, even though it says it’ll be invited, it won’t actually be included in the chat.

    From the api.slack.com page where you manage your BOT, you can add it to a workspace and choose a specific channel or even a DM chat to add it to. If you add it to a DM chat from there, the chat will say something like “added an integration to this channel: (name of your bot)” and it will still NOT respond to messages. Only way is to create a new DM chat and @ the bot while you add the users to include in the chat.

    Alternatively, convert the chat to a private channel and that’ll work. It kinda sucks but is there a way to make this work with existing DM chat, without going through what I did?

    1. Joren Wouters

      Hey Ricky! What do you mean by a private DM Chat? Is this a group chat or a 1:1 chat with the Slack chatbot?

  3. Chandni

    Are the 500 interactions of the free plan per month or once you reach them you have to change to a paid plan? 🙂

    1. Joren Wouters

      Hey Chandi! Yes, the 500 interactions are per month. So if you have more than 500 interactions within one month, you need to go with a paid plan 🙂

  4. Gopal

    Hi Joren Wouters,
    Great video. Can we integrate our application related APIs also in this? So that whenever there is an application related questions, the chatbot will call that api, get the response and share it in the slack? If its not possible, do you know, where can we get details about integrating custom/application apis with slack chatbot?

    Thanks.

    1. Joren Wouters

      Hey Gopal! Yes, that is possible using Flow XO.

  5. Gopal

    Hi Joren Wouters,

    Thanks for your response. Can you share some samples on custom application API integration?

Leave a Reply