Search code examples
slackslack-api

How to disable "desktop_notification" messages when using RTM


With RTM connected, when I try to use my account to talk to a bot created by myself with DM, each time I got 3 messages:

"user_typing", "message", "desktop_notification"

Can I suppress "desktop_notification" by applying some settings to my bot?

For me, it seems "message" is good to go.


Solution

  • The Slack Real Time Messaging (RTM) API does have the concept of subscribing to specific events, so the answer to your question is no.

    As Erik suggests in his comment, you are best off just ignoring these events in your script -- ideally as early in your logic as possible.


    One other thing to note is that with the Event API you can subscribe to specific events. There are pros and cons to both the Event/Web APIs and RTM APIs so I mention this out of completeness. The Event API is not a 1:1 supplement for the RTM API in your case from what I can tell for your use case (for example, you'd need to use the Web API for sending a message and Event API for receiving events -- as opposed to just the RTM API as you have now).