Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slack API: `groups.list` not returning private channels I am part of

Tags:

slack-api

I am trying to get a list of all channels (public and private) to which I can post messages.

I am getting a list of public channels using channels.list and it is working well. It is returning me all the public channels to which I can post.

I am trying to get a list of private channels by using groups.list. The call is returning an OK response, but I am not getting any results.

I have created a private channel. I am the only member. This channel is not being returned by the group.list API call.

I have groups:read and channels:read oauth scopes.

This is being done using the Slacker python library.

Even the following curl call does not return me any private channels:

 curl --data "token=xoxb-REDACTED"  'https://slack.com/api/groups.list'

How can I get a list of private channels I am part of using the Slack API?

UPDATE:

If I use the dev token in the above curl call, it does correctly return me my private channels.

When I look inside of Slack at the integrations, I see the integration with my dev app. It says that the dev app can Access information about user’s private channels, granted by 1 team member (among others). Something is amiss and I don't know where. It seems that the oauth token has an issue, but I don't know what.

like image 593
Krystian Cybulski Avatar asked Nov 02 '25 23:11

Krystian Cybulski


1 Answers

The problem is that I was also requesting the bot oauth scope. When Slack finished authorizing my app, it was issuing a personal token and a bot token. The bot token does not have access to the private channels, while the personal one does.

like image 179
Krystian Cybulski Avatar answered Nov 04 '25 20:11

Krystian Cybulski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!