botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
70 stars 83 forks source link

channel-slack RTMClient does not start #939

Closed null-directory closed 2 years ago

null-directory commented 4 years ago

Describe the bug

Slack is deprecating RTM bot permissions. This link currently works but won't past 2020-02-21 Slack: Create new legacy RTM app

On a banner at the top of the newly created app page:

Slack has improved how we handle permissions for apps, so you can now request only the specific scopes your app needs. We recommend updating your app’s scopes. Beginning February 21, all new app submissions to the App Directory must use granular permissions. Read our blog post.

When configuring Slack integration with granular permissions (container (10).log) , container startup fails with the following error (also attached). Digging in, this seems to be related to how Slack is setting up App integrations, where new apps by default do not use the RTM permissions.

no port specified, defaulting to port 8000 
Listening on http://0.0.0.0:8000 
  ======================================== 

                                     Version 12.5.0              
                                 OS linux ubuntu_18_04          
                        ======================================== 
  App Data Dir: "/root/botpress" 
  Using  modules 
                         analytics 
                         basic-skills 
                         builtin 
                         channel-slack 
                         channel-web 
                         code-editor 
                         examples 
                         extensions 
                         nlu 
                         qna 
                         testing 
                        ⊝ channel-messenger  
                        ⊝ channel-smooch  
                        ⊝ channel-teams  
                        ⊝ channel-telegram  
                        ⊝ hitl  
                        ⊝ misunderstood  
                        ⊝ nlu-extras  
                        ⊝ nlu-testing  
                        ⊝ uipath  
  Loaded 11 modules 
  Loaded 7 content types 
  [greeter] Interactive Endpoint URL: https://botpress.null.directory/api/v1/bots/greeter/mod/channel-slack/bots/greeter/callback 
[INFO]  RTMClient:1 unable to RTM start: An API error occurred: not_allowed_token_type 

To Reproduce Steps to reproduce the behavior:

  1. Create example greeter bot.
  2. Activate channel-slack module
  3. Configure channel-slack.json for the bot, using tutorial in the Botpress Slack integration
  4. See error

Expected behavior Botpress starts and greeter bot responds in Slack.

Screenshots

From the container orchestration logs: image

Warning from the Slack admin page: image

Counterpoint: creating a legacy bot to show difference: image

After configuring as tutorial suggests: image

And here's the bot on my Slack channel: image

Environment (please complete the following information):

luisbattle commented 4 years ago

Hi Any idea about the fix? thanks

null-directory commented 4 years ago

Looking at the Event and RTM API, I'm guessing we could maybe port directly from RTM to Events. I'm willing to dig into it and learn enough to make a patch, I just won't be able to touch it for a couple weeks or so.

spg commented 4 years ago

I confirm the issue is happening. Thanks for reporting. You can find more information about the upstream issue here: https://github.com/slackapi/node-slack-sdk/issues/921

The solution would be to support both the RTM api (for legacy Slack apps) and the Events (for Bot Granular Permissions apps). Removing support for the RTM api from Botpress would introduce breaking changes to existing Botpress installations.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

EFF commented 2 years ago

Fixed