Attribute | Definition | Description |
merge_elem_message_array | List of original messages | List of original messages to be combined and forwarded |
merge_elem_title | Title | Title of the combined message, such as "Chat History of xixiyah and Hello" as shown above |
merge_elem_abstract_array | Digest list | Digest list of the combined message as shown above. The original message digests need to be displayed for the combined message, which will be unfolded after the user clicks the cell. |
merge_elem_compatible_text | Compatibility text message | If the early SDK versions do not support the combined message, the user will receive a text message with the content `merge_elem_compatible_text` by default. |
// List of messages to be forwarded, which can contain combined messages but not group tipsvar message = new Message{message_conv_id = conv_id,message_conv_type = TIMConvType.kTIMConv_Group,message_elem_array = new List<Elem>{new Elem{elem_type = TIMElemType.kTIMElem_Merge,merge_elem_title = "Chat History of user1 and user2", // Title of the combined messagemerge_elem_message_array = new List<Message>{message1,message2},merge_elem_abstract_array = new List<string>{"user1:hello", "user2:hello" // Digest list of the combined message},merge_elem_compatible_text = "The current version does not support the message" // Compatibility text of the combined message. If the early SDK version does not support the combined message, the user will receive a text message with the content `compatibleText` by default.}},};StringBuilder messageId = new StringBuilder(128);TIMResult res = TencentIMSDK.MsgSendMessage(conv_id, TIMConvType.kTIMConv_Group, message, messageId, (int code, string desc, string json_param, string user_data)=>{// Async message sending result});
AddRecvNewMsgCallback
API (details) to add a message listener.
We recommend it be called early, such as after the chat page is initialized, to ensure timely message receiving in the application.TencentIMSDK.AddRecvNewMsgCallback((List<Message> messages, string user_data)=>{foreach(Message message in messages){foreach (Elem elem in message.message_elem_array){// There is a next messageif (elem.elem_type == TIMElemType.kTIMElem_Merge){}}}})
Message
in RecvNewMsgCallback
.
You can use the combined message element to get the merge_elem_title
and merge_elem_abstract_array
for UI display.
Then, when the user clicks the combined message, you can call the MsgDownloadMergerMessage
API (details) to download the combined message list for UI display.if(elem.TIMElemType == TIMElemType.kTIMElem_Merge){elem.merge_elem_abstract_array;elem.merge_elem_layer_over_limit;elem.merge_elem_title;TIMResult res = TencentIMSDK.MsgDownloadMergerMessage(message, (int code, string desc, List<Message> messages, string user_data)=>{// Process the async logic});}
MsgSendMessage
API (details) to send the message.
Was this page helpful?