I'm trying to obtain a list of private channels in Slack (on a per-user basis is fine), but I'm having trouble seeing this information. I installed my application into the workspace in Slack originally and got an OAuth token in the form xoxp-4...........
.
App OAuth token
When I try to use the slack API (node SDK) then I only get the publicly listed channels.
await new WebClient(`xoxp-4.....`)
.conversations
.list({ exclude_archived: true })
).channels
I get the same if I try using the Slack API tester to grab a channel list.
User OAuth token
I've followed the OAuth 2.0 process to obtain a token for a given user (myself). I think I've done all this correctly (here's a response):
{
ok: true,
access_token: 'xoxp-4.........',
scope: 'identify,bot,commands,channels:history,groups:history,im:history,mpim:history,channels:read,emoji:read,groups:read,im:read,search:read,team:read,users:read,users:read.email,usergroups:read,users.profile:read,chat:write:user,chat:write:bot,links:read',
user_id: 'UD......',
team_name: '............',
team_id: '.......',
scopes: ['identify',
'bot',
'commands',
'channels:history',
'groups:history',
'im:history',
'mpim:history',
'channels:read',
'emoji:read',
'groups:read',
'im:read',
'search:read',
'team:read',
'users:read',
'users:read.email',
'usergroups:read',
'users.profile:read',
'chat:write:user',
'chat:write:bot',
'links:read'
]
}
Interestingly I discovered this provides me with exactly the same OAuth token if I goto the application management (I assume because it was me who installed the app to the workspace).
Obviously, because it's the same token, I don't get permissions to see the private channels still, even though as far as I'm aware I should be able to do everything I can do as a user?
Can anyone point me to what I might be missing?