有没有人知道如何通过 Slack RTM 向用户发送私有(private)消息?我正在尝试创建游戏,并想在 Slack 中私信一位用户以提供更新等。
你可以通过 https://github.com/robksawyer/hubot-poker 中 src/poker.coffee 中的 coffee 脚本看到我走了多远。 .
随意 fork 和完成。 ;)
请让我知道我是否偏离了轨道,如果这根本不可能。
最佳答案
来自文档
You can send a message to a private group or direct message channel in the same way, but using a Group ID (C024BE91L) or DM channel ID (D024BE91L).
所以你只需要指定收件人 @username
或 DM D1234BLah
的 id 作为 channel
的值发送消息到RTM API 例如
{
"id": 1,
"type": "message",
"channel": "@jeff",
"text": "hello jeff"
}
完整的 RTM 文档在这里:https://api.slack.com/rtm
关于node.js - 通过 RTM 私信 Slack 用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27476313/