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
I am trying to get channel id by channel name. I would like to let the user input a channel's name and use that to get the channel's id since I need the channel id to do conversations.join. I have found one thread in slackapi/bolt-js#1725 and tried the suggestion by using conversations.list to filter and then use the conversations.info. However, there are too many channels in the organization. I have tried pagination but still failed to retrieve all channels through conversations.list. I think there are more than 50000 channels and the return from conversations.list is not stable. Since that post is in 2023, I am wondering if we have additional solutions to this situation. The worst case I am thinking is letting user input the channel id.
I would like to let the user input a channel's name and use that to get the channel's id since I need the channel id to do conversations.join.
Could you use the Block Kit Conversation Select Menu? It will render a drop down menu of conversations (channels, public or private, even DMs and MPDMs) that is contextual to the user (meaning: the user has access to them). Then, you can listen to block_actions payloads on this element to get channel / conversation ID.
Thank you for your quick response! I looked into it; however, this does not seem quite fit to my situation as what I want is to let the user only interact with the UI I implemented instead of going to slack to do the operation.
I see. Yes, it's a common request and unfortunately we have no good answer. If you have access to an admin token, you could use the admin.conversations.search API as it accepts a query parameter for the channel name. The other is to paginate through conversations.list, as you pointed out.
(Describe your issue and goal here)
Reproducible in:
The
slack_bolt
versionslack-bolt==1.18.1
slack_sdk==3.27.2
Python runtime version
Python 3.12.3
OS info
ProductName: macOS
ProductVersion: 14.4.1
Steps to reproduce:
I am trying to get channel id by channel name. I would like to let the user input a channel's name and use that to get the channel's id since I need the channel id to do conversations.join. I have found one thread in slackapi/bolt-js#1725 and tried the suggestion by using conversations.list to filter and then use the conversations.info. However, there are too many channels in the organization. I have tried pagination but still failed to retrieve all channels through conversations.list. I think there are more than 50000 channels and the return from conversations.list is not stable. Since that post is in 2023, I am wondering if we have additional solutions to this situation. The worst case I am thinking is letting user input the channel id.
Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
The text was updated successfully, but these errors were encountered: