botkube icon indicating copy to clipboard operation
botkube copied to clipboard

Switch the Slack implementation from RTM to WebSockets

Open mszostok opened this issue 3 years ago • 0 comments

Warning If the new BotKube App will be published in Slack App Directory, the v0.12.4 release would not work. Beause of that the new version that supports the WS needs to be release. We can have a feature toggle for that.

Overview

The current Slack BotKube App is based on RTM. This means that it uses the old API. Screen Shot 2022-07-04 at 12 36 47

In this case, we are not able to:

  • reduce the app permission
  • select events to which we want to be subscribed (related issues: https://github.com/infracloudio/botkube/issues/619, https://github.com/infracloudio/botkube/issues/579)

Also, the current implementation exposes an API access token after OAuth for users to copy-paste into their Kubernetes cluster. As stated during Slack app resubmission process, this is against Slack guidelines on safe token storage, so we'll need to find another way for users to connect with Slack, such as providing an encrypted token.

Implementation

The best option would be changing the implementation from RTM to WebSocket mode.

Here is the migration guide: https://api.slack.com/authentication/migration

Acceptance Criteria

  • Drive the POC to check if WS implementation has all functionality that BotKube requires.
  • Before doing the change, announce it on the Slack #general channel. This change would require others to reinstall the app into workspaces, without that they will still use the old API.
  • The Slack BotKube App
    • has required permission only
    • subscribes to handled events only ("messages" and "connected")
    • follows Slack guidelines on safe token storage
    • is published to the Slack App Directory - THIS NEEDS TO BE ALIGNED WITH RELEASE.
  • Notification about reconfigured Slack App is posted on Slack and in release notes.
  • Get rid of the BotKube Slack app from Heroku

Resources

mszostok avatar Jul 04 '22 11:07 mszostok