Mentions are a great way to get someone’s attention in a conversation. Mentions start with the @ symbol followed by a name.Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Extension settings
- Login to CometChat and select your app.
- Go to the Extensions section and enable the Mentions extension.
How does it work?
Implement UI logic in your app
Simply enabling the extension will not add the functionality to your apps. The Mentions extension heavily depends on the UI. It should have the following logic already implemented.- When
@symbol is typed in the message composer, show a list of all the users of that group. - Insert the selected name from the list in the message composer as
@{Name|UID}. - The message bubbles and the message composer render the
@{Name|UID}as just@Name.
cometchat-uid-1, the text message should be Hello @{Andrew Joseph|cometchat-uid-1}. However, it should be rendered or formatted as Hello @Andrew Joseph in the message composer as well as the message bubbles in the chat.
You have to use third party libraries that make the above mentioned implementation simpler and a rich text editor like Quill or TinyMCE.
Listing messages with mentions
To get all the messages with mentions for a user, make use of thecallExtension method provided by CometChat SDK as shown below:
- JavaScript
- Java
- Swift