Overview
Conversation Overview
In the Chat SDK, there are three types of
Conversation
: One-to-one (C2C): A one-to-one conversation between only two users. Its composition method is
C2C${userID}
.GROUP: A group conversation among group members. Its composition method is
GROUP${groupID}
.@TIM#SYSTEM
(System Notification Session)You can use the conversation class APIs to display/update the conversation list, update the unread count, pin a conversation to the top, and mute message notifications.
UI Display
Conversation Storage Policy
By default, the client can pull 100 recent contact conversations from the cloud, and after upgrading to the Pro edition 、Pro Plus edition or Enterprise edition, it can be configured to pull up to 500 recent contact conversations. The conversation duration is consistent with the saving time of the last message in the conversation. Messages are saved for 7 days by default, which means the conversation is also saved for 7 days by default. Please refer to the Pricing.
Conversation Class
Attribute | Type | Description |
conversationID | String | Its composition method is: C2C${userID} - A one-to-one conversation between only two usersGROUP${groupID} - A group conversation among group members@TIM#SYSTEM - System Notification Session |
type | String | TencentCloudChat.TYPES.CONV_C2C - A one-to-one conversation between only two usersTencentCloudChat.TYPES.CONV_GROUP - A group conversation among group membersTencentCloudChat.TYPES.CONV_SYSTEM - System Notification Session |
unreadCount | Number | Unread count. Group conversations of type TencentCloudChat.TYPES.GRP_MEETING / TencentCloudChat.TYPES.GRP_AVCHATROOM do not record unread counts, and the value of this field is 0. |
lastMessage | Object | The latest message in the conversation. Its attributes are described as follows. nick - String - The nickname of the message sendernameCard - String - The group name card of the message senderlastTime - Number - The timestamp of the message, in secondslastSequence - Number - The sequence of the messagefromAccount - String - The userID of the message senderisRevoked - Boolean - Whether the message has been recalled, with true indicating it has been recalled, and the default value is false revoker - String | null - The userID of the message recall initiatorisPeerRead - Boolean - Whether the message in a one-to-one conversation has been read by the other party; after the other party calls setMessageRead to report that it has been read, isPeerRead becomes true . The default is false messageForShow - String - The content of the message, used for display. Possible values: text message content, "[Image]", "[Voice]", "[Location]", "[Emoji]", "[File]", "[Custom Message]". If this field does not meet your needs, you can use the payload to customize rendering.type - StringTencentCloudChat.TYPES.MSG_TEXT | Text messageTencentCloudChat.TYPES.MSG_IMAGE | Image messageTencentCloudChat.TYPES.MSG_AUDIO | Audio messageTencentCloudChat.TYPES.MSG_VIDEO | Video messageTencentCloudChat.TYPES.MSG_FILE | File messageTencentCloudChat.TYPES.MSG_LOCATION | Geolocation messageTencentCloudChat.TYPES.MSG_CUSTOM | Custom messageTencentCloudChat.TYPES.MSG_GRP_TIP | Group tips messageTencentCloudChat.TYPES.MSG_GRP_SYS_NOTICE | Group system notification message.payload - Object - The content of the message |
groupProfile | Group | Group profile of the group conversation. |
userProfile | Profile | User profile of the one-to-one conversation. |
groupAtInfoList | Array.<GroupAtInfo> | @mentioned info list of the group conversation. The developer can display effects such as [Someone @ me] or [@all] in the conversation list based on this information. |
remark | String | Friend remark. It has a value only when there is a C2C conversation, the other party is my friend, and I have set a remark for this friend. |
isPinned | Boolean | Whether the conversation is pinned. |
messageRemindType | String | Message reminder types, specifically as follows: 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.TencentCloudChat.TYPES.NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT - Messages will be received when the user is online, and only group @ mentioned messages will be received when the user is offline. |
markList | Array | Conversation tag list, specifically as follows: TencentCloudChat.TYPES.CONV_MARK_TYPE_STAR - Star a conversationTencentCloudChat.TYPES.CONV_MARK_TYPE_UNREAD - Mark a conversation as unreadTencentCloudChat.TYPES.CONV_MARK_TYPE_FOLD - Collapse a conversationTencentCloudChat.TYPES.CONV_MARK_TYPE_HIDE - Hide a conversation |
customData | String | Custom data for the conversation. |
conversationGroupList | Array | List of conversation groups that the conversation belongs to. |
draftText | String | Conversation draft. Stored locally only, not in the cloud. |
GroupAtInfo
Name | Type | Description |
groupID | String | Group ID. |
messageSequence | Number | Sequence of messages with @ information. |
atTypeArray | Array.<Number> | at type array, at enumeration values in group conversations are as follows:TencentCloudChat.TYPES.CONV_AT_ME - Someone mentioned me.TencentCloudChat.TYPES.CONV_AT_ALL - Mentioned everyone in the group.TencentCloudChat.TYPES.CONV_AT_ALL_AT_ME - Mentioned everyone in the group and also mentioned me individually. |