Message object
Message is an object that refers to a single message published on a chat channel.
Properties
The Message object 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}
| Parameter | Description |
|---|---|
IdType: string | Unique identifier for the message which is a message timetoken. |
MessageTextType: string | Text content of the message. This is the main content sent by the user. |
OriginalMessageTextType: string | Original text content of the message, before any edits. |
TimeTokenType: string | A timestamp that helps order messages in a conversation. |
ChannelIdType: string | Unique identifier for the channel or group in which the message was sent. |
UserIdType: string | Unique ID of the user who sent the message. Do not confuse this with the username of the user. |
MetaType: Dictionary<string, object> | 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. |
IsDeletedType: bool | Indicates whether the message has been deleted. If the message has been deleted, this property will be true. |
MentionedUsersType: List<MentionedUser> | List of users mentioned in the message. |
ReferencedChannelsType: List<ReferencedChannel> | List of channels referenced in the message. |
TextLinksType: List<TextLink> | List of links included in the message. |
MessageActionsType: List<MessageAction> | Any action associated with the message (like edited or deleted). |
ReactionsType: List<MessageAction> | 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
2public event Action<Message> OnMessageUpdated;
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.
CreateThread()Delete()EditMessageText()Forward()GetQuotedMessage()GetThread()HasThread()HasUserReaction()Pin()RemoveThread()Report()Restore()ToggleReaction()
Use case
For example, you can use the Message object methods to: