createFaceMessage

Introduction

Create a sticker message.

This kind of messages will not carry the sticker image itself, but will send the code of the sticker, that you can decode the sticker to a emoji or a png image to the message list.

Please specify the index and the data related to a unique sticker in your sticker package.

While the IM SDK do not provide an official sticker package.

You can take advantage of the official sticker panel provided by us, tim_ui_kit_sticker_plugin, to add the sticker functionality quickly.

For details, you can referring to this document.

Parameter details

Parameter name Parameter type Required Platform Description
index int yes All The index of the sticker.
data String yes All The data of the sticker.

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 sticker message created.

Code example

V2TimValueCallback<V2TimMsgCreateInfoResult> createFaceMessageRes =
      await TencentImSDKPlugin.v2TIMManager
          .getMessageManager()
          .createFaceMessage(
            index: 0,
            data: "custom data",
          );
  if (createFaceMessageRes.code == 0) {
    String? id = createFaceMessageRes.data?.id;
    V2TimValueCallback<V2TimMessage> sendMessageRes = await TencentImSDKPlugin
        .v2TIMManager
        .getMessageManager()
        .sendMessage(id: id!, receiver: "userID", groupID: "groupID");
    if (sendMessageRes.code == 0) {
    }
  }

results matching ""

    No results matching ""