Skip to main content

ChatMessage

Namespace: Wisej.Web.Ext.Syncfusion2

Assembly: Wisej.Web.Ext.Syncfusion2 (4.1.0.0)

Represents one message in the chat transcript.

public class ChatMessage

Constructors​

Instance member ChatMessage()​

Initializes a new instance of ChatMessage.

Properties​

Instance member AttachedFile​

ChatAttachment: Gets or sets the Syncfusion attachedFile value for this MessageModel. (Default: null)

Instance member Author​

ChatUser: Gets or sets the user that authored the message. (Default: null)

When the value is null, AddMessage assigns a copy of the current User of the chat.

Instance member Id​

String: Gets or sets the unique message identifier. (Default: "")

The identifier is used by UpdateMessage, RemoveMessage and ScrollToMessage to find the message. When the value is empty, AddMessage assigns a new unique identifier.

Instance member IsForwarded​

Boolean: Gets or sets whether the message is marked as forwarded. (Default: False)

Instance member IsPinned​

Boolean: Gets or sets whether the message is pinned. (Default: False)

Instance member MentionUsers​

ChatUser[]: Gets or sets the users referenced by placeholders in Text. (Default: null)

The placeholder {0} in Text is rendered as a mention of the first user of the array, {1} as a mention of the second one and so on.

Example:

The following example creates a message that mentions a user.

var message = new Chat.ChatMessage
{
Author = chat.User,
Text = "{0} can you review the document?",
MentionUsers = new[] { new Chat.ChatUser { Id = "u2", User = "Syncfusion Bot" } }
};
chat.AddMessage(message);

Instance member ReplyTo​

MessageReply: Gets or sets the message being replied to. (Default: null)

The value is a copy of the relevant fields of the original message: MessageID links the reply to it, the other fields are displayed in the reply preview.

Example:

The following example adds a reply to the last message of the conversation.

Chat.ChatMessage target = chat.Messages.Last();
chat.AddMessage(new Chat.ChatMessage
{
Author = chat.User,
Text = "I agree.",
ReplyTo = new Chat.MessageReply
{
MessageID = target.Id,
Text = target.Text,
Timestamp = target.TimeStamp,
User = target.Author
}
});

Instance member Status​

MessageStatus: Gets or sets the message delivery status. (Default: null)

Instance member Text​

String: Gets or sets the message content. Syncfusion mentions use placeholders such as {0}. (Default: "")

Instance member TimeStamp​

DateTime: Gets or sets the message timestamp. (Default: 1/1/0001 12:00:00 AM)

When the value is not set, AddMessage assigns the current date and time.

Instance member TimeStampFormat​

String: Gets or sets the timestamp display format. (Default: "")

The value is a Syncfusion date format pattern, for example hh:mm a, that applies to this message only. The format of all the other messages is set through TimeStampFormat.