The Slack SDK version
slack-sdk==3.19.5
Python runtime version
Python 3.8.13
OS info
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) -
@classmethod
def get_channels(cls):
log = logger.bind(event="fetch_all_channels")
client = WebClient(token=os.environ.get("SLACK_BOT_TOKEN"))
try:
response = client.conversations_list(
types="public_channel,private_channel",
exclude_archives=True,
limit=250
)
except SlackApiError as e:
log.error(status="failed_to_fetch_all_channels", exception=e.response["error"])
return
Expected result:
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.
The Slack SDK version
slack-sdk==3.19.5Python runtime version
Python 3.8.13OS info
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.customizeI use the following code to list public channels and private channels (that the bot has been added to) -
Expected result:
I expect all public channels and private channels to show up, with the expected total channel count to be
243in my casepublic - 242andprivate - 1(since the bot has been added only to one private channel)Actual result:
When I use just the
public_channelvalue fortypesit works just fine. Returning242channels. Similarly, when I useprivate_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
242channels 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.