seratch/ChatGPT-in-Slack

Swift demonstration of how to build a Slack app that enables end-users to interact with a ChatGPT bot

ChatGPT‑in‑Slack

What it is – An open‑source Slack app that lets you talk to OpenAI’s ChatGPT (and DALL‑E 3) directly from Slack. It works in three ways: in a channel thread, in a 1‑on‑1 DM, or via a Home‑tab modal. The bot keeps the conversation context inside a thread, so you can refine prompts just like on the ChatGPT website.

Key features

  • Threaded conversations – Mention the bot once to start a thread; subsequent messages are automatically sent to ChatGPT, preserving context.
  • Private DM support – Ask the bot privately without needing a mention.
  • Home‑tab UI – Quick‑access dialogs for proofreading, free‑form prompts, and image generation (DALL‑E 3) that work on mobile.
  • Configurable OpenAI settings – Model, temperature, system prompt, language translation, markdown conversion, redaction, and image‑file sharing can be toggled via environment variables.
  • Docker & Socket Mode – Deployable behind your own firewall; uses Slack’s Socket Mode so no public URL is required.
  • Azure OpenAI compatibility – Optional environment variables let you point the app at Azure’s OpenAI endpoint.
  • Function‑calling demo – Experimental support for OpenAI function calling via a test module.

How to run it locally

  1. Create a Slack app from the provided manifest-dev.yml and install it in your workspace.
  2. Set the required env vars (SLACK_APP_TOKEN, SLACK_BOT_TOKEN, OPENAI_API_KEY). Optional vars let you pick a model, temperature, etc.
  3. Install dependencies (pip install -r requirements.txt) and start the bot (python main.py).
  4. (Optional) copy .env.example to .env and edit the values for easier local development.

Deploying for a company

  • Build the supplied Dockerfile. The container runs in Socket Mode, so it only needs outbound connections to Slack and OpenAI.
  • Because the code is MIT‑licensed, you can host it on your own infrastructure, ensuring that any confidential data stays within your control.

Typical use cases

  • Drafting or polishing emails, reports, or any text directly from Slack.
  • Quickly generating images with DALL‑E 3 without leaving the chat.
  • Getting instant code snippets, explanations, or brainstorming ideas while collaborating.
  • Providing a shared “AI assistant” that team members can reference in public threads.

Related projects

  • iwamot/collmbo – a fork that adds support for other LLM providers via LiteLLM.

License – MIT.

Related

  • Project
  • Project
  • Dispatch
  • Project
  • Project