Browse SDKs · Android
Platform
SDKsAndroid

Create an emoji message

Use createFaceMessage to create a custom emoji message.

Copy

Construct a custom sticker or large emoji message object containing an index identifier and custom metadata. This is typically used for app-defined sticker packs, animated emojis, and custom reaction stickers.

Code example

int index = 101; // Emoji index number
String dataJson = "{\"packID\":\"pack_classic\",\"url\":\"https://example.com/face/101.gif\"}";

Message message = OpenIMClient.getInstance().messageManager.createFaceMessage(index, dataJson);

Parameters

ParameterTypeRequiredDescription
indexintYesCustom emoji index number defined by your application's sticker library.
dataStringYesSerialized JSON string with sticker metadata (such as animated image URL, sticker pack name, etc.).

Return value

Returns the created Message object with contentType set to MessageType.FACE.

State changes after the call

  1. Local initialization: Initializes the local Message structure without sending data to the server.
  2. Transmission: Call Send a message to deliver the sticker message to a single user or group.