使用 RTM 时如何禁用 "desktop_notification" 消息
How to disable "desktop_notification" messages when using RTM
在连接 RTM 的情况下,当我尝试使用我的帐户与我通过 DM 创建的机器人交谈时,每次我收到 3 条消息:
"user_typing"、"message"、"desktop_notification"
我可以通过对我的机器人应用一些设置来抑制 "desktop_notification" 吗?
对我来说,似乎 "message" 很不错。
Slack Real Time Messaging (RTM) API确实有订阅特定事件的概念,所以你的问题的答案是否定的。
正如 Erik 在他的评论中所建议的那样,您最好在脚本中忽略这些事件——最好在您的逻辑中越早越好。
另一件需要注意的事情是 Event API you can subscribe to specific events. There are pros and cons to both the Event/Web APIs 和 RTM APIs 所以我提到这个是出于完整性。事件 API 不是 RTM API 的 1:1 补充,根据我对您的用例的了解(例如,您需要使用 Web API 用于发送消息和 Event API 用于接收事件——与现在的 RTM API 相反。
在连接 RTM 的情况下,当我尝试使用我的帐户与我通过 DM 创建的机器人交谈时,每次我收到 3 条消息:
"user_typing"、"message"、"desktop_notification"
我可以通过对我的机器人应用一些设置来抑制 "desktop_notification" 吗?
对我来说,似乎 "message" 很不错。
Slack Real Time Messaging (RTM) API确实有订阅特定事件的概念,所以你的问题的答案是否定的。
正如 Erik 在他的评论中所建议的那样,您最好在脚本中忽略这些事件——最好在您的逻辑中越早越好。
另一件需要注意的事情是 Event API you can subscribe to specific events. There are pros and cons to both the Event/Web APIs 和 RTM APIs 所以我提到这个是出于完整性。事件 API 不是 RTM API 的 1:1 补充,根据我对您的用例的了解(例如,您需要使用 Web API 用于发送消息和 Event API 用于接收事件——与现在的 RTM API 相反。