Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: MindsDB channel list does not display all channels using slack bot token #9145

Open
chandrevdw31 opened this issue Apr 29, 2024 · 0 comments
Labels
bug Something isn't working community All issues reported by the community

Comments

@chandrevdw31
Copy link
Collaborator

chandrevdw31 commented Apr 29, 2024

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

@chandrevdw31 chandrevdw31 added bug Something isn't working community All issues reported by the community labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community All issues reported by the community
Projects
None yet
Development

No branches or pull requests

1 participant