Browse SDKs · React Native
Platform
SDKsReact Native

Create text message

Construct a basic plain-text message using the OpenIM React Native SDK.

Copy

Construct a standard plain-text chat message:

const message = await OpenIMSDK.createTextMessage('Hello, welcome to the discussion.');

Parameters

Supply the plain-text message string as the sole argument.

Return value

A resolved Promise returns the initialized MessageItem object with message body populated in textElem.

This method builds the message structure strictly in client memory; it does not dispatch messages to the server or trigger lifecycle events. After initialization, invoke Send message to deliver it to a one-to-one or group conversation.