For AI agents: this page in Markdown: https://www.pubnub.com/docs/chat/kotlin-chat-sdk/learn/chat-entities/message.md. Documentation index: https://www.pubnub.com/llms-full.txt.
Message object
Message represents a single message published on a chat channel.
Properties
The Message interface has the following properties:
1interface Message {
2 val chat: Chat
3 val timetoken: Long
4 val content: EventContent.TextMessageContent
5 val channelId: String
6 val userId: String
7 val actions: Map<String, Map<String, List<Action>>>?
8 val meta: Map<String, Any>?
9 val mentionedUsers: MessageMentionedUsers? // deprecated
10 val referencedChannels: MessageReferencedChannels? // deprecated
11 val quotedMessage: QuotedMessage?
12 val text: String
13 val deleted: Boolean
14 val hasThread: Boolean
15 val files: List<File>
show all 20 lineschat#- Reference to the main
Chatobject. timetoken#- Unique identifier for the message, possibly a timestamp or similar value that helps order messages in a conversation.
content#- Original text content of the message.
channelId#- Unique identifier for the channel or group in which the message was sent.
Deprecated#actionsDeprecated. Use reactions instead.meta#- 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. For example,
{language: 'English', wordCount: 42}. Deprecated#mentionedUsersList of mentioned users with IDs and names.Deprecated#referencedChannelsList of referenced channels with IDs and names.quotedMessage#- List of quoted messages with their timetokens, content, and authors' IDs.
text#- Content of the message.
deleted#- Whether the message is soft deleted.
hasThread#- Whether any thread has been created for this message.
files#- List of attached files with their names, types, and sources.
reactions#- List of reactions attached to the message. Each
MessageReactioncontains avalue(the emoji string),isMine(whether the current user added it),userIds(list of users who added it), andcount(number of users). Deprecated#textLinksList of included text links and their position.
Methods
The Message object exposes the following methods and properties.
Regular methods
createThread()createThreadMessageDraft()createThreadWithResult()delete()deletedhasThreadeditText()forward()getThread()hasUserReaction()toggleReaction()pin()quotedMessagereactionsremoveThread()report()restore()texttextlinks
Event listeners
onUpdated()(deprecated)streamUpdates()streamUpdatesOn()
Use case
Message methods enable: