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

Get Channel_id through channel_name besides using conversations.list #1093

Open
Tang20031010 opened this issue Jun 13, 2024 · 4 comments
Open
Labels
question Further information is requested

Comments

@Tang20031010
Copy link

(Describe your issue and goal here)

Reproducible in:

The slack_bolt version

slack-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.

@filmaj filmaj added the question Further information is requested label Jun 13, 2024
@filmaj
Copy link
Contributor

filmaj commented Jun 13, 2024

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.

@Tang20031010
Copy link
Author

Tang20031010 commented Jun 13, 2024

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.

@filmaj
Copy link
Contributor

filmaj commented Jun 13, 2024

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.

@Tang20031010
Copy link
Author

Tang20031010 commented Jun 13, 2024

Thank you! I probably need to go with letting the user input channel_id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants