SDKsReact Native
Create @ message
Construct a mention (@) message for group conversations using the OpenIM React Native SDK.
Construct a mention (@) message in a group conversation. Ensure mention tokens embedded in text align with the user IDs provided in atUserIDList.
const message = await OpenIMSDK.createTextAtMessage({
text: '@user-001 please review the release checklist.',
atUserIDList: ['user-001'],
atUsersInfo: [
{
atUserID: 'user-001',
groupNickname: 'Taylor',
},
],
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Body text containing mention tags. |
atUserIDList | string[] | Yes | Array of user IDs mentioned in the message. |
atUsersInfo | AtUsersInfoItem[] | No | Member display attributes in the group, including atUserID and groupNickname. |
message | MessageItem | No | Optional referenced original message for combined mention and quote replies. |
Return value
A resolved Promise returns the initialized MessageItem object with mention attributes stored in atTextElem.
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 group conversation.
Was this page helpful?