Message

@Serializable
data class Message(val messageId: Long, val messageThreadId: Int? = null, val from: User? = null, val senderChat: Chat? = null, val senderBoostCount: Int? = null, val senderBusinessBot: User? = null, val date: Instant, val businessConnectionId: String? = null, val chat: Chat, val forwardOrigin: MessageOrigin? = null, val isTopicMessage: Boolean? = null, val isAutomaticForward: Boolean? = null, val replyToMessage: Message? = null, val externalReply: ExternalReplyInfo? = null, val replyToStory: Story? = null, val quote: TextQuote? = null, val viaBot: User? = null, val editDate: Instant? = null, val hasProtectedContent: Boolean? = null, val isFromOffline: Boolean? = null, val mediaGroupId: String? = null, val authorSignature: String? = null, val text: String? = null, val entities: List<MessageEntity>? = null, val linkPreviewOptions: LinkPreviewOptions? = null, val animation: Animation? = null, val audio: Audio? = null, val document: Document? = null, val photo: List<PhotoSize>? = null, val sticker: Sticker? = null, val story: Story? = null, val video: Video? = null, val videoNote: VideoNote? = null, val voice: Voice? = null, val caption: String? = null, val captionEntities: List<MessageEntity>? = null, val contact: Contact? = null, val dice: Dice? = null, val game: Game? = null, val poll: Poll? = null, val venue: Venue? = null, val location: Location? = null, val newChatMembers: List<User>? = null, val leftChatMember: User? = null, val newChatTitle: String? = null, val newChatPhoto: List<PhotoSize>? = null, val deleteChatPhoto: Boolean? = null, val groupChatCreated: Boolean? = null, val supergroupChatCreated: Boolean? = null, val channelChatCreated: Boolean? = null, val messageAutoDeleteTimerChanged: MessageAutoDeleteTimerChanged? = null, val migrateToChatId: Long? = null, val migrateFromChatId: Long? = null, val pinnedMessage: MaybeInaccessibleMessage? = null, val invoice: Invoice? = null, val successfulPayment: SuccessfulPayment? = null, val usersShared: UsersShared? = null, val chatShared: ChatShared? = null, val connectedWebsite: String? = null, val writeAccessAllowed: WriteAccessAllowed? = null, val passportData: PassportData? = null, val proximityAlertTriggered: ProximityAlertTriggered? = null, val boostAdded: ChatBoostAdded? = null, val forumTopicCreated: ForumTopicCreated? = null, val forumTopicEdited: ForumTopicEdited? = null, val forumTopicClosed: ForumTopicClosed? = null, val forumTopicReopened: ForumTopicReopened? = null, val generalForumTopicHidden: GeneralForumTopicHidden? = null, val generalForumTopicUnhidden: GeneralForumTopicUnhidden? = null, val giveawayCreated: GiveawayCreated? = null, val chatBackgroundSet: ChatBackground? = null, val giveaway: Giveaway? = null, val giveawayWinners: GiveawayWinners? = null, val giveawayCompleted: GiveawayCompleted? = null, val videoChatScheduled: VideoChatScheduled? = null, val videoChatStarted: VideoChatStarted? = null, val videoChatEnded: VideoChatEnded? = null, val videoChatParticipantsInvited: VideoChatParticipantsInvited? = null, val webAppData: WebAppData? = null, val replyMarkup: InlineKeyboardMarkup? = null, val hasMediaSpoiler: Boolean? = null) : MaybeInaccessibleMessage, MultipleResponse

This object represents a message.

Api reference

Constructors

