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; }
}
ParameterTypeDescription
IdstringUnique identifier for the message which is a message timetoken.
MessageTextstringText content of the message. This is the main content sent by the user.
TimeTokenstringA timestamp that helps order messages in a conversation.
ChannelIdstringUnique identifier for the channel or group in which the message was sent.
UserIdstringUnique ID of the user who sent the message. Do not confuse this with the username of the user.
MetastringExtra 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.
IsDeletedboolIndicates whether the message has been deleted. If the message has been deleted, this property will be true.
MentionedUsersList<User>List of users mentioned in the message.
ReferencedChannelsList<Channel>List of channels referenced in the message.
TextLinksList<TextLink>List of links included in the message.
MessageActionsstringAny action associated with the message (like edited or deleted).
ReactionsList<MessageAction>All message reactions added to the message by other users.
icon

Message-related types

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.

Use case

For example, you can use the Message object methods to:

Last updated on