DEF STUDIO srl

Need help with Laravel and web development?

Hire one of our experts for your projects.

We build tailored products, websites and platforms — with care for UX, performance and maintainability.

Booking open for Q3 — limited slots

Rich Message

How it works

Rich messages support advanced structured formatting options like headings, lists, tables, media, block quotations, collapsible blocks, footnotes, and formulas. Telegram clients will render them accordingly.

Note

By Default, the Rich Message content will be sent in HTML format.

For the automatic Entity detection info or Rich Message limits visit https://core.telegram.org/bots/api#rich-messages

Attachments

Rich Message can be sent through Telegraph ->richMessage() method:

Telegraph::richMessage('<u>Rich Message</u>') //Default HTML format
        ->asMarkdown() //Rich Message can be formatted as Markdown
        ->businessConnectionId($id) //Unique identifier of the business connection
        ->messageThreadId($id) //Unique identifier for the target message thread (topic) of a forum
        ->directMessageTopicId($id) //Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
        ->disableNotification() //Sends the message silently
        ->protectContent() //Protects the contents of the sent message from forwarding and saving
        ->allowPaidBroadcast() //Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
        ->messageEffectId($id) //Unique identifier of the message effect to be added to the message; for private chats only
        ->suggestedPostParameters([...]) //A JSON-serialized object containing the parameters of the suggested post to send; Visit https://core.telegram.org/bots/api#suggestedpostparameters
        ->send();

Incoming Data

RichMessage

  • ->blocks() Content of the message , array of RichBlock
  • ->isRtl() Optional. True, if the rich message must be shown right-to-left

RichBlock

This object represents a block in a rich formatted message. Currently, it can be any of the following types:

RichBlockParagraph

A text paragraph, corresponding to the HTML tag <p>.

  • ->type() Type of the block, always “paragraph”
  • ->text() Text of the block, instance of RichText

RichBlockSectionHeading

A section heading, corresponding to the HTML tags <h1>, <h2>, <h3>, <h4>, <h5>, or <h6>.

  • ->type() Type of the block, always “heading”
  • ->text() Text of the block, instance of RichText
  • ->size() Relative size of the text font; 1-6, 1 is the largest, 6 is the smallest

RichBlockPreformatted

A preformatted text block, corresponding to the nested HTML tags <pre> and <code>.

  • ->type() Type of the block, always “pre”
  • ->text() Text of the block, instance of RichText
  • ->language() Optional. The programming language of the text

RichBlockFooter

A footer, corresponding to the HTML tag <footer>.

  • ->type() Type of the block, always “footer”
  • ->text() Text of the block, instance of RichText

RichBlockDivider

A divider, corresponding to the HTML tag <hr/>.

  • ->type() Type of the block, always “divider”

RichBlockMathematicalExpression

A block with a mathematical expression in LaTeX format, corresponding to the custom HTML tag <tg-math-block>.

  • ->type() Type of the block, always “mathematical_expression”
  • ->expression() The mathematical expression in LaTeX format

RichBlockAnchor

A block with an anchor, corresponding to the HTML tag <a> with the attribute name.

  • ->type() Type of the block, always “anchor”
  • ->name() The name of the anchor

RichBlockList

A list of blocks, corresponding to the HTML tag <ul> or <ol> with multiple nested tags <li>.

  • ->type() Type of the block, always “list”
  • ->items() Items of the list , array of RichBlockListItem

RichBlockBlockQuotation

A block quotation, corresponding to the HTML tag <blockquote>.

  • ->type() Type of the block, always “blockquote”
  • ->blocks() Content of the block , array of RichBlock
  • ->credit() Optional. Credit of the block, instance of RichText

RichBlockPullQuotation

A quotation with centered text, loosely corresponding to the HTML tag <aside>.

  • ->type() Type of the block, always “pullquote”
  • ->text() Text of the block, instance of RichText
  • ->credit() Optional. Credit of the block, instance of RichText

RichBlockCollage

A collage, corresponding to the custom HTML tag <tg-collage>.

  • ->type() Type of the block, always “collage”
  • ->blocks() Elements of the collage, array of RichBlock
  • ->caption() Optional. Caption of the block, instance of RichBlockCaption

RichBlockSlideshow

