Search code examples
slackslack-api

How to list all user workspaces using slack api?


After we get the user access token using Sign in with slack, we can query identity information as shown below:

{
  ok: true,
  user: {
    name: 'arbxxxxxxx',
    id: 'U0XXXXXXX',
    email: '[email protected]'
  },
  team: { id: 'T0XXXXXXX' },
  response_metadata: {
    scopes: [ 'identity.basic', 'identity.email', 'openid' ],
    acceptedScopes: [ 'identity.basic' ]
  }
}

The current workspace is team: { id: 'T0XXXXXXX' }.

How can I get all the other workspaces?

FYI: Sign in and acces token usage is shown in at this gist: https://gist.github.com/seratch/92bf98679d7a37a87dfa7376d02a51a1


Solution

  • With the exception of Org Apps installed on a Grid, users actually auth per workspace, and each is a unique identity, there's no real concept of a single identity that spans across workspaces