send_rich_message()

async Client.send_rich_message()

Send a rich formatted message.

Usable by Users Bots
Parameters:
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat.

  • rich_text (str | InputRichMessage) – Rich text (Markdown or HTML) to render a styled message, or a whole InputRichMessage describing it. See rich message formatting options for details.

  • parse_mode (ParseMode, optional) – By default, texts are parsed as Markdown. Pass HTML to parse them as HTML instead; the two styles are exclusive and cannot be combined. Ignored when rich_text is an InputRichMessage.

  • media (List of InputRichMessageMedia, optional) – Media the text refers to through tg://photo?id=, tg://video?id= or tg://audio?id= links. Ignored when rich_text is an InputRichMessage.

  • disable_web_page_preview (bool, optional) – Disables link previews for links in this message.

  • disable_notification (bool, optional) – Sends the message silently. Users will receive a notification with no sound.

  • effect_id (int, optional) – Unique identifier of the effect to apply to the message.

  • protect_content (bool, optional) – Pass True to protect the message content from being forwarded.

  • reply_parameters (ReplyParameters, optional) – Description of the reply-to message.

  • reply_markup (InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply, optional) – Additional interface options.

  • message_thread_id (int, optional) – Unique identifier for a message thread in a forum topic.

  • schedule_date (datetime, optional) – Date when the message will be automatically sent.

  • business_connection_id (str, optional) – Unique identifier of the business connection.

  • background (bool, optional) – Send the message in background.

  • clear_draft (bool, optional) – Clear the draft of the chat.

  • update_stickersets_order (bool, optional) – Move the sticker set to the top of the list.

  • send_as (int | str, optional) – Unique identifier (int) or username (str) of the chat or channel to send the message as.

  • quick_reply_shortcut (int, optional) – Unique identifier of the quick reply shortcut to use.

  • repeat_period (int, optional) – Period in seconds for the message to be sent repeatedly.

  • allow_paid_broadcast (bool, optional) – Pay to skip the broadcast flood limit.

  • paid_message_star_count (int, optional) – The number of Telegram Stars the user agreed to pay to send the message.

  • direct_messages_topic_id (int, optional) – Unique identifier of the direct messages topic.

  • suggested_post_parameters (SuggestedPostParameters, optional) – Parameters of the suggested post.

  • show_caption_above_media (bool, optional) – Pass True, if the caption must be shown above the message media.

  • ephemeral_message_parameters (EphemeralMessageParameters, optional) – Send the message as an ephemeral message, visible only to the user it names and absent from the chat’s history, rather than as an ordinary one. The ephemeral RPC has no field for silent, background, clear_draft, schedule_date, repeat_period, send_as, effect_id, quick_reply_shortcut, allow_paid_broadcast, paid_message_star_count, suggested_post_parameters or update_stickersets_order; any of those that is set is logged and dropped.

Returns:

Message – On success, the sent rich message is returned.

Example

# Send a rich formatted message
await app.send_rich_message(chat_id, "**Hello** __world__!")