A slideshow, corresponding to the custom HTML tag <tg-slideshow>.

  • ->type() Type of the block, always “slideshow”
  • ->blocks() Elements of the slideshow, array of RichBlock
  • ->caption() Optional. Caption of the block, instance of RichBlockCaption

RichBlockTable

A table, corresponding to the HTML tag <table>.

  • ->type() Type of the block, always “table”
  • ->cells() Cells of the table, array of array of RichBlockTableCell
  • ->isBordered() Optional. True, if the table has borders
  • ->isStriped() Optional. True, if the table is striped
  • ->caption() Optional. Caption of the table, instance of RichText

RichBlockDetails

An expandable block for details disclosure, corresponding to the HTML tag <details>.

  • ->type() Type of the block, always “details”
  • ->summary() Always shown summary of the block, instance of RichText
  • ->blocks() Content of the block, array of RichBlock
  • ->isOpen() Optional. True, if the content of the block is visible by default

RichBlockMap

A block with a map, corresponding to the custom HTML tag <tg-map>.

  • ->type() Type of the block, always “map”
  • ->location() Location of the center of the map, instance of Location
  • ->zoom() Map zoom level; 13-20
  • ->width() Expected width of the map
  • ->height() Expected height of the map
  • ->caption() Optional. Caption of the block, instance of RichBlockCaption

RichBlockAnimation

A block with an animation, corresponding to the HTML tag <video>.

  • ->type() Type of the block, always “animation”
  • ->animation() The animation, instance of Animation
  • ->hasSpoiler() Optional. True, if the media preview is covered by a spoiler animation
  • ->caption() Optional. Caption of the block, instance of RichBlockCaption

RichBlockAudio

A block with a music file, corresponding to the HTML tag <audio>.

  • ->type() Type of the block, always “audio”
  • ->audio() The audio, instance of Audio
  • ->caption() Optional. Caption of the block, instance of RichBlockCaption

RichBlockPhoto

A block with a photo, corresponding to the HTML tag <img>.

  • ->type() Type of the block, always “photo”
  • ->photos() Available sizes of the photo, array of Photo
  • ->hasSpoiler() Optional. True, if the media preview is covered by a spoiler animation
  • ->caption() Optional. Caption of the block, instance of RichBlockCaption

RichBlockVideo

A block with a video, corresponding to the HTML tag <video>.

  • ->type() Type of the block, always “video”
  • ->video() The video, instance of Video
  • ->hasSpoiler() Optional. True, if the media preview is covered by a spoiler animation
  • ->caption() Optional. Caption of the block, instance of RichBlockCaption

RichBlockVoiceNote

A block with a voice note, corresponding to the HTML tag <audio>.

  • ->type() Type of the block, always “voice_note”
  • ->voiceNote() The voice note, instance of Voice
  • ->caption() Optional. Caption of the block, instance of RichBlockCaption

RichBlockThinking

A block with a “Thinking…” placeholder, corresponding to the custom HTML tag <tg-thinking>. The block may be used only in sendRichMessageDraft, therefore it can't be received in messages. See https://t.me/addemoji/AIActions for examples of custom emoji, which are recommended for usage in the block.

  • ->type() Type of the block, always “thinking”
  • ->text() Text of the block. See https://t.me/addemoji/AIActions for examples of custom emoji, which are recommended for usage in the block.Instance of RichText

RichText

This object represents a rich formatted text. Currently, it can be a Collection of RichTextItem or any of the following types:

RichTextString

This object represents a simple string. The type is NULL

  • ->type() Type of the rich text
  • ->text() The text

RichTextBold

  • ->type() Type of the rich text, always “bold”
  • ->text() The text , instance of RichText

RichTextItalic

  • ->type() Type of the rich text, always “italic”
  • ->text() The text , instance of RichText

RichTextUnderline

  • ->type() Type of the rich text, always “underline”
  • ->text() The text , instance of RichText

RichTextStrikethrough

  • ->type() Type of the rich text, always “strikethrough”
  • ->text() The text , instance of RichText

RichTextSpoiler

  • ->type() Type of the rich text, always “spoiler”
  • ->text() The text , instance of RichText

RichTextDateTime

  • ->type() Type of the rich text, always “date_time”
  • ->text() The text , instance of RichText
  • ->unixTime() The Unix time associated with the entity
  • ->dateTimeFormat() The string that defines the formatting of the date and time. See https://core.telegram.org/bots/api#date-time-entity-formatting

RichTextTextMention

  • ->type() Type of the rich text, always “text_mention”
  • ->text() The text , instance of RichText
  • ->user() The mentioned User

RichTextSubscript

  • ->type() Type of the rich text, always “subscript”
  • ->text() The text , instance of RichText

RichTextSuperscript

  • ->type() Type of the rich text, always “superscript”
  • ->text() The text , instance of RichText

RichTextMarked

  • ->type() Type of the rich text, always “marked”
  • ->text() The text , instance of RichText

RichTextCode

  • ->type() Type of the rich text, always “code”
  • ->text() The text , instance of RichText

RichTextCustomEmoji

  • ->type() Type of the rich text, always “custom_emoji”
  • ->customEmojiId() Unique identifier of the custom emoji
  • ->alternativeText() Alternative emoji for the custom emoji

RichTextMathematicalExpression

  • ->type() Type of the rich text, always “mathematical_expression”
  • ->expression() The expression in LaTeX format

RichTextUrl

  • ->type() Type of the rich text, always “url”
  • ->text() The text , instance of RichText
  • ->url() URL of the link

RichTextEmailAddress

  • ->type() Type of the rich text, always “email_address”
  • ->text() The text , instance of RichText
  • ->emailAddress() The email address

RichTextPhoneNumber

  • ->type() Type of the rich text, always “phone_number”
  • ->text() The text , instance of RichText
  • ->phoneNumber() The phone number

RichTextBankCardNumber

  • ->type() Type of the rich text, always “bank_card_number”
  • ->text() The text , instance of RichText
  • ->bankCardNumber() The bank card number

RichTextMention

  • ->type() Type of the rich text, always “mention”
  • ->text() The text , instance of RichText
  • ->username() The username

RichTextHashtag

  • ->type() Type of the rich text, always “hashtag”
  • ->text() The text , instance of RichText
  • ->hashtag() The hashtag

RichTextCashtag

  • ->type() Type of the rich text, always “cashtag”
  • ->text() The text , instance of RichText
  • ->cashtag() The cashtag

RichTextBotCommand

  • ->type() Type of the rich text, always “bot_command”
  • ->text() The text , instance of RichText
  • ->botCommand() The bot command

RichTextAnchor

  • ->type() Type of the rich text, always “anchor”
  • ->name() The name of the anchor

RichTextAnchorLink

  • ->type() Type of the rich text, always “anchor_link”
  • ->text() The text , instance of RichText
  • ->anchorName() The name of the anchor. If the name is empty, then the link brings back to the top of the message.

RichTextReference

  • ->type() Type of the rich text, always “reference”
  • ->text() The text , instance of RichText
  • ->name() The name of the reference

RichTextReferenceLink

  • ->type() Type of the rich text, always “reference_link”
  • ->text() The text , instance of RichText
  • ->referenceName() The name of the reference

RichBlock Elements

RichBlockCaption

Caption of a rich formatted block.

  • ->text() Block caption, instance of RichText
  • ->credit() Optional. Block credit , instance of RichText

RichBlockTableCell

Cell in a table.

  • ->text() Optional. Text in the cell. If omitted, then the cell is invisible. Instance of RichText
  • ->isHeader() Optional. True, if the cell is a header cell
  • ->colspan() Optional. The number of columns the cell spans if it is bigger than 1
  • ->rowspan() Optional. The number of rows the cell spans if it is bigger than 1
  • ->align() Horizontal cell content alignment. Currently, must be one of “left”, “center”, or “right”.
  • ->valign() Vertical cell content alignment. Currently, must be one of “top”, “middle”, or “bottom”.

RichBlockListItem

An item of a list.

  • ->label() Label of the item
  • ->blocks() The content of the item, array of RichBlock
  • ->hasCheckbox() Optional. True, if the item has a checkbox
  • ->isChecked() Optional. True, if the item has a checked checkbox
  • ->value() Optional. For ordered lists, the numeric value of the item label
  • ->type() Optional. For ordered lists, the type of the item label; must be one of “a” for lowercase letters, “A” for uppercase letters, “i” for lowercase Roman numerals, “I” for uppercase Roman numerals, or “1” for decimal numbers
Suggest a change
Last updated 16 July 2026