How To Create A Chatbot For Slack In 2021

How To Create A Chatbot For Slack In 2021
ShopSmarts.AI – How To Create A Chatbot For Slack

A chatbot is a robot with Artificial Intelligence (AI) that can have a conversation with a human interlocutor. It can be used in many different situations and have various roles like answering customer queries, automating repetitive tasks, and more.

For example, assume you want to buy a pair of shoes from an ecommerce site that has it’s own chatbot. You can tell the bot that you are looking to buy some shoes, and it would have a conversation with you to gather more details, like “what brand/colour?”, “what’s your size?” and “what kind of shoes? Sneakers or boots?”. Instead of browsing through the website, you will have a conversation with the bot, mirroring the type of experience you would have when you go to the retail store.

Another example of a use case would be Starbucks’ chatbot:

It’s easy to order coffee while conversing with the bot, and then clicking on a bunch of buttons and searching for the orders manually. For these reasons, chatbots are one of the best ways to engage with the user. Now that we know what a chatbot is, let us get into the basics. Below is my definition of a chatbot:

In layman terms, a chatbot is a program that interacts with a user on a chat platform. It can be as dumb (fun) as you want it to be and as smart (resourceful) as you require it to be!

 is a chatbot specifically designed to be deployed on Slack. These bots are integrated into the Slack interface and can deal with a wide range of tasks like answering your team queries, publishing welcome messages, managing your channel, and many more. In a nutshell, Slackbots can act like full-fledged tools for your Slack workspace.

Step 1 Determine your Slackbot’s purpose:

  • ‍As previously mentioned, Slackbots can be used in a wide variety of cases. Thus, the first step to creating a Slackbot, and perhaps one of the most important steps, will be to define what roles you would like your chatbot to serve. As written in an article on Slack’s website, Slackbots can be used to:

  • Monitor and help process channel activity (Simple Poll can create polls in seconds, it makes the decision-making process way simpler)

  • Post messages in channels and react to members’ activity (AtSpoke responds automatically to common questions and puts in queue trickier ones)

  • Make channel messages interactive with buttons. (Trello uses boards to organise your work, you can also add tasks directly through Slack and it will update your Trello dashboard)

It will also be important for you to think about the names, profiles and profile pictures of your Slackbot as it will later be acting as a fully integrated co-worker on your Slack workspace.

Once you have a better idea of what you want your Slackbot to do, this is where the fun begins!

Step 2 – Create a chatbot with Ideta

Ideta is a platform which enables its users to create multiple chatbots without needing to learn nor write a single line of code. In fact, Ideta makes it possible for anyone to create their own chatbot in just a few hours. This time range is an indicator and can obviously vary depending on how complex and powerful you want your chatbot to become.

The steps to creating a Slackbot are quite similar to the ones one has to follow to create a ‘classic’ chabot. You can follow our tutorial for making a chatbot. For this example, let’s create a simple slack bot that tells you about the weather in the city of your choice.

1- Add your bubbles

‍Greet your users and tell them what this chatbot was made for. It’s important to clearly define the purpose of the chatbot so users are not confused when they use it.

2- Save the user city users pick

‍Once you will have greeted them, ask them which city’s whether they would like to know. Save their input as you will have to use this information later to retrieve the weather forecast through an API.

3- Connect to a weather API

You have to connect your chatbot to a weather API to be able to retrieve the information you want. We chose Weather Stack, as it has a clear and simple documentation and is free to use if you have under 1000 calls.

To connect Ideta to an API you have to make a GET request. The API url is given by Weather Stack. After “query=” you put the saved user input. This means, the query for this GET request is equal to the city of the user’s choice.

Step 3 Add on some Natural Language Processing (NLP)

Natural Processing Language (NLP) allows you to make your Slackbot even smarter. NLP can process human sentences and give relevant answers and information to users’ questions and queries. It makes your chatbot more effective and human-like.

At Ideta, we personally recommend you use Dialogflow, as we developed our own interface and made it very easy and intuitive for you to use it. You will be able to add overall NLP so users can ask questions whenever they want. You will also be able to ask many questions, making your Slackbot as complex as you like.

Step 4How to Build a Slack Chatbot in Node.js using Botkit

Chatbots are gaining popularity after the recent F8 conference where Facebook opened its door for the developers to build chatbots for messenger platform. If are willing to spend a little time, you can make your own bots easily and automate different things.

In this how to guide, we will build a hello world chatbot for Slack using Botkit — a popular and open source bot development kit written in Node.js.

1. Create a bot for your team in Slack:

  • Go to and click on Build your own at the top right corner.
  • Select Something just for my team and click on Make a custom integration.
  • Click on Bots under Build a Custom Integration menu.
  • Give your bot a username and click on Add bot integration. I used the username as botmaker_hello_bot.
  • On the Bot detail page, note down your API Token. You can customize your bot by giving name and uploading a profile pic.

