Slack Integration
Get actionable notifications and review code without leaving Slack
OpenCodeHub's Slack integration sends real-time notifications for repository events and allows quick actions directly from Slack channels.
Overview
Supported Events
| Event | Notification | Actions |
|---|---|---|
| Pull Request opened | Title, author, branch, link | Review, Approve, Comment |
| PR approved / changes requested | Reviewer, status | View diff |
| PR merged | Merger, commit count | View commit |
| CI failed | Job name, failure step | View logs, Retry |
| Issue created / assigned | Title, assignee | View, Comment |
| Release published | Version, changelog | View release |
| Merge queue status | Position, ETA | Pause queue |
| Security alert | Severity, description | View alert |
Setup
1. Create a Slack App
- Go to api.slack.com/apps
- Click Create New App → From scratch
- Name it "OpenCodeHub" and select your workspace
2. Configure Permissions
Add the following Bot Token Scopes under OAuth & Permissions:
chat:write
chat:write.public
im:write
users:read
files:write
3. Install App to Workspace
- Click Install to Workspace
- Copy the Bot User OAuth Token (starts with
xoxb-)
4. Configure OpenCodeHub
Add to your .env:
SLACK_ENABLED=true
SLACK_BOT_TOKEN=xoxb-your-token-here
SLACK_SIGNING_SECRET=your-signing-secret
Or configure via the web UI:
- Go to Organization Settings → Integrations → Slack
- Paste the bot token and signing secret
- Click Test Connection
- Select default notification channel
5. Subscribe Repositories
Per-repository Slack settings:
- Go to Repository → Settings → Integrations
- Enable Slack notifications
- Choose channel (or use default)
- Select which events to notify
Notification Format
Pull Request Opened
🔀 New Pull Request in `my-repo`
*Add user authentication* by @alice
Branch: `feature/auth` → `main`
<Review PR | Approve | Request Changes>
CI Failed
❌ CI Failed in `my-repo` — PR #42
*test* job failed at step "Run unit tests"
<View Logs | Retry Job>
PR Approved
✅ PR #42 approved by @bob
*Add user authentication*
Ready to merge!
<Merge | View PR>
Slash Commands
After installing the Slack app, use these commands in any channel:
/och prs [repo] List open PRs
/och review <pr-number> Quick review a PR
/och queue [repo] Show merge queue status
/och issues [repo] List open issues
Threaded Discussions
PR notifications create threaded discussions in Slack:
- PR opened → Notification posted
- Team discusses in thread
- Comments sync back to OpenCodeHub
- Review decisions posted in thread
This keeps PR context in one place without cluttering the main channel.
Channel Mapping
Route different events to different channels:
| Channel | Events |
|---|---|
#dev-pull-requests |
PR opened, approved, merged |
#dev-ci |
CI failures, pipeline status |
#dev-alerts |
Security alerts, merge queue issues |
#releases |
New releases, deployments |
Configure per repository in Repository Settings → Integrations → Slack.
Troubleshooting
"Notifications not appearing"
- Verify the bot is invited to the channel (
/invite @OpenCodeHub) - Check repository subscription settings
- Verify
SLACK_BOT_TOKENis correct - Check OpenCodeHub logs for Slack API errors
"Test connection fails"
- Ensure the bot token starts with
xoxb- - Verify the app is installed to the correct workspace
- Check that
chat:writescope is granted
"Too many notifications"
- Enable notification batching (group events within 5 minutes)
- Filter by event type in repository settings
- Use
@mentionsonly mode for noisy repos