Bot API 5.6
This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
Field | Type | Description |
type | String | Type of the entity. Currently, can be “mention” ( @username ), “hashtag” ( #hashtag ), “cashtag” ( $USD ), “bot_command” ( /start@jobs_bot ), “url” ( https://telegram.org ), “email” ( do-not-reply@telegram.org ), “phone_number” ( +1-212-555-0123 ), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames) |
sendMessage
Use this method to send text messages. On success, the sent Message is returned.
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of sent messages from forwarding and saving |
The Bot API supports basic formatting for messages. You can use bold, italic, underlined, strikethrough, and spoiler text, as well as inline links and pre-formatted code in your bots’ messages. Telegram clients will render them accordingly. You can use either markdown-style or HTML-style formatting.
Message entities can be nested, providing following restrictions are met:
— If two entities have common characters then one of them is fully contained inside another.
— bold, italic, underline, strikethrough, and spoiler entities can contain and can be part of any other entities, except pre and code.
— All other entities can’t contain each other.
MarkdownV2 style
To use this mode, pass MarkdownV2 in the parse_mode field. Use the following syntax in your message:
*bold \*text* _italic \*text_ __underline__ ~strikethrough~ ||spoiler|| *bold _italic bold ~italic bold strikethrough ||italic bold strikethrough spoiler||~ __underline italic bold___ bold*
HTML style
To use this mode, pass HTML in the parse_mode field. The following tags are currently supported:
bold, bold italic, italic underline, underline strikethrough, strikethrough, strikethrough italic bold italic bold strikethrough underline italic bold bold
forwardMessage
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the forwarded message from forwarding and saving |
copyMessage
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
sendPhoto
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
sendAudio
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
sendDocument
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
sendVideo
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
sendAnimation
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
sendVoice
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
sendVideoNote
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent messages from forwarding and saving |
sendLocation
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
sendVenue
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
sendPoll
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
sendDice
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding |
sendSticker
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
sendInvoice
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
sendGame
Parameter | Type | Required | Description |
protect_content | Boolean | Optional | Protects the contents of the sent message from forwarding and saving |
Источник
sendMessage
Use this method to send text messages. On success, the sent Message is returned. See sendMessage official docs for a list of supported parameters and other info.
The Bot API supports basic formatting for messages. You can use bold and italic text, as well as inline links and pre-formatted code in your bots’ messages. Telegram clients will render them accordingly. You can use either markdown-style or HTML-style formatting. Note that Telegram clients will display an alert to the user before opening an inline link (‘Open this link?’ together with the full URL).
To use this mode, pass Markdown in the parse_mode field when using sendMessage. Use the following syntax in your message:
*bold text* _italic text_ [text](URL) `inline fixed-width code` ```pre-formatted fixed-width code block```
To use this mode, pass HTML in the parse_mode field when using sendMessage. The following tags are currently supported:
bold, bold italic, italic inline URL inline fixed-width code
pre-formatted fixed-width code block
📘 Please Note
- Only the tags mentioned above are currently supported.
- Tags must not be nested.
- All < , >and & symbols that are not a part of a tag or an HTML entity must be replaced with the corresponding HTML entities ( < with < , >with > and & with & ).
- All numerical HTML entities are supported.
- The API currently supports only the following named HTML entities: < , >, & and » .
Источник