SDKsWASM
Create a custom message
Create a structured custom business message with the WASM SDK.
Use createCustomMessage() for application-specific messages such as orders, tasks, invitations, or polls.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Complete business payload string, typically serialized JSON. |
extension | string | Yes | Complete business extension string. |
description | string | Yes | Description of the message type, or fallback text for clients that do not support it. |
const { data: message } = await openimsdk.createCustomMessage({
data: JSON.stringify({ type: 'task', taskID: 'task_42' }),
extension: JSON.stringify({ schemaVersion: 1 }),
description: 'Task card',
});data contains the business payload, extension contains additional business information, and description identifies the type or provides a fallback. Each value is a complete string. The receiving client should validate the version, size, and fields, and must not execute untrusted content.
When the Promise resolves, it returns only a pending MessageItem. Sending a message and receiving a custom business event are separate flows.
Was this page helpful?