sendReplyMessage
Introduction
Send a replied message, this kinds of message can refer to a message sent in previous.
Parameter details
Parameter name |
Parameter type |
Required |
Platform |
Description |
id |
String |
yes |
All |
The id of the replied message. |
receiver |
String |
no |
All |
userID of the one-to-one message receiver. Just specify receiver for sending one-to-one chat messages. |
groupID |
String |
no |
All |
groupID of the group chat. Just specify groupID for sending group messages. |
replyMessage |
V2TimMessage |
no |
All |
The instance of original message been replied. |
priority |
MessagePriorityEnum |
no |
All |
Message priority. Set a higher priority for important messages (such as red packets and gifts) and a lower priority for frequent and unimportant messages (such as likes). |
onlineUserOnly |
bool |
no |
All |
Whether the message can be received by online users only. If it is set to true , the message cannot be loaded when a receiver loads historical messages. This is often used to implement weak prompts, such as "The other party is typing..." and unimportant prompts in a group. |
offlinePushInfo |
OfflinePushInfo |
no |
All |
Offline push message. The title, body and external content carried and shown when a message is pushed offline. |
needReadReceipt |
bool |
no |
All |
Whether a read receipt is supported for the sent group message. |
isExcludedFromUnreadCount |
bool |
no |
All |
Whether the sent message is counted as the unread message of the conversation. If it is set to true , the sent message is not counted as the unread message of the conversation. It defaults to false . |
localCustomData |
String |
no |
All |
Local message data. Extra data of the message that is stored locally. It cannot be accessed by the receiver and will be lost after the application is uninstalled. |
Returned template
V2TimValueCallback<V2TimMessage>
{
code : int
desc : String
data : {
cloudCustomData : String
customElem : V2TimCustomElem
elemType : int
faceElem : V2TimFaceElem
faceUrl : String
fileElem : V2TimFileElem
friendRemark : String
groupAtUserList : List<String>
groupID : String
groupTipsElem : V2TimGroupTipsElem
id : String
imageElem : V2TimImageElem
isExcludedFromLastMessage : bool
isExcludedFromUnreadCount : bool
isPeerRead : bool
isRead : bool
isSelf : bool
localCustomData : String
localCustomInt : int
locationElem : V2TimLocationElem
mergerElem : V2TimMergerElem
messageFromWeb : String
msgID : String
nameCard : String
needReadReceipt : bool
nickName : String
offlinePushInfo : V2TimOfflinePushInfo
priority : int
progress : int
random : int
sender : String
seq : String
soundElem : V2TimSoundElem
status : int
textElem : V2TimTextElem
timestamp : int
userID : String
videoElem : V2TimVideoElem
}
}
Return value details
name |
type |
description |
code |
int |
Request result: Error codes. 0 means success. |
desc |
String |
The description of the failure. |
data |
V2TimMessage |
The replied message created. |
Code example
V2TimValueCallback<V2TimMsgCreateInfoResult> createTextMessageRes =
await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.createTextMessage(
text: "test",
);
V2TimValueCallback<List<V2TimMessage>> findMessageRes =
await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.findMessages(messageIDList: []);
if (createTextMessageRes.code == 0) {
String? id = createTextMessageRes.data?.id;
V2TimValueCallback<V2TimMessage> sendMessageRes = await TencentImSDKPlugin
.v2TIMManager
.getMessageManager()
.sendReplyMessage(
id: id!,
receiver: "userID",
groupID: "groupID",
replyMessage: findMessageRes.data![0],
priority: MessagePriorityEnum.V2TIM_PRIORITY_DEFAULT,
onlineUserOnly:
false,
isExcludedFromUnreadCount: false,
needReadReceipt:
false,
offlinePushInfo: OfflinePushInfo(),
localCustomData:
""
);
if (sendMessageRes.code == 0) {
}
}