Best way to get currently logged-in user's presence in "real time"?

Good morning & happy Friday! :smiley:

So one thing I've recently found out is, supervisors can change other users' presence or straight-up log them off. I understand the reasons, but now that has me wondering about the right way to check on that. For example, my integration has a simple dropdown menu with the list of presences, and it's set to the user's current presence on startup; but now it sounds like I will either have to use polling (which would also request the user's full profile info + expand=presence, which will probably run me into usage limits) or something in the WebRTC SDK. I've been over the SDK docs a bit but haven't found anything presence-related (there is no sdk.on("presence-change") or anything like that lol). Might not be an SDK thing at all (sorry if I posted this in the wrong category). What do you think?

@LighthouseMike You don't need to use the webrtc sdk to get the presence (we actually don't have that functionality in the sdk anyway). You can get presence in realtime though. You have to setup a notification channel which is pretty easy, then you can get presence relevant updates, event if that presence changes due to some 3rd party. Here's a link to the developer docs and an example: https://developer.genesys.cloud/useragentman/presence/user-presence-guide

@jensen.gar Thanks for the tip! I would never have guessed "notifications" (I thought that was a chat thing, which explains why I've been looking in all the wrong places lol). I don't know jQuery so some of this JS code is a bit confusing (only ever done Dojo, a bit of React, and primarily vanilla JS), but I think I get how it works.

I didn't know we could use WebSockets with this API - that's awesome! :smile: Just seeing "new WebSocket" in there tells me everything i needed to know (it totally solves the "best way to get presence in real time" question). Thank you!

1 Like

FYI, the jquery stuff there isn't really relevant. It would be totally acceptable and easy to convert the query statements to vanilla javascript/typescript. Happy coding.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.