I’m building a messaging feature in my app where Users see a list of Conversations, click to open a Conversation, then send Messages in that Conversation. There may be multiple Users in a Conversation.
I want to create a notification when the Current User has not seen the latest message(s) in bold in a Conversation. It’s easy enough to create notifications for other Users when a message is sent; however, other Users may have the Conversation open themselves, in which case I would not want to create a notification for them because they will have seen the message.
How would one go about detecting what other Users are viewing the Conversation, so that I only create notifications for those who aren’t reading the messages as they are sent?
One approach I’m trying is to have a “Viewed by” User list on the Conversation which gets cleared every time a new Message is sent, and also having a workflow that adds the Current User to the Viewed by list every five seconds while they are viewing a Conversation. However, this doesn’t let me detect at the time I need to send a notification, so it’s not really a solution.
I think this might be resource intensive so wanted to ask, anyone else have a better solution or suggestion?