Forum Academy Marketplace Showcase Pricing Features

Track when users have a message thread open

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?


Hey @johndurso :wave:

Thanks for the post! And, great question. There are a few ways you could go about this, but here’s how I’d probably tackle it. You’ll want to have some way of tracking who’s viewed a message or not. Assuming you have that or plan to implement it, I would use a backend workflow for your notifications so you can schedule them to happen at some date in the future. (I’m making an assumption here that you aren’t going to immediately show the notification and instead, might show it after 24 hours or something)

Going this route, you can schedule the backend workflow on a list (with the list being the list of users receiving the message) and set your scheduled date for whatever delay you’d prefer. Inside that workflow, you’ll have an action that creates the notification (however you’re handling notifications in your app) and that action could have an only when statement on it that only actually creates / sends the notification IF the user in question hasn’t seen the message yet. That way, the system is acting on the list of users immediately, but they technically have up until whenver the workflow is running to view the message and not receive the notification.

Give it a try and don’t hesitate to reach out with any additional questions to [email protected]

Thanks for the response @AndrewV . Unfortunately that won’t work for my use case, since the the app will be used to communicate about projects on somewhat short timeframes, and users need to receive notifications at the time a message is sent (or close to it).

I haven’t figured this out yet; if you have any other suggestions they are welcome!

Hey @johndurso

Understood! One of the benefits of the ‘schedule a backend workflow’ action is that you can schedule it for current date and time (to have it fire immediately) OR schedule it for later to give a delay. In your case, it sounds like you’d want to fire it immediately.

NOT notifying users who are actively looking at the conversation could get a little trickier. I haven’t built this sort of functionality before, but you might send the notifications regarless and have some sort of workflow ON the chat page that automatically marks a notification as read or deletes it upon arrival IF the user is actively looking at the conversation in question. You might do this with a ‘do when condition is true’ workflow that looks for the count of notifications to be greater than 1 for it to fire.

Hopefully this helps get you pointed in the right direction! You might also consider checking out our coaching marketplace where you can hire Bubble experts on an hourly basis for help with solving problems like these.

And, you’re always welcome to email us directly at [email protected]

This topic was automatically closed after 70 days. New replies are no longer allowed.