-
Notifications
You must be signed in to change notification settings - Fork 2
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
Automatically request to join channels #14
Comments
#17 looks like it should work, and indeed I can see from our logs that the bot is attempting to join specific channels:
As it happens, we're running our version of this with a bot token, which doesn't actually have permissions to join channels. https://api.slack.com/methods/channels.join is the API method needed, listed as restricted to And bot users do not have this permission: So we may need to look into how we have this deployed in our Slack workspace (and add something to README.md) |
Interesting issue. In my testing, I was indeed using a 'normal' account, which explains why it worked on my end. So, hypothetically, only the JoinChannel method needs to be replaced? Out of curiosity: could someone manually invite the bots once, and the bots can rejoin in the future, or does that not work? |
Given that the join channel method isn't available to bots – makes sense for security I guess, seeing as it could join public channels without an invitation and read messages – I'm not sure if there is another way to fudge it to work :( |
You can post to any public channel through the REST API, so I'm wondering if we could change it to something like... Iterate through all channels. |
The welcomebot bot user should be able to automatically join (public) channels when it starts up.
Unfortunately, if Welcomebot is run with a Bot user token, it will not have permission to invite itself to a channel.
You can post to any public channel through the REST API, so instead we could do something like...
Original description:
The welcomebot bot user should be able to automatically join (public) channels when it starts up.
This way, you only need to edit the config, and if you forget to invite the bot to the channel it won't matter.
The simplest method of doing this could be, when starting up, iterate through all channels in the config and attempt to join them, handling errors without killing the entire app.
https://api.slack.com/methods/channels.join implies that no error will be thrown if the user is already in the channel.
The slack library we're using has the following we can use:
This probably won't work for private channels, so handle those errors gracefully.
The text was updated successfully, but these errors were encountered: