Slack Bot Integration
Connect Gurubase with Slack to enhance your workflow
Introduction
Integrate Gurubase with Slack to ask your Guru directly within your Slack workspace.
For self-hosted version, you first need to setup a Slack App manually to get a bot token. Please refer to the Slack App Setup for Self-hosted version section for more details.
Steps to Integrate
-
Navigate to Integrations
- Go to the Gurubase dashboard.
- Click on “My Gurus” under the profile
- Click on the Guru you want to integrate with Slack
-
Select Slack Bot
- Click on the “Slack Bot” option.
- Connect to Slack
- Click the “Connect” button.
- Authorize Gurubase to access your Slack workspace.
- Select Channels
- Click “Add Channel”
- Type in the ID of the channel you want to integrate with Gurubase.
- Select “Auto” or “Manual” mode for usage. Auto mode responds to every message sent in the channel while Manual mode requires mentioning the bot for responses.
- Click “Save”.
In Auto mode, you still need to mention the bot under threads. It only responds to initial messages that do not belong to threads.
Finding out Channel IDs
The ID of a channel can be found with two approaches:
- The web URL
- Right click to your channel, hover to “Copy” and click “Copy link”. This will give you a link in this format:
https://workspace.slack.com/archives/C08AH3Y4Z5K
. Here,C08AH3Y4Z5K
is the channel ID.
- The channel details in the UI
- Right click to your channel, click to “View channel details”. At the bottom, you will see “Channel ID”.
You can copy these to the UI and integrate your channel.
To subscribe to a private channel and send test messages to it, you need to invite the bot to the channel. You can do so from the Slack app using the “Add apps to this channel” command. This is not needed for public channels.
-
Test the Connection
- Use the “Send Test Message” button to ensure the integration is working.
-
Enable Direct Message Mode (Optional)
- Tick the “Enable Direct Messages” checkbox to allow the bot to respond to your direct messages. In this mode, the bot will respond to all of your messages without mentions whether in thread or not.
Permissions
Gurubase will request the following permissions:
- View content and info about channels & conversations.
- Perform actions in channels & conversations and send messages as Gurubase bot.
Using the Bot
Once integrated, you can mention the bot using @Gurubase.io
in your Slack channels to ask questions directly to your Guru.
For self-hosted version, you need to mention the bot using @<app_name_you_gave_to_the_bot>
instead of @Gurubase.io
.
Slack App Setup for Self-hosted version
For self-hosted version, you need to create your own Slack app to create a bot to integrate with your Gurubase Self-hosted instance. Below are the steps to create the app and get the bot token.
- Go to https://api.slack.com/apps and click “Create New App”.
- Select “From scratch” to create a new app:
- Enter a name for your app (e.g., “Gurubase”)
- Choose your Slack workspace from the dropdown
- Click “Create App” to proceed
- Slack will send events to
/api/slack/events/
endpoint of your Gurubase instance. If the Gurubase instance URL is not public, you need to open it to public. You can use ngrok to do this:- If you haven’t changed, the default port of Gurubase instance is 8029. You need to use this to make it publicly accessible.
- Make Gurubase instance URL public with
ngrok http http://localhost:8029
- Copy the public URL from the ngrok terminal as shown below:
- Go to “Event Subscriptions” page on your Slack app and enable it.
- Set your public url along with the path
/api/slack/events/
as “Request URL”, this is the url that Slack will send the events to. Be careful with the trailing slash at the end of the url. You should see the “Verified” green text if the url is correct.${your_public_gurubase_url}/api/slack/events/
If you change the Gurubase instance URL, you need to update the “Request URL” with the new URL.
- Expand the “Subscribe to bot events” section on “Event Subscriptions” page and add the following events:
message.channels
message.groups
message.im
- Save changes.
- Go to “OAuth & Permissions” page on Slack app. Scroll to “Bot Token Scopes” under “Scopes” section and add the following permissions:
channels:join
channels:read
chat:write
groups:read
channels:history
groups:history
im:history
- Navigate to “App Home” under Features in the left sidebar. You can also access it directly at:
https://api.slack.com/apps/<app_id>/app-home
- Under “Show Tabs”, enable “Messages Tab” and tick “Allow users to send Slash commands and messages from the messages tab”.
- Go to “Install App” page. Then click “Install to [your_workspace_name]”.
- Go through the OAuth flow.
- After installation, you will be redirected to the same page.
- Copy “Bot User OAuth Token”.
- Go to your guru’s Slack integration page in the Gurubase UI and paste the bot token you copied and click “Connect”.
- You can now follow the Steps to Integrate.