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 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 | Type | Description |
---|---|---|
Id | string | Unique identifier for the message which is a message timetoken. |
MessageText | string | Text content of the message. This is the main content sent by the user. |
TimeToken | string | A timestamp that helps order messages in a conversation. |
ChannelId | string | Unique identifier for the channel or group in which the message was sent. |
UserId | string | Unique ID of the user who sent the message. Do not confuse this with the username of the user. |
Meta | 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 | bool | Indicates whether the message has been deleted. If the message has been deleted, this property will be true . |
MentionedUsers | List<User> | List of users mentioned in the message. |
ReferencedChannels | List<Channel> | List of channels referenced in the message. |
TextLinks | List<TextLink> | List of links included in the message. |
MessageActions | string | Any action associated with the message (like edited or deleted). |
Reactions | 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
StartListeningForUpdates()
TextLinks
Use case
For example, you can use the Message
object methods to: