Skip to main content
Mentions in messages enable users to refer to specific individual within a conversation. This is done by using the <@uid:UID> format, where UID represents the user’s unique identification. Mentions are a powerful tool for enhancing communication in messaging platforms. They streamline interaction by allowing users to easily engage and collaborate with particular individuals, especially in group conversations.

Send Mentioned Messages

To send a message with a mentioned user, you must follow a specific format: <@uid:UID>. For example, to mention the user with UID cometchat-uid-1 with the message “Hello,” your text would be "Hello, <@uid:cometchat-uid-1>"
You can mention user in text message and media messages captions

Mentioned Messages

By default, the SDK will fetch all the messages irrespective of the fact that the logged-in user is mentioned or not in the message. The SDK has other optional filters such as tags and blocked relationships.

Mentions With Tag Info

To get a list of messages in a conversation where users are mentioned along with the user tags of the mentioned users.
Relevant fields to access on returned messages and their mentioned users:

Mentions With Blocked Info

To get a list of messages in a conversation where users are mentioned along with the blocked relationship of the mentioned users with the logged-in user. Relevant fields to access on returned messages and their mentioned users:

Get Users Mentioned In a Particular Message

To retrieve the list of users mentioned in the particular message, you can use the message.getMentionedUsers() method. This method will return an array containing the mentioned users, or an empty array if no users were mentioned in the message.
The getMentionedUsers() method returns an array of User objects.

Next Steps

Send Messages

Send text, media, and custom messages

Receive Messages

Listen for incoming messages in real time

Reactions

Add emoji reactions to messages

Threaded Messages

Organize conversations with message threads