Link copied to clipboard
constructor(messageId: Long, messageThreadId: Int? = null, from: User? = null, senderChat: Chat? = null, senderBoostCount: Int? = null, senderBusinessBot: User? = null, date: Instant, businessConnectionId: String? = null, chat: Chat, forwardOrigin: MessageOrigin? = null, isTopicMessage: Boolean? = null, isAutomaticForward: Boolean? = null, replyToMessage: Message? = null, externalReply: ExternalReplyInfo? = null, replyToStory: Story? = null, quote: TextQuote? = null, viaBot: User? = null, editDate: Instant? = null, hasProtectedContent: Boolean? = null, isFromOffline: Boolean? = null, mediaGroupId: String? = null, authorSignature: String? = null, text: String? = null, entities: List<MessageEntity>? = null, linkPreviewOptions: LinkPreviewOptions? = null, animation: Animation? = null, audio: Audio? = null, document: Document? = null, photo: List<PhotoSize>? = null, sticker: Sticker? = null, story: Story? = null, video: Video? = null, videoNote: VideoNote? = null, voice: Voice? = null, caption: String? = null, captionEntities: List<MessageEntity>? = null, contact: Contact? = null, dice: Dice? = null, game: Game? = null, poll: Poll? = null, venue: Venue? = null, location: Location? = null, newChatMembers: List<User>? = null, leftChatMember: User? = null, newChatTitle: String? = null, newChatPhoto: List<PhotoSize>? = null, deleteChatPhoto: Boolean? = null, groupChatCreated: Boolean? = null, supergroupChatCreated: Boolean? = null, channelChatCreated: Boolean? = null, messageAutoDeleteTimerChanged: MessageAutoDeleteTimerChanged? = null, migrateToChatId: Long? = null, migrateFromChatId: Long? = null, pinnedMessage: MaybeInaccessibleMessage? = null, invoice: Invoice? = null, successfulPayment: SuccessfulPayment? = null, usersShared: UsersShared? = null, chatShared: ChatShared? = null, connectedWebsite: String? = null, writeAccessAllowed: WriteAccessAllowed? = null, passportData: PassportData? = null, proximityAlertTriggered: ProximityAlertTriggered? = null, boostAdded: ChatBoostAdded? = null, forumTopicCreated: ForumTopicCreated? = null, forumTopicEdited: ForumTopicEdited? = null, forumTopicClosed: ForumTopicClosed? = null, forumTopicReopened: ForumTopicReopened? = null, generalForumTopicHidden: GeneralForumTopicHidden? = null, generalForumTopicUnhidden: GeneralForumTopicUnhidden? = null, giveawayCreated: GiveawayCreated? = null, chatBackgroundSet: ChatBackground? = null, giveaway: Giveaway? = null, giveawayWinners: GiveawayWinners? = null, giveawayCompleted: GiveawayCompleted? = null, videoChatScheduled: VideoChatScheduled? = null, videoChatStarted: VideoChatStarted? = null, videoChatEnded: VideoChatEnded? = null, videoChatParticipantsInvited: VideoChatParticipantsInvited? = null, webAppData: WebAppData? = null, replyMarkup: InlineKeyboardMarkup? = null, hasMediaSpoiler: Boolean? = null)

Properties

Link copied to clipboard
val animation: Animation? = null

Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set

Link copied to clipboard
val audio: Audio? = null

Optional. Message is an audio file, information about the file

Link copied to clipboard
val authorSignature: String? = null

Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator

Link copied to clipboard

Optional. Service message: user boosted the chat

Link copied to clipboard

Optional. Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier.

Link copied to clipboard
val caption: String? = null

Optional. Caption for the animation, audio, document, photo, video or voice

Link copied to clipboard

Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption

Link copied to clipboard

Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.

Link copied to clipboard
open override val chat: Chat

Chat the message belongs to

Link copied to clipboard

Optional. Service message: chat background set

Link copied to clipboard
val chatShared: ChatShared? = null

Optional. Service message: a chat was shared with the bot

Link copied to clipboard

Optional. The domain name of the website on which the user has logged in. More about Telegram Login: https://core.telegram.org/widgets/login

Link copied to clipboard
val contact: Contact? = null

Optional. Message is a shared contact, information about the contact

Link copied to clipboard
@Serializable(with = InstantSerializer::class)
open override val date: Instant

Date the message was sent in Unix time. It is always a positive number, representing a valid date.

Link copied to clipboard

Optional. Service message: the chat photo was deleted

Link copied to clipboard
val dice: Dice? = null

Optional. Message is a dice with random value

Link copied to clipboard
val document: Document? = null

Optional. Message is a general file, information about the file

Link copied to clipboard
@Serializable(with = InstantSerializer::class)
val editDate: Instant? = null

Optional. Date the message was last edited in Unix time

Link copied to clipboard

Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text

Link copied to clipboard

Optional. Information about the message that is being replied to, which may come from another chat or forum topic

Link copied to clipboard

Optional. Service message: forum topic closed

Link copied to clipboard

Optional. Service message: forum topic created

Link copied to clipboard

Optional. Service message: forum topic edited

Link copied to clipboard

Optional. Service message: forum topic reopened

Link copied to clipboard

Optional. Information about the original message for forwarded messages

Link copied to clipboard
val from: User? = null

Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.

Link copied to clipboard
val game: Game? = null

Optional. Message is a game, information about the game. More about games: https://core.telegram.org/bots/api#games

Link copied to clipboard

Optional. Service message: the 'General' forum topic hidden

