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

Create a text message

OpenIM uni-app / uni-app x SDK guide for Create a text message.

Copy
import { createTextMessage } from '@/uni_modules/unix-openim-sdk'

const message = await createTextMessage('Hello, OpenIMSDK')
if (message == null) throw new Error('Failed to create text message')

The Promise returns OpenIMMessageItem | null and does not send it. Validate product length limits first, then pass the returned object to Send a message. Do not construct OpenIMMessageItem manually.