Unread Message Count
Get Total Unread Count
Get the total unread count for all conversation types (excluding chatrooms).
Method
getTotalUnreadCount(
channelId: string,
callback: IRCIMIWGetTotalUnreadCountCallback
): Promise<number>;
Parameter Description
Parameter Name | Parameter Type | Description |
---|---|---|
channelId | string | The channel ID, only supported for ultra groups. For other conversation types, pass null. |
callback | IRCIMIWGetTotalUnreadCountCallback | Callback for the interface call result. |
Return Value
Return Value | Description |
---|---|
number | The status code of the current interface operation. 0 indicates success. For specific results, implement the interface callback. Non-zero indicates failure, and the callback won't be triggered. Refer to the error code for details. |
Code Example
const callback = {
onSuccess: (t: number) => {
//...
},
onError: (code: number) => {
//...
},
};
let code = await engine.getTotalUnreadCount(channelId, callback);
Get Unread Count for a Specific Conversation
Get the unread message count for a specific conversation (excluding chatrooms).
Method
getUnreadCount(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
callback: IRCIMIWGetUnreadCountCallback
): Promise<number>;
Parameter Description
Parameter Name | Parameter Type | Description |
---|---|---|
type | RCIMIWConversationType | Conversation type |
targetId | string | Conversation ID |
channelId | string | The channel ID, only supported for ultra groups. For other conversation types, pass null. |
callback | IRCIMIWGetUnreadCountCallback | Callback for the interface call result. |
Return Value
Return Value | Description |
---|---|
number | The status code of the current interface operation. 0 indicates success. For specific results, implement the interface callback. Non-zero indicates failure, and the callback won't be triggered. Refer to the error code for details. |
Code Example
const callback = {
onSuccess: (t: number) => {
//...
},
onError: (code: number) => {
//...
},
};
let code = await engine.getUnreadCount(type, targetId, channelId, callback);
Get Unread Count by Conversation Types
Get the unread count for multiple specified conversation types (excluding chatrooms).
Method
getUnreadCountByConversationTypes(
conversationTypes: Array<RCIMIWConversationType>,
channelId: string,
contain: boolean,
callback: IRCIMIWGetUnreadCountByConversationTypesCallback
): Promise<number>;
Parameter Description
Parameter Name | Parameter Type | Description |
---|---|---|
conversationTypes | Array<RCIMIWConversationType> | Collection of conversation types |
channelId | string | The channel ID, only supported for ultra groups. For other conversation types, pass null. |
contain | boolean | Whether to include unread messages from muted conversations. |
callback | IRCIMIWGetUnreadCountByConversationTypesCallback | Callback for the interface call result. |
Return Value
Return Value | Description |
---|---|
number | The status code of the current interface operation. 0 indicates success. For specific results, implement the interface callback. Non-zero indicates failure, and the callback won't be triggered. Refer to the error code for details. |
Code Example
const callback = {
onSuccess: (t: number) => {
//...
},
onError: (code: number) => {
//...
},
};
let code = await engine.getUnreadCountByConversationTypes(conversationTypes, channelId, contain, callback);
Clear Unread Count for a Specific Conversation
Clear the unread count for a specific conversation (excluding chatrooms).
Method
clearUnreadCount(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
timestamp: number,
callback: IRCIMIWClearUnreadCountCallback
): Promise<number>;
Parameter Description
Parameter Name | Parameter Type | Description |
---|---|---|
type | RCIMIWConversationType | Conversation type |
targetId | string | Conversation ID |
channelId | string | The channel ID, only supported for ultra groups. For other conversation types, pass null. |
timestamp | number | The timestamp of the last read message in the conversation. To clear all, pass the latest timestamp. |
callback | IRCIMIWClearUnreadCountCallback | Callback for the interface call result. |
Return Value
Return Value | Description |
---|---|
number | The status code of the current interface operation. 0 indicates success. For specific results, implement the interface callback. Non-zero indicates failure, and the callback won't be triggered. Refer to the error code for details. |
Code Example
const callback = {
onUnreadCountCleared: (code: number) => {
//...
},
};
let code = await engine.clearUnreadCount(type, targetId, channelId, timestamp, callback);
Load All Unread Mention Counts
Load all unread mention counts for a specific conversation.
Method
getUnreadMentionedCount(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
callback: IRCIMIWGetUnreadMentionedCountCallback
): Promise<number>;
Parameter Description
Parameter Name | Parameter Type | Description |
---|---|---|
type | RCIMIWConversationType | Conversation type |
targetId | string | Conversation ID |
channelId | string | The channel ID, only supported for ultra groups. For other conversation types, pass null. |
callback | IRCIMIWGetUnreadMentionedCountCallback | Callback for the interface call result. |
Code Example
const callback = {
onSuccess: (t: number) => {
//...
},
onError: (code: number) => {
//...
},
};
let code = await engine.getUnreadMentionedCount(type, targetId, channelId, callback);