You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Private channels not being listed in conversations_list client API call #1312
Dell Inc. Latitude 5530 - Ubuntu 22.04 - 12th Gen Intel® Core™ i7-1255U × 12
Steps to reproduce:
Initialise Slack web client with the relevant bot token - bot token has access to the following scopes - channels:join,channels:read,channels:manage,groups:read,chat:write,chat:write.public,chat:write.customize
I use the following code to list public channels and private channels (that the bot has been added to) -
I expect all public channels and private channels to show up, with the expected total channel count to be 243 in my case public - 242 and private - 1 (since the bot has been added only to one private channel)
Actual result:
When I use just the public_channel value for types it works just fine. Returning 242 channels. Similarly, when I use private_channel , it works fine, returning 1 channel.
The problem is when I use both together, to list all channels. I've tried the following variations -
types="public_channel,private_channel"
types=["public_channel,private_channel"
In both cases, the API returns only the public channels, and I get a total of 242 channels only. The private channels that my bot is a part of are not returned in this case.
Looking for any pointers on where I might be going wrong, be it with my scopes or the API call.
changed the title [-](Set a clear title describing the issue)[/-][+]Private channels not being listed in conversations_list client API call[/+]on Dec 9, 2022
Other private channels should be in the next page of the responses (we do understand returning less than 250 channels is a confusing behavior, but the API behaves in the way by design). To learn how to call pagination call using this SDK, please refer to #1159 (comment) for more details.
Indeed, it seems to be a pagination issue, and on calling the next_cursor variable, it seemed to give me the remaining channels, which included the private one.
However, this seems inconsistent since I explicitly specified the limit parameter.
To give you more context - I'm trying to build a simple search utility, where the bot can list all public channels and private channels it is a part of and allow the user to select the appropriate channel to set up a recurring notification.
The admin.conversations:search scope is for enterprise customers only, hence I had to build a workaround by fetching the channels and manually searching.
How do you propose I achieve this without having to repeatedly hit the conversations.list API until there is no more next_cursor? Or to be more specific, is there any consistency I can guarantee, where it will definitely stop at the next page (2nd page in this case, cuz a total of 243 channels were split over 2 pages with the 2nd page holding just 1).
@saurabh0719 Unfortunately, there is no work around for this as it's due to Slack API server-side behavior. The server-side fetches 250 first and then filters the item with the given filter conditions. Thus, limit=250 means that the endpoint may return 250 at maximum. We know that this is not a common behavior at all, and it can be a surprising behavior (even for me!). We've escalated this issue many times already. However, still there is no plans to change it.
If you don't have further to clarify on this topic, would you mind closing this now? It'd be appreciated if you could understand this.
Thanks @seratch - seems like the only solution for my problem is for the end-user to actually copy the channel_id itself from Slack as there is no feasible/stable way to search for a channel unless you're an enterprise customer.
Is there any community/mailing list I can follow to get updates as soon as this (Slack's API) is fixed or enhanced? Feel free to close this issue after you've replied to this. Thank you
Activity
[-](Set a clear title describing the issue)[/-][+]Private channels not being listed in conversations_list client API call[/+]seratch commentedon Dec 9, 2022
Hi @saurabh0719, thanks for asking the question!
Other private channels should be in the next page of the responses (we do understand returning less than 250 channels is a confusing behavior, but the API behaves in the way by design). To learn how to call pagination call using this SDK, please refer to #1159 (comment) for more details.
I hope this helps.
saurabh0719 commentedon Dec 9, 2022
@seratch thanks for such a quick response!
Indeed, it seems to be a pagination issue, and on calling the
next_cursorvariable, it seemed to give me the remaining channels, which included the private one.However, this seems inconsistent since I explicitly specified the
limitparameter.To give you more context - I'm trying to build a simple search utility, where the bot can list all public channels and private channels it is a part of and allow the user to select the appropriate channel to set up a recurring notification.
The
admin.conversations:searchscope is for enterprise customers only, hence I had to build a workaround by fetching the channels and manually searching.How do you propose I achieve this without having to repeatedly hit the conversations.list API until there is no more
next_cursor? Or to be more specific, is there any consistency I can guarantee, where it will definitely stop at the next page (2nd page in this case, cuz a total of 243 channels were split over 2 pages with the 2nd page holding just 1).seratch commentedon Dec 9, 2022
@saurabh0719 Unfortunately, there is no work around for this as it's due to Slack API server-side behavior. The server-side fetches 250 first and then filters the item with the given filter conditions. Thus, limit=250 means that the endpoint may return 250 at maximum. We know that this is not a common behavior at all, and it can be a surprising behavior (even for me!). We've escalated this issue many times already. However, still there is no plans to change it.
If you don't have further to clarify on this topic, would you mind closing this now? It'd be appreciated if you could understand this.
saurabh0719 commentedon Dec 9, 2022
Thanks @seratch - seems like the only solution for my problem is for the end-user to actually copy the
channel_iditself from Slack as there is no feasible/stable way to search for a channel unless you're anenterprisecustomer.Is there any community/mailing list I can follow to get updates as soon as this (Slack's API) is fixed or enhanced? Feel free to close this issue after you've replied to this. Thank you
seratch commentedon Dec 9, 2022
You can subscribe Slack Platform's changelog RSS feed for it: https://api.slack.com/changelog.rss
Thanks again for taking the time to write in here!