ChatGPT for Slack Bot logo

ChatGPT for Slack Bot

Free

A Slack bot that integrates with OpenAI's ChatGPT to provide answers.

FreeFree tier
Inputs: textOutputs: text
Type
Open Source

About ChatGPT for Slack Bot

A Slack bot built in Python that integrates with OpenAI's ChatGPT via the revChatGPT package. It listens for app_mention events in Slack using the Events API, extracts user messages, sends them to the ChatGPT model, and posts the generated response back to the Slack channel or direct message. The bot supports configuration through environment variables (OPENAI_API_KEY, SLACK_SIGNING_SECRET, SLACK_BOT_TOKEN) and can be deployed either via pip or using Docker with docker-compose. It also manages session refresh in a separate thread to maintain connectivity with the GPT-3 API.

Key Features

Listens for app_mention events via Slack Events API
Uses revChatGPT package for authentication and API communication
Configurable via environment variables (OPENAI_API_KEY, SLACK_SIGNING_SECRET, SLACK_BOT_TOKEN)
Supports both pip installation and Docker deployment
Handles session refresh in a separate thread to prevent expiry
Can be used in Slack channels and direct messages (with proper configuration)

Pros & Cons

Pros
  • Simple and quick setup with pip or Docker
  • Leverages proven revChatGPT package
  • Docker containerization simplifies deployment and scaling
  • Environment variable configuration keeps secrets secure
  • Automatic session refresh maintains API connectivity
Cons
  • Responses limited to pre-trained GPT-3 knowledge; may not handle niche or very recent queries
  • Requires setup of a Slack app and an OpenAI API key
  • Bot may not respond accurately to messages outside its training data

Best For

Answering user questions in Slack channels by @mentioning the botProviding GPT-3 responses within Slack direct messagesAutomating Q&A workflows in Slack workspaces

FAQ

How do I configure the bot?
Set the environment variables OPENAI_API_KEY, SLACK_SIGNING_SECRET, and SLACK_BOT_TOKEN before running the bot.
How do I run the bot?
Install dependencies with pip install -r requirements.txt and run python app.py, or use Docker by setting variables in variables.env and running docker-compose up -d.
What Slack events does the bot listen to?
The bot listens for app_mention events, triggered when a user mentions the bot in a Slack channel.
What is the default port for Slack events?
By default, the bot exposes port 4000 for Slack events.
What are the limitations of the bot?
The bot uses a pre-trained GPT-3 model, so responses are limited to the information in the model and may not accurately answer messages outside that scope.