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

[ERROR] not_allowed_token_type error on new bot app #147

Open
loretoparisi opened this issue Feb 21, 2020 · 18 comments
Open

[ERROR] not_allowed_token_type error on new bot app #147

loretoparisi opened this issue Feb 21, 2020 · 18 comments

Comments

@loretoparisi
Copy link

I have created a brand new bot app (21 feb 2020).
I the put my new bot oauth token in the init:

// Slack bot
                self.bot = new SlackBot({
                    token: self._options.slack.botToken,
                    name: self._options.slack.botName,
                    // (boolean, defaults: false) whether to open websocket connection to listen to incoming messages, 
                    // set to true for one time use
                    disconnect: false
                });

where the bot oauth token starts with xoxb-, but I get the not_allowed_token_type in the event

// slack bot error
                self.bot.on('error', (error) => {
                    error = error || new Error('slack connection error');
                    self.logger.error("Channel slack connection error", error.toString());
                    return reject(error);
                });
@sb39
Copy link

sb39 commented Feb 22, 2020

@loretoparisi did you get to know how to overcome this error ?

@loretoparisi
Copy link
Author

@sb39 not yet, I have created a brand new app on the 21, according to slack on the 20th the new app oauth token have been deployed, so it should have work...

@bettysteger
Copy link

same issue: #145

@ntallapa12
Copy link

I am getting the same error, whats the status on this issue?

@thedesignchild
Copy link

Can confirm, same issue here too.. claims are that RTM is not allowed and that the issue can be solved if you make a simple slack app instead of a bot

@sb39
Copy link

sb39 commented Apr 8, 2020

I would recommend using Slack Official API, its much more flexible and very well documented

@baob
Copy link

baob commented Apr 8, 2020

Can confirm, same issue here too.. claims are that RTM is not allowed and that the issue can be solved if you make a simple slack app instead of a bot

I can confirm both that it's an existing issue AND that the workarounds suggested are fine. Here's what I said in the README of the app I'm building

Creating the slack app

MUST create CLASSIC slack app here and not the new style granular permissions app.
After that create a legacy app user then install the app to the workspace. Then the Bot Oauthh token will work.

Related docs:

@loretoparisi
Copy link
Author

loretoparisi commented Apr 9, 2020

Hello, so what I did was this

  • created a classic app ( I have followed the link above).
  • created oauth persmissions for chat:write and app_mentions:read (this step was required, otherwise I could not install and create the Bot User OAuth Access Token.

Then I have set the Bot User OAuth Access Token in the SDK:

self.bot = new SlackBot({
                    token: self._options.slack.botToken,
                    name: self._options.slack.botName,
                    // (boolean, defaults: false) whether to open websocket connection to listen to incoming messages, 
                    // set to true for one time use
                    disconnect: false
                });

and I get that error again:

Error: not_allowed_token_type
    at /Users/loretoparisi/Documents/Projects/node_modules/slackbots/index.js:46:33
    at Array.<anonymous> (/Users/loretoparisi/Documents/Projects/node_modules/vow/lib/vow.js:773:56)
    at callFns (/Users/loretoparisi/Documents/Projects/node_modules/vow/lib/vow.js:24:35)
    at processTicksAndRejections (internal/process/task_queues.js:75:11)

So now my guess is that the classic apps are actually not classic apps anymore. Is there any way to check if the app is actually a classic app?

@loretoparisi
Copy link
Author

[UPDATE]
Okay I have found the problem.
I cannot create a classic app anymore, BTW I had a classic old app (2015). I there fore chose the bot scope (deprecated scope), that is not available anymore to updated scopes apps:

Schermata 2020-04-09 alle 13 54 41

and now it works!

So at least in my Slack, I cannot have not classic apps, but it works with a deprecated app.
I would keep it open, until it's not adapted to the new apps. I assume that the deprecation has a deadline, after that this workaround would not work anymore.

Thank you.

@baob
Copy link

baob commented Apr 10, 2020

A very full and clear explanation of how to setup a classic app on slack for RTM (for this workaround) from elsewhere:
slackapi/hubot-slack#584 (comment)

@loretoparisi
Copy link
Author

loretoparisi commented Apr 10, 2020

@baob thank you. A question, maybe related to this classic app setup:

var params = {
     icon_emoji: ':rocket:'
 };
self.bot.postMessageToChannel(self._options.slack.botChannel, 'listening...', params);                    

the emoji does not appear in the slack chat. My fault?
Thank you.

@baob
Copy link

baob commented Apr 13, 2020

the emoji does not appear in the slack chat. My fault?

I suspect this s unrelated to the main topic of this thread. Two thoughts. (1) are you sure that emoji is available on your slack workspace ? (2) I remember seeing that initially but don't remember taking any specific action to cure it. Perhaps a caching issue ?

@loretoparisi
Copy link
Author

@baob yes I have the :rocket: emoji in the workspace. I have also tried to remove the :

// slack bot ready
self.bot.on('start', () => {
    var params = {
       icon_emoji: 'rocket'
    };
    self.bot.postMessageToChannel(self._options.slack.botChannel, 'listening...', params);
    return resolve(true);
});

@loretoparisi
Copy link
Author

I confirm now that the emoji works. The problem happens on slack in Chrome, while on slack mobile I can see emojis. Thanks!

@TomKulakov
Copy link

TomKulakov commented Oct 29, 2020

Are you guys ever planning to fix this? A few months later I have the same error after a fresh new project, and creating a new app bot.
I was following this tutorial. https://www.freecodecamp.org/news/building-a-slackbot-with-node-js-and-slackbots-js/
"slackbots": "^1.2.0"

@utricularian
Copy link

Bumping for visibility. Still cannot set fields

@Bear-Coding
Copy link

Are you guys ever planning to fix this? A few months later I have the same error after a fresh new project, and creating a new app bot.
I was following this tutorial. https://www.freecodecamp.org/news/building-a-slackbot-with-node-js-and-slackbots-js/
"slackbots": "^1.2.0"

Any fix for this? I was following the same tutorial

@esbenvb
Copy link

esbenvb commented Mar 21, 2022

To anyone coming here:

The tutorial on freecodecamp is based on obsolete Slack APIs and a module that's not supporting the recent versions.

I just wasted time on this module and tutorial as well, it should have an "Unsupported" disclamer in top, IMO.

However, I made something work with Slack's own bolt API.

https://blog.logrocket.com/build-a-slackbot-in-node-js-with-slacks-bolt-api/

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

No branches or pull requests

10 participants