如何获取Slack私有频道成员?API调用遇channel_not_found错误求助
channel_not_found Error) Let's break down how to fix that channel_not_found error first, then walk through the proper steps to get private channel members:
Why you're seeing channel_not_found
There are three common reasons for this error when calling conversations.members:
- Incorrect channel ID: Private channel IDs start with
C, but you can't just copy one from the browser URL if you're not a member of the channel. You'll need to fetch valid private channel IDs via the API instead. - Missing token scopes: Your API token needs specific permissions to access private channels. At minimum, you'll need
channels:read,users:read, andconversations.membersscopes. - Not a channel member: Slack blocks access to private channel data for anyone (or any bot) that isn't explicitly part of the channel. If your token's associated user/bot isn't in the private channel, you'll get this error no matter what.
Step-by-step to get private channel members
Fetch valid private channel IDs
Use theconversations.listendpoint to get all private channels your token can access. Make sure to set thetypesparameter toprivate_channel:https://slack.com/api/conversations.list?types=private_channel&token=[your-token]The response will include an array of channels, each with a valid
idfield you can use for the next step.Retrieve channel members
Plug the valid channel ID into theconversations.membersendpoint:https://slack.com/api/conversations.members?channel=[valid-private-channel-id]&token=[your-token]A successful response will give you an array of user IDs for all members in the private channel.
Get detailed user info (optional)
If you need more than just user IDs (like usernames, emails, or profile details), use theusers.infoendpoint with each user ID:https://slack.com/api/users.info?user=[user-id]&token=[your-token]
Key additional tips
- Bot tokens: If you're using a bot token, you have to manually add the bot to the private channel (a channel member needs to invite it) before it can access any data for that channel.
- Enterprise Grid: For Enterprise Grid workspaces, you might need extra scopes like
team:readif you're accessing channels across multiple connected workspaces.
内容的提问来源于stack exchange,提问作者Viktor Bogutskii

