Browse SDKs · Android
SDKsAndroid

Create a mention message

Use createTextAtMessage to create a text message that mentions group members.

Copy

Pass the text, mentioned user IDs, the AtUserInfo list, and an optional quoted message.

Parameters

ParameterTypeRequiredDescription
textStringYesComplete message text, matching the final UI content.
userIDsList<String>YesDeduplicated user IDs to notify.
atUserInfosList<AtUserInfo>YesMentioned users and display names corresponding to userIDs.
quoteMessageMessageNoComplete quoted message when the mention is also a reply; otherwise null.
Message message = OpenIMClient.getInstance().messageManager.createTextAtMessage(
    text, userIDs, atUserInfos, quoteMessage);

The returned Message is only a local pending object. Mentions are normally sent to a group chat. Confirm that each target is still a group member, then use Send a message with that group.