This repository contains the source code for a Slack bot that leverages DocsGPT to provide intelligent responses to user queries. This bot is an extension for DocsGPT.
- Responds to user queries with intelligent answers using DocsGPT.
- Maintains conversation history in threads.
- Supports multiple storage backends for conversation history (in-memory or MongoDB).
- Easily deployable using Docker.
- Supports multiple agents.
- A Slack App with Socket Mode enabled.
SLACK_BOT_TOKEN(xoxb-...) andSLACK_APP_TOKEN(xapp-...).- DocsGPT API Key.
To avoid manually configuring scopes and events, use the App Manifest:
-
Go to api.slack.com/apps.
-
Click Create New App and select From an app manifest.
-
Select your workspace and click Next.
-
Switch to the YAML tab and paste the following configuration:
display_information: name: DocsGPT description: An AI assistant powered by DocsGPT. background_color: "#0f172a" features: app_home: home_tab_enabled: false messages_tab_enabled: true messages_tab_read_only_enabled: false bot_user: display_name: DocsGPT always_online: true oauth_config: scopes: bot: - app_mentions:read - chat:write - im:history settings: event_subscriptions: bot_events: - app_mention - message.im socket_mode_enabled: true
-
Click Create.
-
Click Install to Workspace to authorize the bot.
- SLACK_BOT_TOKEN (
xoxb-...): Go to OAuth & Permissions (sidebar) -> Bot User OAuth Token. - SLACK_APP_TOKEN (
xapp-...): Go to Basic Information (sidebar) -> Scroll to App-Level Tokens -> Click Generate Token and Scopes -> Addconnections:write-> Generate.
-
Clone the repository:
git clone https://github.com/arc53/slack-bot-docsgpt-extenstion.git cd slack-bot-docsgpt-extenstion -
Set up a virtual environment and install dependencies:
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt -
Create a
.envfile:SLACK_BOT_TOKEN=xoxb-... SLACK_APP_TOKEN=xapp-... API_KEY=<your-api-key> # Optional: Multiple Agents # API_KEY_SALES=<sales-agent-api-key> # API_KEY_SUPPORT=<support-agent-api-key> # Optional: Storage (Defaults to memory) # STORAGE_TYPE=mongodb -
Run the bot:
python bot.py
- Build and run:
docker-compose up --build
DM the bot with any question: How do I use this?
Mention the bot in a channel: @DocsBot help
Use #agent syntax:
@DocsBot #sales pricing?- DM:
#support help me
MIT License.