Search code examples
slackslack-api

Slack conversations.list method does not list all the channels


I have a slack application and I have authenticated using this application. When I list all the channels, some of the private channels are not listed. Do we need the access token of workspace admin to list all the private and public channels?


Solution

  • Here is how Slack's security architecture works, which explains why you don't get all private channels with conversations.list.

    A user only can only see private channel he is a member of. That includes users with admins and owner role, so even the creator of a workspace does not see private channels he is not invited to.

    There are two types of tokens:

    • User token inherit the access rights from the user who installs the Slack app. So if you installed a Slack app it can only see the private channels that you are a member of.
    • Its a bit different with bot token. With a bot token the app can only see private channel the bot user is a member of.

    There are two workarounds to get access to all channels:

    Generic user

    Ensure a the generic user (e.g. slackadmin) is a member of all private channels. Then using his access token a Slack app also has access to all those private channels. This is an organizational solution.

    Collect all user tokens

    Collect the tokens of all users on your workspace and then use those tokens to access all conversations incl. private channels their are a member of. This can be achieved by asking every user to install your Slack app once (via standard OAuth "Add to Slack" process), which is called a configuration in Slack terms.