Open svoop opened 1 year ago
As mentioned in the document: https://slack.dev/node-slack-sdk/rtm-api
Note: RTM isn’t available for modern scoped apps anymore. We recommend using the Events API and Web API instead. If you need to use RTM (possibly due to corporate firewall limitations), you can do so by creating a legacy scoped app. If you have an existing RTM app, do not update its scopes as it will be updated to a modern scoped app and stop working with RTM.
You need to create a classic Slack app for using RTM API. You can create a classic app from the following URL: https://api.slack.com/apps?new_classic_app=1
We possibly need to update the documentation, or maybe add a comment to the samples? Care to help?
@dblock Thanks for your quick reply. Sure thing, I'll help with these docs to make things easier for people like myself. However, I have to understand it myself first. The RTM API note is present in the auth basiscs docs as well, but a little hidden under "Scopes".
Here's how I got posting as the app to work:
slack-ruby-client
.(I still have to figure out why "on message" doesn't work yet, but that's probably an issue on my end.)
It's a little worrying though having to deal with "classic apps" and "legacy bot users", sounds somewhat like these will go away at some point.
If I understand correctly, the RTM API is superseded by the Events API which sends events as callbacks to wherever you subscribe them. Is it planned or even feasible to add support for the Events API to slack-ruby-client
?
Yes, the client fully supports events. But since events just require a web server, it's a bit different. Start with https://github.com/slack-ruby/slack-ruby-bot-server-events. I've been migrating existing apps, and wrote up https://code.dblock.org/2020/11/30/migrating-classic-slack-ruby-bots-to-granular-permissions.html.
@dblock I'll try to get the RTM approach working for now, then migrate later when I have a little more time. This should produce some HOWTO material which might be useful to others. Might take a moment though. Thanks for the hints!
Quite possibly, I'm doing something wrong, but after countless tries, I can't pinpoint where the real time example falls short.
To reproduce, create the app and bot OAuth token:
chat:write
andchannels:read
xoxb-...
Now open IRB and follow the hi example:
The last line raises:
Any idea where the example (or my interpretation thereof) is wrong?