[SOLVED] API method to get unseen posts count

Hello,
I am messing with the HTTP API and I’m stuck with my problem:
I would like to obtain the number of unseen posts, if possible by team and by channel.
I saw that there exists a method to get posts after a given timestamp, so if it’s the only solution I need to get last user activity timestamp, or something like that.

Thank you.

Hi @raspbeguy,

If you GET the /api/v3/teams/TEAM_ID/channels/members route or use the getMyChannelMembers of our Javascript/Go clients, you’ll get back an array of ChannelMember objects for all of your channels on the given team. If you call it with an empty TEAM_ID, you’ll get ChannelMembers for all of your DM channels.

Each ChannelMember contains a msg_count field (the number of unread posts) and a mention_count field (the number displayed in a circle next to the channel name in Mattermost). They also have a last_viewed_at time as well if you still need it.

Ok, thank you, I think I can work with that.

@hmhealey, I think mention_count is counting only the numbers of message mentioning the user, not the total unread posts, and msg_count represents the total number of messages.
I think it would be handy to have a unread posts counter.
I just made a feature request.

@raspbeguy, Thanks for creating a feature request! I’ll solve this issue for now.