Browse SDKs · React Native
Platform
SDKsReact Native

Create @ message

Construct a mention (@) message for group conversations using the OpenIM React Native SDK.

Copy

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

ParameterTypeRequiredDescription
textstringYesBody text containing mention tags.
atUserIDListstring[]YesArray of user IDs mentioned in the message.
atUsersInfoAtUsersInfoItem[]NoMember display attributes in the group, including atUserID and groupNickname.
messageMessageItemNoOptional 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.