Integration Guides

Creating an AI Slack Bot

Use our Premade Slack Bot

Mendable comes with a one click solution to use any project in your Slack workspace. This is a great way to quickly test and show off your Mendable bot to the team! All you have to do is click the "Add to your slack" button on your project dashboard or click here.

To configure the bot, you need to set which Mendable API key you want to use for each channel you plan on using the bot in. You can find your anon key on the project dashboard in the API keys tab. Grab your anon key and run the command /set-mendable-key YOUR-ANON-KEY in your desired channel. Once this is done, the bot will be connected and to ask a question just do: /chat YOUR-QUESTION.

*If you have whitelists enabled for your project, you need to allow requests from our slack server URL https://slackserver-production.up.railway.app/

Build your own Slack Bot

Mendable provides an easy way to create a Slack bot that can answer questions about your project. This guide will show you how to create a Slack bot that uses the Mendable API to answer questions and provide sources for the answers. It creates a new thread for each question asked and stores the history of the conversation.

Prerequisites

  • Node.js
  • A Slack workspace
  • Mendable AI API key

Installation

  1. Clone the repository to your local machine.
  2. Run npm install to install all the necessary dependencies.
  3. Create a .env file in the root directory of the project and add the following environment variables:
MENDABLE_API_KEY=<Your Mendable API Key>
SLACK_BOT_TOKEN=<Your Slack Bot Token>
SLACK_SIGNING_SECRET=<Your Slack Signing Secret>
SLACK_APP_TOKEN=<Your Slack App Token>

Slack App Setup

  1. Create a new app in your Slack workspace.
  2. Navigate to the "Socket Mode" section under "Settings" and enable it.
  3. Navigate to the "Basic Information" section under "Settings" and scroll down to "App Credentials". Here, you will find your "Signing Secret" and "App Token" (under "Tokens for Your Workspace").
  4. Navigate to the "OAuth & Permissions" section under "Features". Here, you will find your "Bot Token".
  5. In the "Scopes" section, add the following bot token scopes: app_mentions:read, channels:history, channels:read, chat:write, commands, groups:history, groups:read, im:history, im:read, im:write, mpim:history, mpim:read, mpim:write.
  6. Enable Event Subscriptions under "Features" and add the following event subscriptions: app_mention.
  7. Install the app to your workspace.

Usage

  1. Run node index.js or npm run start to start the bot.
  2. Add the bot to a channel in your Slack workspace.
  3. Mention the bot in a message with a question. For example: @MendableAI How to create a product copilot?
  4. The bot will respond with an answer in a thread and provide sources for its information.

Features

  • The bot maintains a history of conversations, allowing it to provide context-aware answers.
  • The bot provides sources for its answers, ensuring transparency and verifiability of information.
  • The bot responds to direct messages as well as mentions in channels.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Previous
Routers