Comment on page
Subscriptions
The subscription object contains information about the room and the user in relation to it.
This is stored in the
rocketchat_subscription
collection on MongoDB.interface ISubscription {
u: Pick<IUser, '_id' | 'username' | 'name'>;
v?: Pick<IUser, '_id' | 'username' | 'name'>;
rid: RoomID;
open: boolean;
ts: Date;
name: string;
alert?: boolean;
unread: number;
t: RoomType;
ls: Date;
f?: boolean;
lr: Date;
hideUnreadStatus?: true;
hideMentionStatus?: true;
teamMain?: boolean;
teamId?: string;
userMentions: number;
groupMentions: number;
broadcast?: true;
tunread?: Array<string>;
tunreadGroup?: Array<string>;
tunreadUser?: Array<string>;
prid?: RoomID;
roles?: IRole['_id'][];
onHold?: boolean;
encrypted?: boolean;
E2EKey?: string;
E2ESuggestedKey?: string;
unreadAlert?: 'default' | 'all' | 'mentions' | 'nothing';
fname?: string;
code?: unknown;
archived?: boolean;
audioNotificationValue?: string;
desktopNotifications?: 'all' | 'mentions' | 'nothing';
mobilePushNotifications?: 'all' | 'mentions' | 'nothing';
emailNotifications?: 'all' | 'mentions' | 'nothing';
userHighlights?: string[];
blocked?: unknown;
blocker?: unknown;
autoTranslate?: boolean;
autoTranslateLanguage?: string;
disableNotifications?: boolean;
muteGroupMentions?: boolean;
ignored?: IUser['_id'][];
department?: unknown;
desktopPrefOrigin?: 'subscription' | 'user';
mobilePrefOrigin?: 'subscription' | 'user';
emailPrefOrigin?: 'subscription' | 'user';
/* @deprecated */
customFields?: Record<string, any>;
}
You can check the
ISubscription
interface here.{
"_id": "GuZJ5YcMHe4iRDbMm",
"open": true,
"alert": true,
"unread": 1,
"userMentions": 1,
"groupMentions": 0,
"ts": {
"$date": "2023-02-06T14:17:44.985Z"
},
"rid": "GENERAL",
"name": "general",
"t": "c",
"u": {
"_id": "6LMJ5Lu5YsBaqsJvE",
"username": "user1"
},
"_updatedAt": {
"$date": "2023-02-06T14:17:44.985Z"
}
}
_id | string | Unique identifier for the subscription |
u | object | Information about the user associated with the subscription (_id, username, name) |
v | object | Information about the visitor associated with the subscription (_id, username, name) |
rid | string | ID of the room associated with the subscription |
open | boolean | Indicates if the room is open for the user(defaults to false on direct messages). This is used by the clients to determine whether the user can see this subscription in their list since you can hide rooms from being visible without leaving them. |
ts | Date | The timestamp the room was created at, so this should equal the room's ts field |
name | string | Name of the subscription |
alert | boolean | Indicates if there is an alert for the subscription to be displayed to the user. |
unread | number | Number of unread messages in the subscription. NOTE : The unread counter value depends on your settings in the Administration > Workspace > Settings > General. |
t | string | Type of room associated with the subscription (e.g., "c" for channel, "d" for direct message. See rooms ) |
ls | Date | Timestamp of the last seen activity in the subscription |
f | boolean | Indicates if the subscription is a favorite |
lr | Date | Timestamp of the last reply in a thread |
hideUnreadStatus | boolean | Whether the subscribed room should be marked as containing unread messages in the UI or not |
hideMentionStatus | boolean | Indicates if the mention status is hidden |
teamMain | boolean | Whether this subscription points to the main room of a team or not |
teamId | string | (Optional) ID of the team associated with the subscription, if the subscription points to a team room |
userMentions | number | Number of unread mentions to the user in the room |
groupMentions | number | Number of unread mentions to a group which the user is part of (e.g @all , @here ) |
broadcast | boolean | Indicates if the subscription is a broadcast |
tunread | Array<string> | (Optional) List of ids of unread threads |
tunreadGroup | Array<string> | (Optional)List of thread ids that contain an unread mention to a group that the user is part of |
tunreadUser | Array<string> | (Optional) List of thread ids that contain an unread mention to the user |
prid | string | Parent room id. This will only be available if this is a subscription to a discussion |
roles | Array<string> | Array of role IDs associated with the subscription |
onHold | boolean | Omnichannel) Whether or not this room has been put on hold |
encrypted | boolean | Indicates if the subscription is encrypted |
E2EKey | string | Encryption key for the subscription |
E2ESuggestedKey | string | Suggested encryption key for the subscription |
unreadAlert | string | Type of alert for unread messages in the subscription ('default', 'all', 'mentions', 'nothing') |
fname | string | Friendly name of the subscription |
code | unknown | Unknown data type |
archived | boolean | Indicates if the subscription is archived |
audioNotificationValue | string | Value for audio notifications |
desktopNotifications | string ('all', 'mentions', 'nothing') | Desktop notification preferences for the subscription |
mobilePushNotifications | string ('all', 'mentions', 'nothing') | Mobile push notification preferences for the subscription |
emailNotifications | string ('all', 'mentions', 'nothing') | Email notification preferences for the subscription |
userHighlights | Array<string> | Array of user IDs to highlight in the subscription |
blocked | unknown | Unknown data type |
blocker | unknown | Unknown data type |
autoTranslate | boolean | Indicates if auto-translation is enabled for the subscription |
autoTranslateLanguage | string | Language code for auto-translation in the subscription |
disableNotifications | boolean | Indicates if notifications are disabled for the subscription |
muteGroupMentions | boolean | Indicates if group mentions are muted for the subscription |
ignored | Array<string> | Array of user IDs to ignore in the subscription |
department | unknown | Unknown data type |
desktopPrefOrigin | string ('subscription', 'user') | Origin of the desktop preference (subscription or user) |
mobilePrefOrigin | string ('subscription', 'user') | Origin of the mobile preference (subscription or user) |
emailPrefOrigin | string ('subscription', 'user') | Origin of the email preference (subscription or user) |
customFields | Record<string, any> | Custom fields associated with the subscription |
Notes about customFields:
- customFields inherits from room's customFields for channels (Room Type: c = chanel) and groups (Room Type: p = group) and changes with room's customFields
- customFields inherits from user's customFields for Direct Messages (Room Type: d = direct) and changes with user's customFields. Note that users of Direct Messages room will have own customFields.
Last modified 5mo ago