Search code examples
twiliotwilio-conversations

Twilio conversations get online users


I am using twilio conversations for chat. I did not find any information on this in the documentation.

My questions are:

  1. Can I get information about whether the users of the conversation are offline or online? If yes, then how to.
  2. Should I manually send the user online status in order for it to be available for other members of the conversation?

This https://stackoverflow.com/a/69429640/19023823 answer did not help me as it shows how to get the online status of the current users. I need to get the online status of the other members of the conversation.

Thanks.


Solution

  • PM for Conversations here. You need to enable reachability on the Service first, then online status will be automatically tracked for SDK users. This info is retrievable via REST API and also exists on a User object via the SDK (and is evented when the status changes).

    Once you turn this on, it will be automatically updated for all users of the SDK. You can look at the Participants in a Conversation with await Conversation.getParticipants() and then check their User object's online status with Participant.getUser().isOnline. Alternatively, you can get timely updates about changes to any user's online status by listening for userUpdated events on the client object.