createTargetedGroupMessage

Introduction

Create a target group message.

A targeted group message is a message sent to specified members in a group, which cannot be received by other group members.

For details, you can referring to this document.

Parameter details

Parameter name Parameter type Required Platform Description
id String yes All The local id of the created message.
receiverList List< String > yes All The list of user ID of several members in the group.

Returned template

V2TimValueCallback<V2TimMsgCreateInfoResult>

{
    code: int,
    desc: String,
    data: {
        id: String,
        messageInfo: V2TimMessage,
    }
}

Return value details

name type description
code int Request result: Error codes. 0 means success.
desc String The description of the failure.
data V2TimMsgCreateInfoResult The target group message created.

Code example

    V2TimValueCallback<V2TimMsgCreateInfoResult> target =
        await TencentImSDKPlugin.v2TIMManager
            .getMessageManager()
            .createTextMessage(text: "");
    String? id = target.data?.id;
    V2TimValueCallback<V2TimMsgCreateInfoResult> groupTarget =
        await TencentImSDKPlugin.v2TIMManager
            .getMessageManager()
            .createTargetedGroupMessage(
      id: id!,
      receiverList: ['user1', 'user2'],
    );
    if (groupTarget.code == 0) {
      String? groupTargetdId = groupTarget.data?.id;
      V2TimValueCallback<V2TimMessage> sendMessageRes =
          await TencentImSDKPlugin.v2TIMManager.getMessageManager().sendMessage(
              id: groupTargetdId!, receiver: "userID", groupID: "groupID");
      if (sendMessageRes.code == 0) {
      }
    }

results matching ""

    No results matching ""