API To Retrieve Unread Count For More Then One Room At A Time


I’ve seen this feature, or similar, requested in a lot of places, but for some reason they keep getting closed and pointed elsewhere stating that it is achievable via various methods. After some thorough investigation it seems that there is no easy way to do this without creating multiple requests.

Scenario: I want to show a list of all the DMs for a given user and have a notification icon if the DM has unread messages.

For now I need to call:
/dm.list : once
/dm.counters : for each DM returned, so if a user has 10 DMs open, thats 10 additional API requests that need to be handled. I’m sure you can see how this can get out of hand very quickly.

I tried using the lastMessage feature in /dm.list , but there is no way to indicate if the message is unread or not.

I’m not sure what the solution is, but possibly one of the following.

  • In the API Request /dm.list and an unread counter for each dm returned (Optimal)
  • In the API Request /dm.counters , allow us to retrieve counters via array of roomIds , and not just one (Most Viable)
  • In the API Request /dm.list with adding lastMessage , indicate weather the message is unread or not. (Will get the job done)

Maybe I’m doing it wrong, but if this is in fact unachievable right now, I believe it to be a vital part of the REST API