For AI agents: this page in Markdown: https://www.pubnub.com/docs/chat/unity-chat-sdk/learn/chat-entities/message.md. Documentation index: https://www.pubnub.com/llms-full.txt.
Message object
Message represents a single message published on a chat channel.
Properties
Message has the following properties:
1public class Message : UniqueChatEntity {
2 public string Id { get; protected set; }
3 public string MessageText { get; }
4 public string OriginalMessageText { get; }
5 public string TimeToken { get; }
6 public string ChannelId { get; }
7 public string UserId { get; }
8 public Dictionary<string, object> Meta { get; }
9 public bool IsDeleted { get; }
10 public List<MentionedUser> MentionedUsers { get; }
11 public List<ReferencedChannel> ReferencedChannels { get; }
12 public List<TextLink> TextLinks { get; }
13 public List<MessageAction> MessageActions { get; }
14 public List<MessageAction> Reactions { get; }
15 public List<ChatFile> Files { get; }
show all 16 linesId#- Unique identifier for the message which is a message timetoken.
MessageText#- Text content of the message. This is the main content sent by the user.
OriginalMessageText#- Original text content of the message, before any edits.
TimeToken#- A timestamp that helps order messages in a conversation.
ChannelId#- Unique identifier for the channel or group in which the message was sent.
UserId#- Unique ID of the user who sent the message. Do not confuse this with the username of the user.
Meta#- Extra information added to the message giving additional context. This object can be of any type and can consist of a list of key-value pairs.
IsDeleted#- Indicates whether the message has been deleted. If the message has been deleted, this property will be
true. MentionedUsers#- List of users mentioned in the message.
ReferencedChannels#- List of channels referenced in the message.
TextLinks#- List of links included in the message.
MessageActions#- Any action associated with the message (like edited or deleted).
Reactions#- All message reactions added to the message by other users.
Events
The Message object has the following event:
1// Event triggered when a message is updated — enabled by StreamUpdates()
2public event Action<Message> OnUpdated;
Example
An event that is triggered when a message is updated by the server.
1
Methods
You can call the following methods on the Message object.
Click on each method for more details.
Standard methods
CreateThread()Delete()EditMessageText()Forward()GetMessageElements()GetQuotedMessage()GetThread()HasThread()HasUserReaction()MessageReactions()Pin()RemoveThread()Report()Restore()ToggleReaction()
Streaming methods
These methods register or unregister real-time event subscriptions. Each streaming method activates one or more of the events listed in the Events section above.
Use case
Message methods enable: