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

Slack bot integration Error: not_allowed_token_type #123

Open
ImagineerNL opened this issue May 27, 2024 · 14 comments · Fixed by #124
Open

Slack bot integration Error: not_allowed_token_type #123

ImagineerNL opened this issue May 27, 2024 · 14 comments · Fixed by #124
Assignees
Labels

Comments

@ImagineerNL
Copy link

Trying to install this as a slack bot.

Created the app, added the oauth permissions as per instruction.
Copy/pasted the SLACK_BOT_TOKEN from the slack app settings "Bot User OAuth Token" , but get this error in my logs and it won't connect to slack.

exception in thread "main" java.lang.IllegalStateException: Failed to the RTM endpoint URL (error: not_allowed_token_type)
at com.github.seratch.jslack.Slack.rtmConnect(Slack.java:157)
at com.github.seratch.jslack.Slack.rtmConnect(Slack.java:132)
at com.github.seratch.jslack.Slack.rtm(Slack.java:123)
at com.botdarr.clients.slack.SlackBootstrap.init(SlackBootstrap.java:36)
at com.botdarr.BotdarrApplication.main(BotdarrApplication.java:13)

I'm using the docker app from the Unraid appdir, and manually added the needed variables from the readme.

Total log seems error free besides a lidarr warning (i dont have lidarr):

May 27, 2024 9:28:20 PM org.flywaydb.core.internal.logging.slf4j.Slf4jLog info
INFO: Flyway Community Edition 6.2.4 by Redgate
May 27, 2024 9:28:20 PM org.flywaydb.core.internal.logging.slf4j.Slf4jLog info
INFO: Database: jdbc:sqlite:database/botdarr.db (SQLite 3.30)
May 27, 2024 9:28:20 PM org.flywaydb.core.internal.logging.slf4j.Slf4jLog info
INFO: Successfully validated 3 migrations (execution time 00:00.010s)
May 27, 2024 9:28:20 PM org.flywaydb.core.internal.logging.slf4j.Slf4jLog info
INFO: Current version of schema "main": 3
May 27, 2024 9:28:20 PM org.flywaydb.core.internal.logging.slf4j.Slf4jLog info
INFO: Schema "main" is up to date. No migration necessary.
Exception in thread "main" java.lang.IllegalStateException: Failed to the RTM endpoint URL (error: not_allowed_token_type)
at com.github.seratch.jslack.Slack.rtmConnect(Slack.java:157)
at com.github.seratch.jslack.Slack.rtmConnect(Slack.java:132)
at com.github.seratch.jslack.Slack.rtm(Slack.java:123)
at com.botdarr.clients.slack.SlackBootstrap.init(SlackBootstrap.java:36)
at com.botdarr.BotdarrApplication.main(BotdarrApplication.java:13)
2024-May-27 21:28:20 PM [main] WARN com.botdarr.Config - Lidarr commands are not enabled, make sure you set the lidarr url, path, token, default profile

** Press ANY KEY to close this window **

@shayaantx shayaantx self-assigned this May 28, 2024
@shayaantx
Copy link
Owner

@ImagineerNL ill run thru steps 2moro night or next night and see if i can reproduce

@shayaantx
Copy link
Owner

@ImagineerNL I ran through https://github.com/shayaantx/botdarr/wiki/Install-Slack-Bot and didn't have an issue (well I was running an older jdk 8 and got certificate errors, but once I upgraded it was fine)

I did update slack api #124, but I couldn't reproduce your error

Did you create a classic app? or a modern one? (looks like eventually classic apps are gonna die, so guess these instructions will need to change)

image

If you're on discord or matrix or slack, post your handle, and I can look at your issue live too

@ImagineerNL
Copy link
Author

I'll dig a bit further in what it might be, thanks for looking.
I assume it was a classic app, that might have been the issue

@ACupOfAvgJoe
Copy link

classic Slack apps are no longer supported, any chance there will be support for modern apps? getting the same not_allowed_token_type error.

@ImagineerNL
Copy link
Author

I did update slack api #124, but I couldn't reproduce your error

Would it be possible to push this to live (and to the docker version)?

Did you create a classic app? or a modern one? (looks like eventually classic apps are gonna die, so guess these instructions will need to change)

Modern App, as Classic apps cannot be created anymore.

