SDKsReact Native
Create advanced text message
Construct a rich-text message with embedded entities such as URLs and styling spans using the OpenIM React Native SDK.
Construct a rich-text message containing embedded entities:
const message = await OpenIMSDK.createAdvancedTextMessage({
text: 'Check https://openim.io',
messageEntityList: [
{
type: 'url',
offset: 6,
length: 17,
url: 'https://openim.io',
},
],
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Raw string content of the rich-text message. |
messageEntityList | MessageEntity[] | No | Array of rich-text entities describing links, highlights, or custom spans. |
Each MessageEntity includes type, offset, and length, and can optionally provide url and info.
Return value
A resolved Promise returns the initialized MessageItem object with rich-text attributes populated in advancedTextElem.
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.
Was this page helpful?