Slack Bot 查看所有直接消息频道

Slack Bot to see all Direct Message Channels

我正在尝试实现一个机器人,它可以获取所有直接消息频道、所有工作区用户并向他们发送直接消息。 如果我使用我的开发工作区,一切都按预期工作,但是当我尝试使用我的公司工作区时,我的机器人只能检索它所属的直接消息通道。 关于如何通过生产机器人修复的任何想法。

你不能。由于 Slack 的安全架构,一个人只能看到他所属频道的消息。即使对于 Slack 团队(主要所有者)的 "super admin" 也是如此。机器人和应用程序从安装它的用户那里继承该权利(= 授权访问令牌)。

它适用于您的开发 Slack 的原因是您的用户可能已经在 Slack 上创建了所有私人频道,and/or 与授权您的应用程序使用的访问令牌相同。

感谢 Slack 的支持,我得到了答案:

The OAuth Token issued is specific to the user who has installed your app and represents the permission(s) to perform actions on behalf of the user. More detailed information here - https://api.slack.com/docs/oauth. The token can only perform the same actions as the user who installed the app i.e If the user can’t view or post in the channel, they can’t grant permission to something they do not have.