Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Create sticker message

Create a sticker or custom emoji message from index numbers and payload data.

Copy

Creates a custom sticker or emoji message identified by index code and associated data.

Code example

import sdk, { CreateFaceMessageReq, CreateFaceMessageResp } from '@openimsdk/imsdk';

const request: CreateFaceMessageReq = {
  index: 1001,
  data: JSON.stringify({ packID: 'default', name: 'wave' }),
};
const response: CreateFaceMessageResp = await sdk.createFaceMessage(request);
const message = response.message;

Parameters

ParameterTypeRequiredDescription
indexnumberYesCustom sticker index number.
datastringYesSupplementary sticker data string (for example, pack ID and name).

Return value

Returns a Promise resolving to CreateFaceMessageResp:

PropertyTypeDescription
messageIMMessageLocally instantiated sticker message object.

State changes after the call

Both sending and receiving clients should adhere to a unified emoji indexing protocol and provide graceful fallback rendering for unknown indexes. The SDK does not download, validate, or render graphic assets directly. This operation creates the message object locally; call Send message to dispatch it.