Skip to main content

Mark conversation as unread

POST 

/thread/:id/markUnread

Marks a conversation the current user has read as unread again (Better Messages 3.2). The unread_count of the user for it becomes -1: the conversation shows a dot in the conversations list and is listed by the unread filter, while no unread total counts it (get_user_unread_count(), the conversations count, the totals of the realtime server and the mobile app badge). The mark ends when the user opens the conversation (messages_mark_thread_read(), /openThreads, /markAllRead) or when a new message arrives, which counts from 0. A deleted message keeps it. Nobody is notified.

The route takes the word of the caller that the conversation was read: it writes -1 whatever count the site holds, since in the WebSocket version the count the site keeps for a conversation read through the realtime connection catches up only at the next sync. The messenger offers the action only on a conversation it shows read. On the WebSocket version the mark reaches the other devices of the user through the realtime server.

Conversation objects carry unread: -1 for a marked conversation (REST, the better_messages_rest_thread_item filter and realtime events). Fires better_messages_thread_marked_unread with the thread ID and the user ID.

Refused with 403 when Settings → Messaging → Conversation Features → Mark as Unread is off, in a presence-based chat room, and for a user who is not a participant.

Request#

Responses#

Conversation marked as unread