Message Receiving Option | Feature Description |
TencentCloudChat.TYPES.MSG_REMIND_ACPT_AND_NOTE | Messages will be received when the user is online, and offline push notifications will be received when the user is offline. |
TencentCloudChat.TYPES.MSG_REMIND_ACPT_NOT_NOTE | The SDK receives a message and notifies you (by reporting the message receiving event), and you display no notification. This option is usually used to implement message notification muting. |
TencentCloudChat.TYPES.MSG_REMIND_DISCARD | The SDK rejects a message. |
getMessageList
.chat.setMessageRemindType(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Description |
groupID | String | Group ID or topic ID |
userIDList | Array | List of userID values of the receivers of the one-to-one conversation. The number of userID values cannot exceed 30 per request. |
messageRemindType | String | Group message notification type. Valid values: TencentCloudChat.TYPES.MSG_REMIND_ACPT_AND_NOTE (The SDK receives messages and notifies the receiver (by reporting the message receiving event), and a notification is displayed for the receiver.)TencentCloudChat.TYPES.MSG_REMIND_ACPT_NOT_NOTE (The SDK receives messages and notifies the receiver (by reporting the message receiving event), and no notification is displayed. This option is usually used to implement message notification muting.)TencentCloudChat.TYPES.MSG_REMIND_DISCARD (The SDK rejects messages.) |
Promise
// Set to reject group messages// (The `getMessageList` API can be called to pull messages sent by other group members)let promise = chat.setMessageRemindType({groupID: 'group1',messageRemindType: TencentCloudChat.TYPES.MSG_REMIND_DISCARD});promise.then(function(imResponse) {// The SDK triggers the `TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED` event// (after traversing the list and reading `Conversation.messageRemindType`).}).catch(function(imError) {console.warn('setMessageRemindType error:', imError);});
// Enable message notifications after setting to reject group messageslet promise = chat.setMessageRemindType({groupID: 'group1',messageRemindType: TencentCloudChat.TYPES.MSG_REMIND_ACPT_AND_NOTE});promise.then(function(imResponse) {// The SDK triggers the `TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED` event// (after traversing the list and reading `Conversation.messageRemindType`).}).catch(function(imError) {console.warn('setMessageRemindType error:', imError);});
// If the message notification type for a one-to-one conversation is set to mute message notifications// messages will be received when the user is online and will not be received when the user is offline// (with offline push supported)let promise = chat.setMessageRemindType({userIDList: ['user1', 'user2'],messageRemindType: TencentCloudChat.TYPES.MSG_REMIND_ACPT_NOT_NOTE});promise.then(function(imResponse) {// The SDK triggers the `TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED` event// (after traversing the list and reading `Conversation.messageRemindType`).const { successUserIDList, failureUserIDList } = imResponse.data;// List of successfully deleted `userID` valuessuccessUserIDList.forEach((item) => {const { userID } = item;});// List of `userID` values failed to be deletedfailureUserIDList.forEach((item) => {const { userID, code, message } = item;});}).catch(function(imError) {console.warn('setMessageRemindType error:', imError);});
// If the message notification type for a community topic is set to mute message notifications,// messages will be received when the user is online and will not be received when the user is offline// (with offline push supported).let promise = chat.setMessageRemindType({groupID: 'topicID',messageRemindType: TencentCloudChat.TYPES.MSG_REMIND_ACPT_NOT_NOTE});promise.then(function(imResponse) {// Message notification muting set successfully}).catch(function(imError) {// Failed to set message notification mutingconsole.warn('setMessageRemindType error:', imError);});
Was this page helpful?