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 Description
id string yes The id of the replied message.
receiver string no userID of the one-to-one message receiver. Just specify receiver for sending one-to-one chat messages.
groupID string no groupID of the group chat. Just specify groupID for sending group messages.
replyMessage V2TimMessage no The instance of original message been replied.
priority MessagePriorityEnum no 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 boolean no 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 V2TimOfflinePushInfo no Offline push message. The title, body and external content carried and shown when a message is pushed offline.
needReadReceipt boolean no Whether a read receipt is supported for the sent group message.
isExcludedFromUnreadCount boolean no 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 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 : number
    desc : string
    data : {
      msgID: string
      timestamp: number
      progress: number
      sender: string
      nickName: string
      friendRemark: string
      faceUrl: string
      nameCard: string
      groupID: string
      userID: string
      status: number
      elemType: number
      textElem: V2TimTextElem
      customElem: V2TimCustomElem
      imageElem: V2TimImageElem
      soundElem: V2TimSoundElem
      videoElem: V2TimVideoElem
      fileElem: V2TimFileElem
      locationElem: V2TimLocationElem
      faceElem: V2TimFaceElem
      groupTipsElem: V2TimGroupTipsElem
      mergerElem: V2TimMergerElem
      localCustomData: string
      localCustomInt: number
      cloudCustomData: string
      isSelf: boolean
      isRead: boolean
      isPeerRead: boolean
      priority: number
      offlinePushInfo: V2TimOfflinePushInfo
      groupAtUserList: string[]
      seq: string
      random: number
      isExcludedFromUnreadCount: boolean
      isExcludedFromLastMessage: boolean
      id: string
      needReadReceipt: boolean
    }
}

Return value details

name type description
code number Request result: Error codes. 0 means success.
desc string The description of the error. It will be empty if success.
data V2TimMessage The replied message created.

Code example

import { TencentImSDKPlugin, MessagePriorityEnum } from 'react-native-tim-js';


const createTextMessageRes = await TencentImSDKPlugin.v2TIMManager
    .getMessageManager()
    .createTextMessage(
        'test'
    );

const findMessageRes = await TencentImSDKPlugin.v2TIMManager
    .getMessageManager()
    .findMessages([]);
if (createTextMessageRes.code == 0) {

    const id = createTextMessageRes.data?.id;




    const 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: {},
            localCustomData: '',
        });
    if (sendMessageRes.code === 0) {

    }
}

results matching ""

    No results matching ""