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:
public class Message : UniqueChatEntity {
public string Id { get; protected set; }
public string MessageText { get; }
public string OriginalMessageText { get; }
public string TimeToken { get; }
public string ChannelId { get; }
public string UserId { get; }
public string Meta { get; }
public bool IsDeleted { get; }
public List<User> MentionedUsers { get; }
public List<Channel> ReferencedChannels { get; }
public List<TextLink> TextLinks { get; }
public string MessageActions { get; }
public List<MessageAction> Reactions { get; }
}
Parameter | Description |
---|---|
Id Type: string | Unique identifier for the message which is a message timetoken. |
MessageText Type: string | Text content of the message. This is the main content sent by the user. |
OriginalMessageText Type: string | Original text content of the message, before any edits. |
TimeToken Type: string | A timestamp that helps order messages in a conversation. |
ChannelId Type: string | Unique identifier for the channel or group in which the message was sent. |
UserId Type: string | Unique ID of the user who sent the message. Do not confuse this with the username of the user. |
Meta Type: string | 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 Type: bool | Indicates whether the message has been deleted. If the message has been deleted, this property will be true . |
MentionedUsers Type: List<User> | List of users mentioned in the message. |
ReferencedChannels Type: List<Channel> | List of channels referenced in the message. |
TextLinks Type: List<TextLink> | List of links included in the message. |
MessageActions Type: string | Any action associated with the message (like edited or deleted). |
Reactions Type: List<MessageAction> | All message reactions added to the message by other users. |
Events
The Message
object has the following event:
// Event triggered when a message is updated
public event Action<Message> OnMessageUpdated;
Example
An event that is triggered when a message is updated by the server.
message.OnMessageUpdated += (message) =>
{
Console.WriteLine("Message was edited!");
};
Methods
You can call the following methods on the Message
object.
Click on each method for more details.
AddListenerToMessagesUpdate()
CreateThread()
Delete()
IsDeleted
HasThread()
EditMessageText()
Forward()
TryGetThread()
ReferencedChannels
HasUserReaction()
ToggleReaction()
Pin()
TryGetQuotedMessage()
Reactions()
removeThread()
Report()
Restore()
OnMessageUpdated
MessageText
SetListeningForUpdates()
TextLinks
Use case
For example, you can use the Message
object methods to: