Browse SDKs · Android
SDKsAndroid

Create a custom message

Use createCustomMessage to carry application-defined JSON content.

Copy

Your application defines data, extension, and description. Receiving clients must parse them according to the same application protocol.

Parameters

ParameterTypeRequiredDescription
dataStringYesCustom message body, normally a validated JSON string.
extensionStringYesApplication extension data; pass an empty string when unused.
descriptionStringYesShort description for notifications and conversation summaries.
Message message = OpenIMClient.getInstance().messageManager.createCustomMessage(
    dataJson, extensionJson, description);

The returned Message is only a local pending object. Validate the protocol version and field sizes before sending, and never place tokens, secrets, or other sensitive values in custom data. Continue with Send a message.