Skip to content

[OPE-173] Migrate Slack integration from Socket Mode to HTTP Events API#101

Merged
singret merged 2 commits into
mainfrom
ope-173-slack-http-events
May 26, 2026
Merged

[OPE-173] Migrate Slack integration from Socket Mode to HTTP Events API#101
singret merged 2 commits into
mainfrom
ope-173-slack-http-events

Conversation

@singret
Copy link
Copy Markdown
Contributor

@singret singret commented May 26, 2026

Summary

  • Replaces Socket Mode (WebSocket) with standard Slack HTTP Events API — making the app Slack Marketplace compatible
  • Fixes the "Enable Events" toggle issue permanently: events are automatically enabled when request_url is set in the manifest
  • Removes SLACK_APP_TOKEN (xapp-...) — users now only need Bot Token + Signing Secret
  • All existing bi-directional sync features preserved: emoji reactions ack/resolve, @regen mentions, /incident commands, channel message → timeline sync

What changed

Backend

  • SlackEventHandler now uses *slack.Client directly; socketmode package and WebSocket goroutines removed
  • 3 new HTTP routes: POST /api/v1/slack/{events,interactions,commands} — each verified with HMAC-SHA256 before dispatch
  • SlackSignatureVerification middleware updated to accept signing secret as a parameter (read from DB, not env)
  • url_verification challenge response handled for initial Slack URL setup
  • Migration 000039: drops app_token column from slack_config

Frontend

  • App Token field removed from SlackSetupModal and WizardStepSlack

Manifest

How to test

  1. Update slack-app-manifest.yaml — replace YOUR-INSTANCE with your local ngrok URL
  2. Create/update the Slack app in the dashboard using the manifest
  3. Install to workspace — copy Bot Token + Signing Secret into Settings → Integrations → Slack
  4. Restart the backend
  5. Verify: /incident new Test, ✅ reaction → acknowledged, @regen summarise this incident

Closes

Closes OPE-173 | Unblocks OPE-168

singret added 2 commits May 26, 2026 04:40
Replaces the Socket Mode WebSocket transport with standard Slack HTTP
endpoints, making the app Marketplace-compatible and fixing the "Enable
Events" toggle problem that prevented bi-directional sync.

Backend:
- SlackEventHandler now holds *slack.Client (plain Web API); socketmode
  package and Start()/listen() goroutines removed entirely
- Three new public methods: HandleEventsAPI, HandleInteraction, HandleCommand
  replace the socketmode event loop — all existing business logic unchanged
- SlackSignatureVerification middleware updated to accept the signing secret
  as a parameter (DB-stored, not env var)
- Three new Gin routes: POST /api/v1/slack/{events,interactions,commands}
  each protected by HMAC-SHA256 signature verification
- url_verification challenge handled in /slack/events for initial URL setup
- Migration 000039: drops app_token column from slack_config
- SLACK_APP_TOKEN (xapp-...) no longer required or stored

Frontend:
- App Token field removed from SlackSetupModal and WizardStepSlack
- has_app_token and app_token fields removed from API types

Manifest:
- socket_mode_enabled: false
- request_url added to event_subscriptions, interactivity, and slash command
- YOUR-INSTANCE placeholder replaces hardcoded example URL
- Incorporates OPE-169 scope fixes (app_mentions:read, reactions:read,
  users:read.email, app_mention and reaction_added events)
- Replace /incident slash command with /regen across handler and manifests
- Fix slack_config_repository: remove app_token from hardcoded DoUpdates column list
- Remove dead SlackAppToken field from config (Socket Mode remnant)
- SlackHandlerResolver: lazy-init event handler from DB on first request,
  no server restart needed after Slack config is saved via UI
- SlackSignatureVerification: accept func() string so signing secret is
  read from DB per-request (survives config changes without restart)
- Routes: always register /slack/* endpoints regardless of startup state;
  pass resolver + dynamic secret instead of static values at boot
- Handlers: accept SlackHandlerResolver; ACK url_verification even when
  handler is not yet initialized
- SaveSlackConfig/DeleteSlackConfig: accept HandlerInvalidator to clear
  cached handler on config change
- Generic webhook: accept flat single-alert payload in addition to alerts array
- Remove slack-app-manifest.yaml (superseded by UI-generated manifest)
- Makefile: skip npm install when node_modules already exists
- Manifest generators (WizardStepSlack, SlackSetupModal): correct scopes,
  routes, socket_mode_enabled false, /regen command, no Socket Mode path
- Fix Bot Token setup instruction to mention Install to Workspace step
- .dockerignore: exclude frontend/node_modules from Docker build context
@singret singret merged commit 83c7ee9 into main May 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant