Set Do Not Disturb by Conversation
Set Do Not Disturb Status for a Conversation
Method
IM users can set the Do Not Disturb level for a specified conversation or ultra group, supporting one-to-one chat, group chat, and ultra group conversations.
changeConversationNotificationLevel(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
level: RCIMIWPushNotificationLevel,
callback: IRCIMIWChangeConversationNotificationLevelCallback
): Promise<number>;
Parameter Description
Parameter | Type | Description |
---|---|---|
type | RCIMIWConversationType | Conversation type. Note the following restrictions:
|
targetId | string | Conversation ID |
channelId | string | The channel ID of the ultra group conversation. Pass null for other types.
|
level | RCIMIWPushNotificationLevel | Push notification level |
callback | IRCIMIWChangeConversationNotificationLevelCallback | Callback for the interface call result. |
Return Value
Return Value | Description |
---|---|
number | Status code of the current interface operation. 0 indicates success. Specific results need to be implemented in the callback. Non-zero values indicate failure, and detailed errors can be found in the error codes. |
Code Example
const callback = {
onConversationNotificationLevelChanged: (code: number) => {
//...
},
};
let code = await engine.changeConversationNotificationLevel(type, targetId, channelId, level, callback);
Get the Do Not Disturb Status of a Conversation
Query the Do Not Disturb level set by the current user for a specified conversation.
Method
getConversationNotificationLevel(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
callback: IRCIMIWGetConversationNotificationLevelCallback
): Promise<number>;
Parameter Description
Parameter | Type | Description |
---|---|---|
type | RCIMIWConversationType | Conversation type. Note the following restrictions:
|
targetId | string | Conversation ID |
channelId | string | The channel ID of the ultra group conversation. Pass null for other types.
|
callback | IRCIMIWGetConversationNotificationLevelCallback | Callback for the interface call result. |
Return Value
Return Value | Description |
---|---|
number | Status code of the current interface operation. 0 indicates success. Specific results need to be implemented in the callback. Non-zero values indicate failure, and detailed errors can be found in the error codes. |
Code Example
const callback = {
onSuccess: (t: RCIMIWPushNotificationLevel) => {
//...
},
onError: (code: number) => {
//...
},
};
let code = await engine.getConversationNotificationLevel(type, targetId, channelId, callback);
Get the Do Not Disturb Status List
Get a list of all conversations with Do Not Disturb settings.
Method
getBlockedConversations(
conversationTypes: Array<RCIMIWConversationType>,
channelId: string,
callback: IRCIMIWGetBlockedConversationsCallback
): Promise<number>;
Parameter Description
getBlockedConversations(
conversationTypes: Array<RCIMIWConversationType>,
channelId: string,
callback: IRCIMIWGetBlockedConversationsCallback
): Promise<number>;
Return Value
Return Value | Description |
---|---|
number | Status code of the current interface operation. 0 indicates success. Specific results need to be implemented in the callback. Non-zero values indicate failure, and detailed errors can be found in the error codes. |
Code Example
const callback = {
onSuccess: (t: Array<RCIMIWConversation>) => {
//...
},
onError: (code: number) => {
//...
},
};
let code = await engine.getBlockedConversations(conversationTypes, channelId, callback);