如何使用 Slack API 发起直接消息(私人 IM)
How to initiate a Direct Message (Private IM) using the Slack API
使用 Slack API(webhooks、RTM、Web,无关紧要)是否可以在私人 IM 频道尚不存在的情况下与用户启动 DM/Private 频道?
我知道 API 调用 https://api.slack.com/methods/im.list
它将向我显示已经打开的私人 IM 频道,但是对于机器人来说这是一个空列表,因为没有真正的用户拥有 DM是机器人。
基本上,我们有一个用户列表,需要通过机器人私下通知某些用户,而这些用户之前不太可能私信过机器人,因此私人频道尚不存在。我们如何使用 API?
创建该频道
好吧,傻瓜,我只是需要RTFM。
https://api.slack.com/methods/im.open
This method opens a direct message channel with another member of your Slack team.
Arguments
This method has the URL https://slack.com/api/im.open and follows the Slack Web API calling conventions.
使用 Slack API(webhooks、RTM、Web,无关紧要)是否可以在私人 IM 频道尚不存在的情况下与用户启动 DM/Private 频道?
我知道 API 调用 https://api.slack.com/methods/im.list
它将向我显示已经打开的私人 IM 频道,但是对于机器人来说这是一个空列表,因为没有真正的用户拥有 DM是机器人。
基本上,我们有一个用户列表,需要通过机器人私下通知某些用户,而这些用户之前不太可能私信过机器人,因此私人频道尚不存在。我们如何使用 API?
创建该频道好吧,傻瓜,我只是需要RTFM。
https://api.slack.com/methods/im.open
This method opens a direct message channel with another member of your Slack team.
Arguments
This method has the URL https://slack.com/api/im.open and follows the Slack Web API calling conventions.