SDKsReact Native
Create a custom message
OpenIM React Native SDK guide for create a custom message.
Use createCustomMessage() to create a custom business message. The sending and receiving applications must agree on the formats of data and extension.
const message = await OpenIMSDK.createCustomMessage({
data: JSON.stringify({ type: 'task', taskID: 'task-42' }),
extension: JSON.stringify({ version: 1 }),
description: 'Task card',
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Business data string. It can contain JSON. |
extension | string | Yes | Business extension data string. |
description | string | Yes | Message description. It can also be fallback text for clients that do not support the message type. |
The call returns a MessageItem ready to send. Receiving clients should validate the business-data format and version. For server-delivered business notifications, see Receive custom business messages.
Was this page helpful?