向不在“im.list”中的用户发送 Slack DM
Slack DM to a user not in `im.list`
我正在实施一个 slack ops 机器人,它将在构建服务器上通知用户作业完成。它需要能够在工作完成时向用户发送 DM。
我已经按照说明设置了一个机器人用户 @ https://api.slack.com/bot-users. To send a DM to a particular user, chat.postMessage
takes the first argument (channel) as either a @username
or a IM channel's ID as per the documentation @ https://api.slack.com/methods/chat.postMessage#channels . To get the IM channel ID of a user, im.list
可以使用。但是 im.list
只给出了机器人之前与之交互过的用户的 IM 频道 ID(或者用户已经 ping 了机器人,或者机器人和用户是任何频道的一部分)。
因此,该机器人似乎无法与之前未与之交互过的任何用户直接私信。我对机器人行为的理解是否正确?
这个用例有任何解决方法吗?
我想你在找 im.open
。传入用户 ID,您将获得与该用户直接消息对话的频道 ID。
我正在实施一个 slack ops 机器人,它将在构建服务器上通知用户作业完成。它需要能够在工作完成时向用户发送 DM。
我已经按照说明设置了一个机器人用户 @ https://api.slack.com/bot-users. To send a DM to a particular user, chat.postMessage
takes the first argument (channel) as either a @username
or a IM channel's ID as per the documentation @ https://api.slack.com/methods/chat.postMessage#channels . To get the IM channel ID of a user, im.list
可以使用。但是 im.list
只给出了机器人之前与之交互过的用户的 IM 频道 ID(或者用户已经 ping 了机器人,或者机器人和用户是任何频道的一部分)。
因此,该机器人似乎无法与之前未与之交互过的任何用户直接私信。我对机器人行为的理解是否正确?
这个用例有任何解决方法吗?
我想你在找 im.open
。传入用户 ID,您将获得与该用户直接消息对话的频道 ID。