Message object
Message
is an object that refers to a single message published on a chat channel.
Properties
The Message
interface has the following properties:
interface Message {
val chat: Chat
val timetoken: Long
val content: EventContent.TextMessageContent
val channelId: String
val userId: String
val actions: Map<String, Map<String, List<Action>>>?
val meta: Map<String, Any>?
val mentionedUsers: MessageMentionedUsers? // deprecated
val referencedChannels: MessageReferencedChannels? // deprecated
val quotedMessage: QuotedMessage?
val text: String
val deleted: Boolean
val hasThread: Boolean
val files: List<File>
show all 20 linesParameter | Type | Description |
---|---|---|
chat | Chat | Reference to the main Chat object. |
timetoken | Long | Unique identifier for the message, possibly a timestamp or similar value that helps order messages in a conversation. |
content | EventContent.TextMessageContent | Original text content of the message. |
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. |
actions | Map<String, Map<String, List<Action>>> | Any actions associated with the message, such as reactions, replies, or other interactive elements. |
meta | Map<String, Any> | 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} . |
mentionedUsers | MessageMentionedUsers | |
referencedChannels | MessageReferencedChannels | |
quotedMessage | QuotedMessage | List of quoted messages with their timetokens, content, and authors' IDs. |
text | String | Content of the message. |
deleted | Boolean | Whether the message is soft deleted. |
hasThread | Boolean | Whether any thread has been created for this message. |
files | List<File> | List of attached files with their names, types, and sources. |
reactions | Map<String, List<Action>> | List of reactions attached to the message. |
textLinks | List<TextLink> |
Methods
You can call the following methods and properties on the Message
object.
Click on each method or property for more details.
createThread()
delete()
deleted
hasThread
editText()
forward()
getThread()
hasUserReaction()
toggleReaction()
pin()
quotedMessage
reactions
removeThread()
report()
restore()
streamUpdates()
streamUpdatesOn()
text
textlinks
Use case
For example, you can use the Message
object methods to: