Browse SDKs · uni-app / uni-app x
Platform
SDKsuni-app / uni-app x

Create a face message

Construct an animated sticker or custom emoji face message from an index and data string.

Copy

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

ParameterTypeRequiredDescription
indexnumberYesNumeric index identifying the specific emoji or sticker.
datastringYesApplication-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) return

Senders 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.