slack icon indicating copy to clipboard operation
slack copied to clipboard

Using slack-go for new slack app

Open Qsick opened this issue 4 years ago • 8 comments

I have been trying to follow the examples but have been unsuccessful to get it to authenticate properly. It is returning an error related to RTM and that would be the classic bot OAuth from my understanding.

Does this library support the use of tokens for new slack apps instead of classic? If so could someone direct me to an example?

Qsick avatar Oct 15 '20 19:10 Qsick

Hey, did you succeed doing so? I'm currently trying to learn go on a useful project, and a small slack bot sounded useful, but this is really a show-stopper currently for me. Would be <3 to get some pointers (alternative projects are also fine)...

lenalebt avatar Nov 07 '20 19:11 lenalebt

It will work for me using the Slack classic tokens but I haven't gotten it to working using the bot token for the new Slack API.

On Sat, Nov 7, 2020 at 11:02 AM Lena Brüder [email protected] wrote:

Hey, did you succeed doing so? I'm currently trying to learn go on a useful project, and a small slack bot sounded useful, but this is really a show-stopper currently for me. Would be <3 to get some pointers (alternative projects are also fine)...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/slack-go/slack/issues/827#issuecomment-723482201, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAM6LR4QM3X6JZUH2UIBM3TSOWKUPANCNFSM4SSNGTNA .

Qsick avatar Nov 09 '20 04:11 Qsick

Could you share reproducible code?

kanata2 avatar Dec 08 '20 20:12 kanata2

I fell back to also using the classic tokens, which I think are only available if you add some query parameter to the URL where you need to set the credentials up for your app in slack (I don't remember exactly, but it was along the lines of "token=classic" or "classic=true"). When you have one of those, the code from the repo works well.

lenalebt avatar Dec 09 '20 07:12 lenalebt

Still can't use the slack-go with the new slack token, It gives not_allowed_token_type error. Only 2 options remain, use Events API or create a classic slack app token. Any 3rd option?

kunal15145 avatar Feb 11 '21 17:02 kunal15145

@kunal15145. If you only need a bot and don't what to bother with the slack app configuration. Use https://slack.com/apps/A0F7YS25R-bots, this will add a bot in your workplace and provide you with the token for that bot (xoxb-...). I use that solution when I want to test things out, I hope it helps in your case.

xNok avatar Feb 21 '21 21:02 xNok

Faced the same issue today, almost in the end of 2021! A brand new slack app, app and bot token for websocket connection:

slackApi := slack.New(conf.Slack.BotToken, slack.OptionAppLevelToken(conf.Slack.AppToken), slack.OptionDebug(conf.Slack.Debug))
slackRtm := slackApi.NewRTM()
go slackRtm.ManageConnection()

and Failed to start or connect to RTM: not_allowed_token_type as a result. Seems that modern slack bots can not be connected to Slack via websocket.

renta avatar Nov 29 '21 15:11 renta

Not sure if this a related, but thought I'd link in case this is useful. #941

sheldonhull avatar Dec 19 '21 19:12 sheldonhull

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar Apr 05 '23 23:04 github-actions[bot]

This issue was closed because it has been stalled for 10 days with no activity.

github-actions[bot] avatar Apr 17 '23 00:04 github-actions[bot]