Search code examples
javascriptslackslack-api

Is it possible to get user granted features in Slack Web API?


I'm using slack web api in my application. One of the features that users can do is to create channels directly from the app. I want to show something for the users, who are not granted to create channels in Slack. But I don't understand how can I get this slack permissions from API.


Solution

  • Allow me clarify two concepts within Slack:

    1. In addition to required the correct Oauth scopes (e.g. channels:write for channels.create) the permission to create a channel is an admin setting of the workspace.

    2. The rights of your app are determined both by its scopes AND by the rights of the user that installed your app. But NOT the user that uses your app, e.g. via a slash command.

    So you can request the correct scopes with your app but your installing user might not have the right to create channel. Unfortunately there is no API method that will tell you if the user has the right to create channels on a particular workspace.

    But at least you can show the user an appropriate error message. channels.create will return the error restricted_action in case the user is missing the rights.