Skip to main content

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

ParameterTypeDescription
typeRCIMIWConversationTypeConversation type. Note the following restrictions:
  • Ultra group conversation type: If the ultra group service was activated before 2022.09.01, it does not support setting the Do Not Disturb level for all messages in a single ultra group conversation ("all messages" refers to messages in all channels and messages not belonging to any channel). This interface only sets the Do Not Disturb level for messages not belonging to any channel in the specified ultra group conversation (targetId). To modify this, please submit a ticket.
  • Chatroom conversation type: Not supported, as chatroom messages do not support push notifications by default.
targetIdstringConversation ID
channelIdstringThe channel ID of the ultra group conversation. Pass null for other types.
  • If a channel ID is provided, the Do Not Disturb level will be set for the specified channel. If no channel ID is specified, it will apply to all ultra group messages.
  • Note: For customers who activated the ultra group service before 2022.09.01, if no channel ID is specified, an empty string "" is passed by default, meaning the Do Not Disturb level is only set for messages not belonging to any channel in the specified ultra group conversation (targetId). To modify this, please submit a ticket.
levelRCIMIWPushNotificationLevelPush notification level
callbackIRCIMIWChangeConversationNotificationLevelCallbackCallback for the interface call result.

Return Value

Return ValueDescription
numberStatus 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

ParameterTypeDescription
typeRCIMIWConversationTypeConversation type. Note the following restrictions:
  • Ultra group conversation type: If the ultra group service was activated before 2022.09.01, it does not support setting the Do Not Disturb level for all messages in a single ultra group conversation ("all messages" refers to messages in all channels and messages not belonging to any channel). This interface only sets the Do Not Disturb level for messages not belonging to any channel in the specified ultra group conversation (targetId). To modify this, please submit a ticket.
  • Chatroom conversation type: Not supported, as chatroom messages do not support push notifications by default.
targetIdstringConversation ID
channelIdstringThe channel ID of the ultra group conversation. Pass null for other types.
  • If a channel ID is provided, the Do Not Disturb level will be set for the specified channel. If no channel ID is specified, it will apply to all ultra group messages.
  • Note: For customers who activated the ultra group service before 2022.09.01, if no channel ID is specified, an empty string "" is passed by default, meaning the Do Not Disturb level is only set for messages not belonging to any channel in the specified ultra group conversation (targetId). To modify this, please submit a ticket.
callbackIRCIMIWGetConversationNotificationLevelCallbackCallback for the interface call result.

Return Value

Return ValueDescription
numberStatus 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 ValueDescription
numberStatus 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);