Mention in Messages

The mention feature in chat can be used to call attention to specific members. By @mentioning their names, this will promptly notify them so you can get a faster response to your message. Mention is only supported on TEXT message type.

Mention is supported in these channel types:

  • Community

  • Live

Mention is not supported in the Conversation channel type.

Create a message with mentions

There are 2 types of mentions:

  1. USER - When using mention of this type, a specific member being mentioned will receive a push notification. Up to 30 channel members can be mentioned per message.

2. CHANNEL - When using mention of this type, all channel members will receive push notification.

Banned users cannot be mentioned. However, admins can still find the banned users' names in the suggestion list during search when composing the message. But once the message is sent, the banned users’ information will not be included in the message payload anymore.

Viewing mentions

Mentionee list provided during message creation is available with AmityMessage

SDK only sends push notifications according to the mentionee list. The system doesn't handle any data related to UI rendering.

However, AmityMessage has a property called metadata which can hold an object and will not be tampered by the system. So, it can be utilized as a storage for UI-related data.

UI helper

SDK provides a helper which helps in generating a metadata containing sufficient data to highlight text with indices.

SDK also provides another helper in parsing UI mention data from metadata.

Mentioning banned users

Banned users will not receive any push notifications if they are being mentioned. When searching, only the admins can search for the banned users to mention. If users who are not admins will search the banned users, they will get an error. Here is a sample method for admins in searching banned users:

Mention notifications

When users are being mentioned, they will receive push notifications. You can customize the push notification content such as the title and the body using the notification setting API.

Provide the notification title and body in the titleTemplate and bodyTemplate parameters respectively. Here is a sample model:

{
  "level": "network",
  "isPushNotifiable": true,
  "notifiableEvents": [
   {
      "name": "text-mention-message.created",
      "isPushNotifiable": true,
      "titleTemplate": "{{UserDisplayName}} mentioned you in {{ChannelName}}",
      "bodyTemplate": "{{Message}}"
    }
  ]
}
NameData TypeDescription

name

String

Event name

isPushNotifiable

Boolean

If set to true,push notification will be received for all text messages. If set to false, only messages with mention will have push notifications.

titleTemplate

String

Notification title

bodyTemplate

String

Notification body

Last updated