Retrieve newly joined channels


I cant find a way to retrieve the number of private group channels joined by the connected user since they were last online. I tried to look for a user.invitedOn or something similar with no success.

The only solution I can think of is to :

  • one channel at the time, retrieve all the messages
  • if at least one message is from connected user => not a new channel
  • if all messages are from other users and unread count is 0 => not a new channel
  • if all messages are from other users and unread count > 0 => new channel

However, this is a double loop that would like to avoid.

Is there a simpler way to do this with Sendbird?


There is no user.invitedOn or similar values on the group channel. What you could do is store the timestamp of when a user joined/was invited as a Metadata Key/value. Then when you query via:


as described here. You could just compare timestamps locally and display that way.

Thanks @Alex_Preston. Looking at the metadata docs and it says that only 5 key/value pairs are allowed and 128 chars per value…I could make your solution work for small channels but any idea for channels with 10+ members? Or users who have joined more that 10 channels?

You can also use some private hidden channel for storing some information… Each message is a record in the database. Maybe that helps.

Hey @SafiyyaBabio,

Another idea a teammate had, was if instead of storing the timestamp on the channel, what if you did it on the user object? You can store the timestamp of when a user x joined channel y in user Metadata. Then you can use that metadata to query the list of channels. Does that make sense?