# Checking for New Chat Messages via API

**URL:** <https://meta.discourse.org/t/checking-for-new-chat-messages-via-api/309749>\
**Category:** Development\
**Tags:** chat, rest-api\
**Created:** [May 28, 2024, 7:55pm UTC](https://meta.discourse.org/t/checking-for-new-chat-messages-via-api/309749 "2024-05-28T19:55:10Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Earnie\_Baird](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/earnie_baird/32/380079_2.png) [@Earnie\_Baird](https://meta.discourse.org/u/Earnie_Baird)\
**Post date:** [May 28, 2024, 8:16pm UTC](https://meta.discourse.org/t/checking-for-new-chat-messages-via-api/309749/4 "2024-05-28T20:16:12Z")

</div>

thanks @j.jaffeux. I’m taking a look at _/chat/api/me/channels_ and do see under tracking that I can go through all the channels and see if the unread\_count for any of the channels \> 0 which is helpful.

But this doesnt seem to have anything to do with a user’s chat\_header\_indicator\_preference and also doesnt tell me if there have been any DMs or mentions for the user.

In theory I can try to recreate the logic of chat\_header\_indicator\_preference by first checking if the user has that set to “all\_new” and if so, check to see if any unread\_counts for their channels are \> 0 and if those are all 0 then check for unread DMs/mentions.

But I’m hoping there might be a better way to do it… (and I’m also not sure how to get that second piece for unread DMs/mentions).

Any help / guidance would be very much appreciated.

---

_[View the full topic](https://meta.discourse.org/t/checking-for-new-chat-messages-via-api/309749)._
