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
User is trying to view channels using a slack bot token but realised not all the channels are visible in the mindsdb channel_lists.
He tracked it down to the call in slack_handler.py client.conversations_list(types="public_channel,private_channel") # gives 40 channels client.conversations_list(types="public_channel") # gives 48 channels
He tracked it down to the pagination mechanism from the Slack API. Essentially if the channel list is too long, it will trigger a pagination mechanism, which mindsdb should handle in order to return a complete channel list. see slackapi/python-slack-sdk#1074 (comment)
He used the below to test
try: # Call the conversations.list method using the WebClient result = client.conversations_list(types="public_channel,private_channel") # check for pagination cursor if result['response_metadata']['next_cursor']: print("More channels available") # this happens when querying for both public and private channels because there are more than 50 of them else: print("No more channels available") channels = result["channels"] while result['response_metadata']['next_cursor']: result = client.conversations_list(cursor=result['response_metadata']['next_cursor']) channels.extend(result["channels"]) # print channel name and ID for channel in channels: print(channel['name'], channel['id']) except SlackApiError as e: print(f"Error fetching conversations: {e}")
Short description of current behavior
User is trying to view channels using a slack bot token but realised not all the channels are visible in the mindsdb channel_lists.
He tracked it down to the call in
slack_handler.py
client.conversations_list(types="public_channel,private_channel") # gives 40 channels client.conversations_list(types="public_channel") # gives 48 channels
He tracked it down to the pagination mechanism from the Slack API. Essentially if the channel list is too long, it will trigger a pagination mechanism, which mindsdb should handle in order to return a complete channel list. see slackapi/python-slack-sdk#1074 (comment)
He used the below to test
try:
# Call the conversations.list method using the WebClient result = client.conversations_list(types="public_channel,private_channel") # check for pagination cursor if result['response_metadata']['next_cursor']: print("More channels available") # this happens when querying for both public and private channels because there are more than 50 of them else: print("No more channels available") channels = result["channels"] while result['response_metadata']['next_cursor']: result = client.conversations_list(cursor=result['response_metadata']['next_cursor']) channels.extend(result["channels"]) # print channel name and ID for channel in channels: print(channel['name'], channel['id']) except SlackApiError as e: print(f"Error fetching conversations: {e}")
Slac thread: https://mindsdbcommunity.slack.com/archives/C01S2T35H18/p1713972670744039
The text was updated successfully, but these errors were encountered: