Chat / Unreal
Current version: v3
Chat Unreal v3
Chat Unreal
Chat
Unreal
Home
/
Chat
/
Unreal
/
Messages

Mention other users in a message

In both group channels and open channels, a user can mention other users in a message to call their attention. Users have the option of calling specific users in the channel by their user IDs or calling all users in the channel.

Up to ten mentioned users receive notifications for a mention through SBDChannelHandler's MentionReceived().


Mention by user IDs

To mention specific users when sending a message, add a list of user IDs to SetMentionedUserIds(). Then, add the list to SBDUserMessageParams and pass the params to SendUserMessage().

Mentioned users must belong to the channel where the message is being sent. Users who are mentioned but don't belong to the channel won't be included in the mentioned user IDs array of the sent message.

std::vector<std::wstring> userIDsToMention;
userIDsToMention.push_back(L"Jane");
userIDsToMention.push_back(L"Julia");
userIDsToMention.push_back(L"Tyler");

SBDUserMessageParams params = SBDUserMessageParams()
        .SetMessage(MESSAGE)
        .SetMentionedUserIds(userIDsToMention);

channel->SendUserMessage(params, [](SBDUserMessage* userMessage, SBDError* error) {
    if (error != nullptr) {
        // Handle error.
        return;
    }
});

Mention all channel users

When a user types "@channel" or other designated text in a message, you can set the mention type to channel using SetMentionType() and let the user call the attention of everyone in the channel.

SBDUserMessageParams params = SBDUserMessageParams()
        .SetMentionType(SBDMentionType.Channel)

channel->SendUserMessage(params, [](SBDUserMessage* userMessage, SBDError* error) {
    if (error != nullptr) {
        // Handle error.
        return;
    }
});

Limitations

Using channel mention is subject to the following limitations.

Channel mentions per user

Channel sizeAllowed mentions per hour

Less than or equal to 100 users

10

Greater than 100 users

1

Channel mentions per channel

Channel sizeAllowed mentions per hour

Less than or equal to 100 users

100

Greater than 100 users

10