Reference channels
Channel referencing lets users mention channels in messages by typing # followed by at least three letters. Matching channel names appear as suggestions.
Requires App Context
Enable App Context for your keyset in the Admin Portal.
Generic referencing
Channel references, user mentions, and links are MessageElement instances with different MentionTarget types.
Suggestions include all channels in the app keyset (up to 100), regardless of user membership. Configure up to 100 channel references per message (default: 10) and display them as links.
Implementation is similar to user mentions and links.
Add channel references
Add channel references with # followed by at least three letters of the channel name (e.g., #Sup). Use CreateChannelMentionTarget() to create a mention target linking to a specified Channel.
Method signature
Add a channel reference by calling AddMention() with the MentionTarget of type Channel.
Refer to the AddMention() method for details.
Sample code
Reference code
This example is a self-contained code snippet ready to be run. Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code. Use it as a reference when working with other examples in this document.
Create the Hello Alex! I have sent you this link on the #offtopic channel. message where #offtopic is a channel reference (channel name is offtopic).
Actor.h
1
Actor.cpp
1
Remove channel references
Remove a channel reference from a draft message with RemoveMention().
Method signature
Remove channel references by calling RemoveMention() at the exact offset where the reference starts.
Refer to the RemoveMention() method for details.
Offset value
Provide the exact position of the first character; otherwise the element is not removed.
Sample code
Reference code
This example is a self-contained code snippet ready to be run. Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code. Use it as a reference when working with other examples in this document.
Remove the channel reference from the Hello Alex! I have sent you this link on the #offtopic channel. message where #offtopic is a channel reference.
Actor.h
1
Actor.cpp
1
Get channel suggestions
The message elements listener returns matching channels from your keyset for the 3-letter string typed after #.
Typing #Sup returns channels like Support or Support-Agents. Default: 10 suggestions (max: 100).
Method signature
Refer to the Listen for message draft changes (with suggestions) section for details.
Sample code
Reference code
This example is a self-contained code snippet ready to be run. Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code. Use it as a reference when working with other examples in this document.
Insert the first referenced channel whenever the draft is updated and channels are detected.
Actor.h
1
Actor.cpp
1
Other examples
Get channel suggestions from Chat object
Actor.h
1
Actor.cpp
1
Get referenced channels
Removed method
ReferencedChannels() has been removed from the Message object in the latest version of the Unreal Chat SDK. Referenced channels are now managed through MessageDraft and message elements.