Skip to main content
Quick Reference for AI Agents & Developers
  • Mention format: <@uid:USER_UID> in message text (e.g., "Hello <@uid:cometchat-uid-1>")
  • Get mentioned users: message.mentionedUsers returns array of mentioned User objects
  • Check if mentioned: message.mentionedMe returns Bool
  • Fetch with tag info: MessagesRequest.MessageRequestBuilder().mentionsWithTagInfo(true).build()
  • Related: Send Message · Receive Message · Messaging Overview
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.

Mention Format

Example message text with mention:

Send Mentioned Messages

Every User object has a String unique identifier associated with them which can be found in a property called uid. To mention a user in a message, the message text should contain the uid in following format: <@uid:UID_OF_THE_USER>.
Method: CometChat.sendTextMessage(message:)
Method: CometChat.sendTextMessage(message:)
You can mention users in text messages and media message captions.

Fetch Mentioned Messages

By default, the SDK will fetch all messages irrespective of whether the logged-in user is mentioned or not. The SDK allows you to fetch messages with additional mention information.

Mentions With Tag Info

Method: MessagesRequest.fetchPrevious()

Mentions With Blocked Info

Method: MessagesRequest.fetchPrevious()

Get Users Mentioned In a Message

To retrieve the list of users mentioned in a particular message:
Mentioned Users Array:

Check if Logged-in User Was Mentioned

To check if the logged-in user has been mentioned in a particular message:

Mentioned User Properties