errbot icon indicating copy to clipboard operation
errbot copied to clipboard

Slack backend: no longer allows for creating user tokens, channels.create fails on bot token

Open mkj28 opened this issue 5 years ago • 1 comments

I am...

  • [ ] Reporting a bug
  • [x] Suggesting a new feature
  • [ ] Requesting help with running my bot
  • [ ] Requesting help writing plugins
  • [ ] Here about something else

I am running...

  • Errbot version: 6.1.4
  • OS version:docker python:3.7-alpine3.12
  • Python version: 3.7
  • Using a virtual environment: yes?(docker)

Issue description

Not sure how to phrase the ask here, maybe support a way to create channels on one of the currently Slack-supported methods?

Slack no longer allows for creating user tokens

with bot token getting:

  File "/usr/local/lib/python3.7/site-packages/errbot/backends/slack.py", line 1129, in create
    self._bot.api_call('channels.create', data={'name': self.name})
  File "/usr/local/lib/python3.7/site-packages/errbot/backends/slack.py", line 333, in api_call
    error=response['error'])
errbot.backends.slack.SlackAPIResponseError: Slack API call to channels.create failed: not_allowed_token_type

Steps to reproduce

  1. Create a classic app with legacy bot token per https://github.com/errbotio/errbot/issues/1402#issuecomment-663332878
  2. Try creating new room with:
room = self.query_room("testroom")
room.create()

it fails with errbot.backends.slack.SlackAPIResponseError: Slack API call to channels.create failed: not_allowed_token_type

Additional info

If you have any more information, please specify it here.

mkj28 avatar Aug 22 '20 08:08 mkj28

The Slack API has deprecated calls channels.*. A pull request has been created to update errbot to call the new Slack API equivalent functions https://github.com/errbotio/errbot/pull/1438. You could test the PR with your bot token to see if it resolves the issue for you.

nzlosh avatar Aug 22 '20 09:08 nzlosh