Finally, click on Save Integration to save your bot profile.

2. Install BotKit:

Open your terminal and run npm install botkit  to install BotKit.

How it works?

Botkit simplifies the process of designing and running bots that live inside Slack.

It provides a semantic interface to sending and receiving messages so that developers can focus on building core logic and not to worry about API integrations.

In the above code, we have initialised a slack bot by providing an API token and used > bot.hears() to hear for users message and reply back with > bot.reply()

In the next how to guide, we will build a hello world chatbox for messenger using BotKit. Stay Tuned!

Step 5How to Build a Slack Chatbot using Dialogflow API

Breakthroughs in the field of Natural Language Processing (NLP) have seen a sudden rise in recent times. The amount of text data available to us is enormous, and data scientists are coming up with new and innovative solutions to parse through it and analyse patterns. From writing entire novels to decoding ancient texts, we have seen a variety of applications for NLP.

One of the most popular applications is a chatbot. Organizations like Zomato, Starbucks, Lyft, and Spotify are leveraging this technology on their website and mobile apps. As a user, we no longer need to worry about being put on hold – just type your query and the chatbot will instantly analyse the text and give the appropriate response.

Given how popular and useful these chatbots have become, I wanted to showcase how to make one. In this article, we will build a chatbot using Slack, the world’s largest communication app for teams. Then, we will utilize Google’s DialogFlow (previously to add intelligence to the bot.

Understanding Google’s Dialogflow ( for NLP and Machine Learning

Setting up DialogFlow

1. Go to and signup for free using your Google account

2. You will get access to your console:


DialogFlow works by creating agents. Agents are best described as NLU (Natural Language Understanding) modules. These can be included in your app, product, or service. They transform natural user requests into actionable data.

This transformation occurs when a user input matches one of the intents inside your agent. Intents are the predefined or developer-defined components of agents that process a user’s request.

For example, you tell the chatbot that you are feeling cold, or you want the fan to be turned off. The agent needs to know what the intent is behind these statements. More specifically, “What does the user wants me to do?”. Once the intent is known, a corresponding action/reply can be generated.

Now that we have the agent ready, we need to define some entities it needs to recognize and some intents it needs to understand.

Understanding intents and entities

a.) Entity

Entities are a group of objects that you need the agent to recognize. For example, if we are creating a pizzaBot, some of our entities would be objects that are usually required with a pizza:

Cheese, etc.

Let’s create our entities.

Click on the “Entities” button on the left and select “Create Entity”

  • Select a bunch of toppings for your pizza.
  • On clicking the “Save” button, you’ll have your toppings entity.
  • Let’s add another entity “Cheese” for our agent.

Now that our entities are ready, we need to define some intents that will help our agent understand what to do with these entities.

b.) Intent

In simple words, an intent is a mapping between what the user “says”, and what operation your bot takes on that instruction. If you click on the intent tab, you’ll see that there are two intents already present.

The default fallback intent when the bot doesn’t understand what the user is saying, and

the welcome intent which is triggered when the user says something along the lines of “hello” and you want the bot to respond to that with something similar.

Let’s play around with the default intents. Type “pizza please!” in the demo field on the right and see how the agent reacts:

Since we haven’t trained our agent yet, it used the default fall back intent and responded with one of the many responses it has stored for that scenario. Let’s create an intent to cook a pizza and call it “makePizza”. Click on create intent, select a name, and save it. You will see something like this:

The way DialogFlow works is by taking some sample user sentences to start out with. Then, it trains it’s engine to generate an algorithm that best matches these sentences to the correct intents. Let’s add some basic training phrases for our agent:

The idea is to train our agent in as diverse and varied examples as possible to make it more precise. Once you have set up the training phrases, you need to define what action the agent should take if it encounters this intent. You can do that by clicking on the “Add Parameters and Action” option. Add the following actions and parameters:

Bringing the Chatbot to life (Integrating DialogFlow and Slack)

DialogFlow (DF) is an excellent choice when it comes to integration with most popular applications. It supports integration with Slack right out of the box. Let’s get our DF agent to work with our Slack bot!

Setting up Slack app credentials with DialogFlow

On the left side of the window, click on the “Integrations” button and you will see a bunch of options. Select the Slack icon and click settings beneath that. The below box will pop up:

On the top right-hand side, toggle on the switch to “turn on” the integration with Slack.

Get the most out of a bot user

Let’s dive deeper into the ways that bots can affect your workspace and help things to run more efficiently.

? Monitor and process channel activity

A bot can help to monitor and process activity in the public and private channels that it’s been invited to, as well as messages that have been sent to it via direct message.

? Post messages and react to members

In addition to receiving messages, a bot can also post messages in channels that it’s a member of.

? Make messages interactive using buttons

When attached to a Slack app, bots can add interactive components (such as buttons) to messages, which members can interact with. These interactive components trigger specific actions on your servers, so that you can perform certain tasks

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts
Translate »