I am a real-time dashboards developer and I am currently building a presence monitor using the Notification API. I am subscribed to the v2.users.{id}.presence topic for all our agents. However, I am seeing a high volume of redundant messages when an agent’s presence state has not actually changed. Is there a way to filter these events on the server side so my WebSocket only receives messages when there is a meaningful state transition?
Hello. I create learning materials for our team and I get this question a lot. There is no server-side filtering for the presence topic. The API sends a notification every time the user’s presence object is updated, which can happen for many reasons besides a state change. You have to implement a ‘Deduplication’ logic in your WebSocket client. You store the last known state for each user and only update your dashboard if the new message shows a different presence value. It is a bit of extra code but it is a standard requirement for WebSocket consumers.
I am a workforce planner and I use these presence updates for our long-term forecasting. If you are worried about the volume of messages, you might want to look at the ‘User Observation’ query instead of the Notification API. It is not real-time, but it is much more efficient if you only need to check the presence state every few minutes. It also avoids the complexity of managing a high-volume WebSocket connection.
This WebSocket API is so frustrating to work with. I am trying to build a chatbot that responds to agent presence and I spend more time filtering out ‘junk’ messages than I do on the actual logic. If Genesys would just add a ‘notify_on_change_only’ flag to the subscription, it would save us so much development time. I have already posted this as a feature request on the developer forum but I am not holding my breath!