Slack
ChatBotKit offers powerful integration with Slack, a popular collaboration and messaging platform for teams. This integration allows users to deploy chatbots on Slack, enabling them to interact with their chatbot directly from within the Slack platform.
Step-by-step Install Guide
Here is how to integrate ChatBotKit into Slack.
- Go to Integrations and then click the Slack Bot button.
- Fill in the Name and provide your chatbot Backstory
- Optionally select the bot Model, Dataset and Skillset.
- Save the integration by clicking the "Create" button.
Have a look at the following video instruction to complete the first phase of the installation process:
Once the Slack Integration is created you can install it by pressing the "Install" button. This button will automatically create the Slack Bot for you and set up all developer information. Make sure that you select the workspace where you want to install your chatbot.
As a final step, you need to provide the Slack Bot Signing Secret and Bot Token.
- Navigate to your Slack Bot (you already have this in a tab open if you have followed so far).
- Go to "Basic Information".
- Copy the "Signing Secret" value and paste into the "Signing Secret" field.
- Go to "OAuth & Permissions".
- Copy the "Bot User OAuth Token" and paste into the "Bot Token" field. If you do not see the bot token, click "Install to Workspace" button first.
Here is a video tutorial how to complete the second phase of the installation process:
How to Interact with your ChatBotKit Slack Bot
You can invite the chatbot to any channel. To start a new conversation, simply prefix your message with the chatbot's name. For example:
@MyChatBot How is it going?
Soon after this, you will see a reply to your message. The conversation will carry over the thread. Keep in mind that one thread is one conversation. Multiple users can converse on the same thread.
Alternatively, users can also interact with the ChatBotKit Slack bot through direct messages. Simply open a direct message with the bot and start messaging as you would with any other user. The bot will respond in real-time, just like in a channel conversation.
Advanced Setup Details
The following section contains advanced instructions how to setup your Slack Bot.
Slack Bot Signing Secret
The Slack Bot Signing Secret is a unique key that is used to verify that incoming requests to your app are actually coming from Slack. It is generated when you create your Slack app and is required for your app to function properly.
You can locate the Slack Bot Signing Secret by going to your Slack App Dashboard, selecting your app, and then navigating to "App Credentials". The signing secret will be under "Signing Secret". You will need to copy this secret and paste it into the "Signing Secret" field when setting up your ChatBotKit Slack integration.
Bot Token
The Bot Token is required to authenticate your chatbot with Slack. It is generated when you install your integration and allows your bot to send and receive messages within the Slack platform.
You can locate the bot token by going to your Slack App Dashboard, selecting your app, and then navigating to "OAuth & Permissions". The bot token will be under "OAuth Tokens for Your Workspace". You will need to copy this token and paste it into the "Bot Token" field when setting up your ChatBotKit Slack integration.
Event Subscriptions
Event Subscriptions allow your ChatBotKit Slack bot to listen for certain events that occur within the Slack platform, such as message events, app mention events, and reaction events. To set up Event Subscriptions, go to your Slack App Dashboard, select your app, and then navigate to "Event Subscriptions". Enable events and then add the following URL to the "Request URL" field: https://api.chatbotkit.com/v1/integration/slack/
[slackIntegrationId]
/event
. Make sure to replace the [slackIntegrationId]
with your slack integration identifier which you can find in the URL of your ChatBotKit Slack integration.
Event Subscription Events
Event Subscriptions Events allow you to specify which specific events your ChatBotKit Slack bot should listen for. Some examples of events include message events, app mention events, and reaction events. To set up Event Subscription Events, go to your Slack App Dashboard, select your app, and then navigate to "Event Subscriptions". Scroll down to the "Subscribe to Bot Events" section and select the events you want your bot to listen for. Save your changes and your bot will now listen for the specified events within the Slack platform. The following events are required: app_mention
, message.channels
, message.groups
, message.im
, message.npim
.
Bot Permissions
To ensure that your ChatBotKit Slack bot has the necessary permissions to function properly, you will need to grant it the following Bot Token Scopes: app_mentions:read
, channel:history
, chat:write
, group:history
, im:history
, and npim:history
. You can grant these scopes by going to your Slack App Dashboard, selecting your app, and then navigating to "OAuth & Permissions". Scroll down to the "Bot Token Scopes" section and add the necessary scopes. Make sure to save your changes once you have added the scopes.
App Home
The App Home feature in Slack allows users to interact with your ChatBotKit Slack bot in a dedicated space within Slack. This space can be customized to display information and actions that are relevant to the user, such as recent conversations. To set up App Home, go to your Slack App Dashboard, select your app, and then navigate to "App Home". From there, you can customize the layout and content of your bot's App Home. Make sure you select the "Allow users to send Slash commands and messages from the messages tab" option to allow users to directly chat with the bot in their own private channel.
Visible Messages
VisibleMessages offers enhanced conversational capabilities within Slack channels by considering a set number of previous messages in the channel as context for new user-bot interactions.
By default, the visibleMessages
flag is set to 0, which means that each new interaction with the bot starts a fresh conversation without any reference to previous messages in the channel. However, with this new feature, users can set the visibleMessages
to any number they wish, allowing the bot to take into account the most recent messages when initiating a conversation.
For example, if visibleMessages
is set to 10
, the bot will consider the last ten messages in the channel as part of the context for the new conversation. This means that if a user shares a 'secret word' like "avocado" in one of the last ten messages, and then asks the bot about the 'secret word', the bot will correctly deduce that the secret word is "avocado".
This enhanced contextual understanding is particularly beneficial in support channels where error messages are shared via Slack webhooks. With the new feature enabled, users can ask the ChatBotKit AI bot to interpret and explain these error messages. The bot will be able to understand the messages by considering them as part of the context, offering valuable assistance and insight in real-time.
Formatting
The ChatBotKit Slack bot supports all advanced formatting options including . This includes italics, bold, strikethrough, and code
. Hyperlinks can be included in messages as well. Images are supported and the bot can also recognize Slack's built-in emoji codes. For example, typing :smile:
will render as a smiling face emoji in Slack. This allows for a rich and engaging conversational experience.
Troubleshooting
My bot is not responding to message in the thread
This issue may be indicative of a lack of permissions. Make sure that your bot has the necessary Bot Token Scopes, such as app_mentions:read
, channel:history
, chat:write
, group:history
, im:history
, and npim:history
. You can grant these scopes by going to your Slack App Dashboard, selecting your app, and then navigating to "OAuth & Permissions". Scroll down to the "Bot Token Scopes" section and add the necessary scopes. Make sure to save your changes once you have added the scopes.
I cannot message my chatbot directly via the App Home screen
To resolve this issue, please check the App Home section in your Slack App Dashboard and ensure that the "Allow users to send Slash commands and messages from the messages tab" option is selected. This will allow users to directly chat with the bot in their own private channel.