Getting Total unread messages count in Twilio Conversations

248 Views Asked by At

we're using Twilio Conversations to power 1-to-1 chat for a webapp. I see that the unreadMessagesCount implemented via Read Horizon can indicate the number of unread messages in a particular conversation for a participant.

My question: Is there a way to get the total unread messages for ALL of a user's ongoing conversations? E.g., if a user has 3 ongoing conversations that each have 5 unread messages, I would like to provide the user with an badge showing they have 15 unread messages (i.e., the customary user experience using messaging apps).

Would we have to loop through all the conversations that a user is a participant of and call unreadMessagesCount for each? If so, have some concern if that would bog down performance too much as some users could be a participant to a large number of conversations.

If total count of unread messages in all conversations is not able to be implemented efficiently, would also be fine if could just identify the total number of 1-on-1 conversations that have 1+ unread messages. But have not found a way to do this either.

Appreciate any thoughts on the best way to implement this.

0

There are 0 best solutions below