With the Subscriptions API, you can:
Get subscription and notification details for rooms.
Mark a channel as read or unread.
The subscription object
A subscription is one user's view of one room: what the room is called for them, whether it is open, and how much of it they have read. A trimmed example from Get All Subscriptions:
{
"update": [
{
"_id": "5ALsG3QhpJfdMpyc8",
"rid": "GENERAL",
"name": "general",
"t": "c",
"u": { "_id": "EoyAmF4mxx5HxJHJB", "username": "rocket.cat" },
"open": true,
"alert": true,
"unread": 1,
"userMentions": 1,
"groupMentions": 0,
"ts": "2017-11-25T15:08:17.249Z"
}
],
"remove": [],
"success": true
}Fields you use most often:
rid: The ID of the room this subscription belongs to._ididentifies the subscription itself.unread,userMentions,groupMentions: Unread counters for this user in this room.alertandopen: Whether the room should be highlighted and whether it is shown in the user's room list.t: The room type —cchannel,pprivate group,ddirect message,llivechat.
Common workflows
Build an unread indicator
Get all subscriptions for the authenticated user. Pass
updatedSinceon later calls to fetch only what changed.Sum the
unreadand mention counters per room, or get one room's subscription by itsroomId.Mark the room as read when the user opens it, or mark it as unread so they come back to it.
Conventions
Subscriptions always belong to the authenticated user — you read and update your own read state, not other users'.
Endpoints reference rooms by
roomId(the subscription'srid).The full field list is documented in the Subscription schema definition.