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.
- A Slack workspace
- Mendable AI API key
- Clone the repository to your local machine.
npm installto install all the necessary dependencies.
- Create a
.envfile 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
- Create a new app in your Slack workspace.
- Navigate to the "Socket Mode" section under "Settings" and enable it.
- 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").
- Navigate to the "OAuth & Permissions" section under "Features". Here, you will find your "Bot Token".
- In the "Scopes" section, add the following bot token scopes:
- Enable Event Subscriptions under "Features" and add the following event subscriptions:
- Install the app to your workspace.
npm run startto start the bot.
- Add the bot to a channel in your Slack workspace.
- Mention the bot in a message with a question. For example:
@MendableAI How to create a product copilot?
- The bot will respond with an answer in a thread and provide sources for its information.
- 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.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.