A Python bridge that connects Slack DMs/threads to an Open WebUI instance.
Users register their Open WebUI API key via /enroll, then chat with AI
models through Slack. Single Flask app, HTTP webhook mode (no sockets).
Slack user ──DM/thread──► Single Flask app (Bolt HTTP mode)
│
├─ /slack/events → event webhook
├─ /slack/enroll → slash command
│
├─ message handler
│ 1. setStatus("processing")
│ 2. look up user API key (Postgres)
│ 3. create/lookup OWUI chat
│ 4. trigger completion
│ 5. post reply to Slack
│ 6. setStatus("active")
│
└─ assistant_thread_started → welcome message
One webhook URL handles everything.
- Python 3.10+
- PostgreSQL 14+
- Running Open WebUI instance
- Slack workspace (Developer Program sandbox works)
- Go to api.slack.com/apps → Create New App
- Do not enable Socket Mode (we use HTTP webhook mode)
- Under Bot Token Scopes, add:
chat:writechat:write.publicim:readmpim:readassistant:write
- Under Event Subscriptions, enable it, set Request URL to:
Subscribe to bot events:
https://<your-domain>/slack/eventsmessage.imassistant_thread_started
- Install the app to your workspace → copy the Bot Token (
xoxb-...) - Under Slash Commands, create one:
- Command:
/enroll - Request URL:
https://<your-domain>/slack/events(same URL!) - Short Description:
Register your Open WebUI API key - Usage Hint:
<api_key>
- Command:
Bolt routes both events and slash commands through the same webhook endpoint.
createdb openwebui_slack
psql openwebui_slack -f migrations/001_initial.sqlOr run the app directly — SQLAlchemy creates tables automatically.
cp .env.example .env
# Edit .env with your credentialspip install -r requirements.txt
python run.pyIn Slack:
/enroll your-openwebui-api-key
Then DM the bot with a message — it will respond via Open WebUI.
app/
config.py — Config from environment
db.py — SQLAlchemy engine & session
models.py — DB models (UserAPIKey, ThreadChatMapping)
handlers/
message.py — message.im handler (core loop)
thread.py — assistant_thread_started welcome handler
owui/
client.py — Open WebUI REST API client
__init__.py — exports OpenWebUIClient
migrations/
001_initial.sql — Initial Postgres migration
run.py — Entry point (Bolt HTTP mode + Flask)
.env.example — Environment template
requirements.txt — Python dependencies
| Phase | Description | Status |
|---|---|---|
| 0 | Prerequisites | ✓ Setup |
| 1 | Open WebUI client library | ✓ Done |
| 2 | Slack agent skeleton | ✓ Done |
| 3 | Wire the loop together | ✓ Done |
| 4 | Multi-turn follow-ups | Next |
| 5 | UX polish | Future |
| 6 | Hardening | Future |
| 7 | Test & ship | Future |