Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Events API in socket mode for Slack adapter #2161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kolsys
Copy link

@kolsys kolsys commented Jul 1, 2024

This is beta version for modern Slack applications.
Changes implement Slack Events API in socket mode, see #964.

Fixes #2159
It also fixes files upload to Slack for modern Apps.

To activate Ecvents API in SocketMode you must:

  1. Create new modern App with following OAuth Bot scope (or upgrade Legacy)
channels:history
channels:read
chat:write
files:read
files:write
groups:history
groups:read
im:history
im:read
mpim:history
mpim:read
users.profile:read
users:read
  1. Acivate Socket mode
  2. Subscribe to the following events:
channel_history_changed
group_history_changed
im_history_changed	
message.channels
message.groups
message.im
message.mpim
  1. Add AppToken to the toml:
[slack]
    [slack.mybot]
    Token="xoxb-*******"
    AppToken="xapp-**********"

@@ -47,6 +53,135 @@ func (b *Bslack) handleSlack() {
}
}

func (b *Bslack) handleSlackClientSocketMode(messages chan *config.Message) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method Bslack.handleSlackClientSocketMode has 107 lines of code (exceeds 50 allowed). Consider refactoring.

@@ -47,6 +53,135 @@ func (b *Bslack) handleSlack() {
}
}

func (b *Bslack) handleSlackClientSocketMode(messages chan *config.Message) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method Bslack.handleSlackClientSocketMode has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 236869 lines exceeds the maximum allowed for the inline comments feature.

- Added support of Event API in socketMode
- Fix files upload for new applications
Copy link

codeclimate bot commented Jul 1, 2024

Code Climate has analyzed commit 5b86262 and detected 4 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 4

View more on Code Climate.

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.

Slack app classic deprecation, can't add new bots since 06/06/2024
2 participants