Link copied to clipboard

Optional. Service message: the 'General' forum topic unhidden

Link copied to clipboard
val giveaway: Giveaway? = null

Optional. The message is a scheduled giveaway message

Link copied to clipboard

Optional. Service message: a giveaway without public winners was completed

Link copied to clipboard

Optional. Service message: a scheduled giveaway was created

Link copied to clipboard

Optional. A giveaway with public winners was completed

Link copied to clipboard

Optional. Service message: the group has been created

Link copied to clipboard

Optional. True, if the message media is covered by a spoiler animation

Link copied to clipboard

Optional. True, if the message can't be forwarded

Link copied to clipboard
val invoice: Invoice? = null

Optional. Message is an invoice for a payment, information about the invoice. More about payments: https://core.telegram.org/bots/api#payments

Link copied to clipboard

Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group

Link copied to clipboard
val isFromOffline: Boolean? = null

Optional. True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message

Link copied to clipboard
val isTopicMessage: Boolean? = null

Optional. True, if the message is sent to a forum topic

Link copied to clipboard
val leftChatMember: User? = null

Optional. A member was removed from the group, information about them (this member may be the bot itself)

Link copied to clipboard

Optional. Options used for link preview generation for the message, if it is a text message and link preview options were changed

Link copied to clipboard
val location: Location? = null

Optional. Message is a shared location, information about the location

Link copied to clipboard
val mediaGroupId: String? = null

Optional. The unique identifier of a media message group this message belongs to

Link copied to clipboard

Optional. Service message: auto-delete timer settings changed in the chat

Link copied to clipboard
open override val messageId: Long

Unique message identifier inside this chat

Link copied to clipboard
val messageThreadId: Int? = null

Optional. Unique identifier of a message thread to which the message belongs; for supergroups only

Link copied to clipboard
val migrateFromChatId: Long? = null

Optional. The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.

Link copied to clipboard
val migrateToChatId: Long? = null

Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.

Link copied to clipboard
val newChatMembers: List<User>? = null

Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)

Link copied to clipboard

Optional. A chat photo was change to this value

Link copied to clipboard
val newChatTitle: String? = null

Optional. A chat title was changed to this value

Link copied to clipboard

Optional. Telegram Passport data

Link copied to clipboard
val photo: List<PhotoSize>? = null

Optional. Message is a photo, available sizes of the photo

Link copied to clipboard

Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.

Link copied to clipboard
val poll: Poll? = null

Optional. Message is a native poll, information about the poll

Link copied to clipboard

Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location.

Link copied to clipboard
val quote: TextQuote? = null

Optional. For replies that quote part of the original message, the quoted part of the message

Link copied to clipboard

Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.

Link copied to clipboard
val replyToMessage: Message? = null

Optional. For replies in the same chat and message thread, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.

Link copied to clipboard
val replyToStory: Story? = null

Optional. For replies to a story, the original story

Link copied to clipboard
val senderBoostCount: Int? = null

Optional. If the sender of the message boosted the chat, the number of boosts added by the user

Link copied to clipboard
val senderBusinessBot: User? = null

Optional. The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account.

Link copied to clipboard
val senderChat: Chat? = null

Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.

Link copied to clipboard
val sticker: Sticker? = null

Optional. Message is a sticker, information about the sticker

Link copied to clipboard
val story: Story? = null

Optional. Message is a forwarded story

Link copied to clipboard

Optional. Message is a service message about a successful payment, information about the payment. More about payments: https://core.telegram.org/bots/api#payments

Link copied to clipboard

Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.

Link copied to clipboard
val text: String? = null

Optional. For text messages, the actual UTF-8 text of the message

Link copied to clipboard

Optional. Service message: users were shared with the bot

Link copied to clipboard
val venue: Venue? = null

Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set

Link copied to clipboard
val viaBot: User? = null

Optional. Bot through which the message was sent

Link copied to clipboard
val video: Video? = null

Optional. Message is a video, information about the video

Link copied to clipboard

Optional. Service message: video chat ended

Link copied to clipboard

Optional. Service message: new participants invited to a video chat

Link copied to clipboard

Optional. Service message: video chat scheduled

Link copied to clipboard

Optional. Service message: video chat started

Link copied to clipboard
val videoNote: VideoNote? = null

Optional. Message is a video note, information about the video message

Link copied to clipboard
val voice: Voice? = null

Optional. Message is a voice message, information about the file

Link copied to clipboard
val webAppData: WebAppData? = null

Optional. Service message: data sent by a Web App

Link copied to clipboard

Optional. Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess