Link Search Menu Expand Document

Constructor: message

Back to constructors index

A message


outBoolOptionalIs this an outgoing message
mentionedBoolOptionalWhether we were mentioned in this message
media_unreadBoolOptionalWhether there are unread media attachments in this message
silentBoolOptionalWhether this is a silent message (no notification triggered)
postBoolOptionalWhether this is a channel post
from_scheduledBoolOptionalWhether this is a scheduled message
legacyBoolOptionalThis is a legacy message: it has to be refetched with the new layer
edit_hideBoolOptionalWhether the message should be shown as not modified to the user, even if an edit date is present
pinnedBoolOptionalWhether this message is pinned
noforwardsBoolOptionalWhether this message is protected and thus cannot be forwarded; clients should also prevent users from saving attached media (i.e. videos should only be streamed, photos should be kept in RAM, et cetera).
invert_mediaBoolOptionalIf set, any eventual webpage preview will be shown on top of the message instead of at the bottom.
idintYesID of the message
from_idPeerOptionalID of the sender of the message
peer_idPeerYesPeer ID, the chat where this message was sent
saved_peer_idPeerOptionalMessages fetched from a saved messages dialog » will have peer=inputPeerSelf and the saved_peer_id flag set to the ID of the saved dialog.
fwd_fromMessageFwdHeaderOptionalInfo about forwarded messages
via_bot_idlongOptionalID of the inline bot that generated the message
reply_toMessageReplyHeaderOptionalReply information
dateintYesDate of the message
messagestringYesThe message
mediaMessageMediaOptionalMedia attachment
reply_markupReplyMarkupOptionalReply markup (bot/inline keyboards)
entitiesArray of MessageEntityOptionalMessage entities for styled text
parse_modestringWhether to parse HTML or Markdown markup in the messageOptional
viewsintOptionalView count for channel posts
forwardsintOptionalForward counter
repliesMessageRepliesOptionalInfo about post comments (for channels) or message replies (for groups)
edit_dateintOptionalLast edit date of this message
post_authorstringOptionalName of the author of this message for channel posts (with signatures enabled)
grouped_idlongOptionalMultiple media messages sent using messages.sendMultiMedia with the same grouped ID indicate an album or media group
reactionsMessageReactionsOptionalReactions to this message
restriction_reasonArray of RestrictionReasonOptionalContains the reason why access to this message must be restricted.
ttl_periodintOptionalTime To Live of the message, once === time(), the message will be deleted on the server, and must be deleted locally as well.

Type: Message

Usage of parse_mode:

Set parse_mode to html to enable HTML parsing of the message.

Set parse_mode to Markdown to enable markdown parsing of the message.

The following tags are currently supported:

<br>a newline
<b><i>bold works ok, internal tags are stripped</i> </b>
<code>inline fixed-width code</code>
<pre>pre-formatted fixed-width code block</pre>
<blockquote>pre-formatted fixed-width code block</blockquote>
<a href="">URL</a>
<a href="mention:@danogentili">Mention by username</a>
<a href="mention:186785362">Mention by user id</a>
<a href="tg://user?id=186785362">Mention by user id</a>
Custom emoji: <emoji id="5368324170671202286">👍</emoji>
Custom emoji: <tg-emoji emoji-id="5368324170671202286">👍</tg-emoji>
<pre language="json">Pre tags can have a language attribute</pre>

You can also use normal markdown (bot API MarkdownV2 syntax), note that to create mentions you can also use the mention: syntax like in html:

*bold \*text*
_italic \*text_
*bold _italic bold ~italic bold strikethrough ||italic bold strikethrough spoiler||~ __underline italic bold___ bold*
[inline URL](
[inline mention of a user](tg://user?id=123456789)
\`inline fixed-width code\`
pre-formatted fixed-width code block
pre-formatted fixed-width code block written in the PHP programming language

[Mention by username](mention:@danogentili)
[Mention by user id](mention:186785362)
[Mention by user id](tg://user?id=186785362)


$message = ['_' => 'message', 'out' => Bool, 'mentioned' => Bool, 'media_unread' => Bool, 'silent' => Bool, 'post' => Bool, 'from_scheduled' => Bool, 'legacy' => Bool, 'edit_hide' => Bool, 'pinned' => Bool, 'noforwards' => Bool, 'invert_media' => Bool, 'offline' => Bool, 'id' => int, 'from_id' => Peer, 'from_boosts_applied' => int, 'peer_id' => Peer, 'saved_peer_id' => Peer, 'fwd_from' => MessageFwdHeader, 'via_bot_id' => long, 'via_business_bot_id' => long, 'reply_to' => MessageReplyHeader, 'date' => int, 'message' => 'string', 'media' => MessageMedia, 'reply_markup' => ReplyMarkup, 'entities' => [MessageEntity, MessageEntity]parse_mode: 'string', , 'views' => int, 'forwards' => int, 'replies' => MessageReplies, 'edit_date' => int, 'post_author' => 'string', 'grouped_id' => long, 'reactions' => MessageReactions, 'restriction_reason' => [RestrictionReason, RestrictionReason], 'ttl_period' => int, 'quick_reply_shortcut_id' => int];