Telegram html link api

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

Formatting options

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.

Читайте также:  Java enum equals string
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
Читайте также:  Set array index python

sendMediaGroup

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

sendContact

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

Источник

Ставим правильные ссылки на WhatsApp и Telegram

Поставить ссылку на WhatsApp или Telegram клиенты на первый взгдяд весьма простая задача. Но не все так просто, как может показаться на первый взгляд. Есть несколько нюансов. Погуглив, решил собрать все воедино, дабы использовать в качестве памятки.

Ссылки на WhatsApp

Прямая связь

«Прямая связь» — это функция в WhatsApp, которая позволяет начать чат с человеком, номер которого не сохранен в адресной книге вашего телефона. Вам достаточно знать номер телефона данного человека, и вы можете создать ссылку, которая позволит начать с ним чат. Нажав на ссылку, вы автоматически откроете чат с нужным человеком. Функция «Прямая связь» работает на вашем телефоне и в WhatsApp Web.

Чтобы создать такую ссылку, наберите https://wa.me/[номер] . Вместо [номер] подставьте телефонный номер человека, с которым вы хотите связаться, в полном международном формате. При этом не добавляйте нулей, скобок и тире:

Читайте также:  Относительная ссылка html пример

Где — это номер абонента, например 79202565656.

Шеринг конкретному абоненту

Чтобы создать собственную ссылку с предварительно заполненным сообщением, которое будет автоматически отображаться в текстовом поле чата, используйте https://wa.me/[номер]/?text=[текст] , где [номер] — это номер телефона в полном международном формате, а [текст] — это URL-закодированное предварительно заполненное сообщение:

Где — это номер абонента, например «79202565656», а — это само сообщение, например «Go на карты».

Далее все манипуляция со ссылками на WhatsApp-ресурсы производятся через протокол whatsapp:// и работоспособность НЕ гарантируется (по сосотоянию на 24 сентября 2018 года).

Шеринг с выбором группы (абонента)

Текст, передаваемый в ссылку, должен быть url-кодирован. В примере для этого использована функция urlencode .

Шеринг конкретному абоненту

Где плейсхолдер — это идентификатор абонента.

Насколько мне известно, фичу с ABID прикрыли и из веба вы не получе это значение.

Ссылки на Telegram

Все манипуляция со ссылками на Telegram-ресурсы производятся через протокол tg://

Шеринг с выбором группы (абонента)

Сообщение абоненту из справочника

Параметр работает при условии, что абонент есть в вашем справочнике.

Чат с любым абонентом

Альтернативно ссылки можно попробовать ставить через внешний сервис, которых развелось огромное множество.

Открыть пак со стикерами

Шеринг через Web

Это на тот случай, когда у пользователя не установлен Telegram на устройстве.

Приватное сообщение через Web

RTFM

Источник

Оцените статью