SDKsuni-app / uni-app x
Create a face message
Construct an animated sticker or custom emoji face message from an index and data string.
Invoke createFaceMessage() to send pre-defined stickers or custom emojis. The index property identifies the sticker index, while data carries an application-defined serialized payload string (such as sticker pack details). The SDK does not download or render custom sticker graphic assets.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
index | number | Yes | Numeric index identifying the specific emoji or sticker. |
data | string | Yes | Application-defined string payload associated with this sticker. |
Code example
import { createFaceMessage } from '@/uni_modules/unix-openim-sdk'
const message = await createFaceMessage({
index: 1001,
data: JSON.stringify({ packID: 'default', name: 'wave' }),
})
if (message == null) returnSenders and receivers must agree on sticker index conventions and data schemas. Provide fallback UI rendering when receiving unknown indices or unrecognized payload formats.
Return value
The Promise resolves with an OpenIMMessageItem | null object.
State changes after the call
Pass the constructed message item to Send a message. Track message status using clientMsgID.
Was this page helpful?