@shayaantx
Copy link
Owner

@ImagineerNL @ACupOfAvgJoe I will spend some time this week going through that PR and see what I can do to get it working again

@shayaantx
Copy link
Owner

@ImagineerNL @ACupOfAvgJoe

I spent some time tonight updating the PR to get off RTM mode and onto socket mode for slack modern apps, see 6392b19

I've also made a new wiki page for creating modern slack apps to work with the bot in general here https://github.com/shayaantx/botdarr/wiki/(wip)-Install-Slack-Bot-via-Slack-modern-app

Both are still wip

I will work on it more tomorrow night.

@ImagineerNL
Copy link
Author

Thank you.
With this updated wiki it is at least connecting to the slack channel without errors.
The integration itself is not working yet, but that would probably be the PR you're still working on.

The only error still in the log is from lidarr, which i dont use and i have removed the docker variables
2025-Jan-09 14:44:56 PM [main] WARN com.botdarr.Config - Lidarr commands are not enabled, make sure you set the lidarr url, path, token, default profile

@shayaantx
Copy link
Owner

Thank you. With this updated wiki it is at least connecting to the slack channel without errors. The integration itself is not working yet, but that would probably be the PR you're still working on.

The only error still in the log is from lidarr, which i dont use and i have removed the docker variables 2025-Jan-09 14:44:56 PM [main] WARN com.botdarr.Config - Lidarr commands are not enabled, make sure you set the lidarr url, path, token, default profile

That warning occurs when you don't have lidarr configured (you can ignore it if you don't use lidarr)

Yea it def won't work without changes, hopefully I can get bulk of it working tonight

@ImagineerNL
Copy link
Author

i didnt assume that one had anything to do with this item; just noted it as an fyi, as that is the only one that comes up as 'unconfigured', while all other integrations that arent configured dont show up in the log either.

And no rush; take your time.

@shayaantx
Copy link
Owner

@ImagineerNL I pushed the fixes for latest version 5.6.16, the wiki is updated with all required scopes

I tested most functionality of the bot via slack and it all seems to work, lemme know if you find any issues, otherwise I'll close the issue

@shayaantx shayaantx linked a pull request Jan 11, 2025 that will close this issue
@ImagineerNL
Copy link
Author

Updated the docker, Followed the updated wiki, no new errors.

And at least now i get a message in log, so i know the slack socket connection is open
Jan 12, 2025 11:27:02 PM com.slack.api.socket_mode.impl.SocketModeClientTyrusImpl onOpen INFO: New session is open (session id:XXXXXXXXX

And a timeout message popped up in slack 'Error - Request failed with status code=404, reason=Not Found' which was resolved by setting SONARR_V4 to true.
So i know the connection is working.
It's just not responding to '$help' etc (i've tried the command prefix at '!' and '$' , so far no response)

I'm guessing it's an error with the scopes, and for now i'll need to dig in to it a bit more to see what i'm missing.
I might eventually be better off to scrap the current fiddled 'slack-app' and start a new one from scratch following the wiki.

It seems no action on your part is needed yet.
Thanks for your hard work so far!

@shayaantx
Copy link
Owner

shayaantx commented Jan 13, 2025

Updated the docker, Followed the updated wiki, no new errors.

And at least now i get a message in log, so i know the slack socket connection is open Jan 12, 2025 11:27:02 PM com.slack.api.socket_mode.impl.SocketModeClientTyrusImpl onOpen INFO: New session is open (session id:XXXXXXXXX

And a timeout message popped up in slack 'Error - Request failed with status code=404, reason=Not Found' which was resolved by setting SONARR_V4 to true. So i know the connection is working. It's just not responding to '$help' etc (i've tried the command prefix at '!' and '$' , so far no response)

I'm guessing it's an error with the scopes, and for now i'll need to dig in to it a bit more to see what i'm missing. I might eventually be better off to scrap the current fiddled 'slack-app' and start a new one from scratch following the wiki.

It seems no action on your part is needed yet. Thanks for your hard work so far!

lemme know if you want to debug it live on slack or discord

I noticed if you add scopes to the modern app, I had to reinstall the app to the workspace each time (as I was testing)

@shayaantx
Copy link
Owner

@ImagineerNL any issues ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants