createFaceMessage

Introduction

Create a face 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.

For details, you can referring to this document.

Parameter details

Parameter name Parameter type Required Description
index number yes The index of the sticker.
data string yes The data of the sticker.

Returned template

V2TimValueCallback<V2TimMsgCreateInfoResult>

{
    code: number,
    desc: string,
    data: {
        id: string,
        messageInfo: V2TimMessage,
    }
}

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

Code example

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


const createFaceMessageRes = await TencentImSDKPlugin.v2TIMManager
    .getMessageManager()
    .createFaceMessage(
        0,
        '自定义消息'
    );
if (createFaceMessageRes.code === 0) {
    const id = createFaceMessageRes.data?.id;




    const sendMessageRes = await TencentImSDKPlugin.v2TIMManager
        .getMessageManager()
        .sendMessage({ id: id!, receiver: 'userID', groupID: 'groupID' });
    if (sendMessageRes.code === 0) {

    }
}

results matching ""

    No results matching ""