Determine Number of Unread Messages

Hello.
I’m working with the Client4 and websocket portions of the mattermost-redux package to implement a custom client in React, and I’m trying to determine the correct “recipe” to find and maintain the number of unread messages in a given channel.

I’ve come across the Client4 getPostsSince method that lets me get the posts in a given channel since a given post ID. This seems like it might be a way to get the number of unread posts as longs as the last time the user viewed a specific channel is known. Is the information on when the user last viewed a channel available via the API?

Alternatively, is there a more effective way of determining and maintaining the number of unread messages per channel? Is there a “recipe” or tutorial covering this topic?

Hi Reggie, there’s a lot of guides on this over the web. Am not sure posting an external link is allowed or not. If yes kindly confirm me in the reply so I can give you a link to some guide to go forward with.

You’re most certainly allowed to post external links here!

1 Like

@lengtmp can you post a link to a guide on how to do this?

1 Like

Sure, check out the blog version of this, front contains the list of crap so do check out blog sections of any of these two:

  1. https://mycoles.vip/
  2. https://mythdhr.vip/

Hope this helps, thanks!

1 Like