we received callback about new image что это телефон

Справочник по Bot API

Bot API представляет из себя HTTP-интерфейс для работы с ботами в Telegram.

Подробнее о том, как создать и настроить своего бота, читайте в статье с информацией для разработчиков.

Авторизация бота

Отправка запросов

Допускаются GET и POST запросы. Для передачи параметров в Bot API доступны 4 способа:

Все методы регистрозависимы и должны быть в кодировке UTF-8.

Отправка запросов при получении обновления

Если ваш бот работает через вебхуки, то вы можете осуществить запрос к Bot API одновременно с отправкой ответа на вебхук. Для передачи параметров нужно использовать один из типов:

Примеры таких запросов описаны в FAQ.

Получение обновлений

Существует два диаметрально противоположных по логике способа получать обновления от вашего бота: getUpdates и вебхуки. Входящие обновления будут храниться на сервере до тех пор, пока вы их не обработаете, но не дольше 24 часов.

Независимо от способа получения обновлений, в ответ вы получите объект Update, сериализованный в JSON.

Update

Этот объект представляет из себя входящее обновление. Под обновлением подразумевается действие, совершённое с ботом — например, получение сообщения от пользователя.

Только один из необязательных параметров может присутствовать в каждом обновлении.

ПолеТипОписание
update_idIntegerThe update‘s unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you’re using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order.
messageMessageОпционально. New incoming message of any kind — text, photo, sticker, etc.
inline_queryInlineQueryОпционально. New incoming inline query
chosen_inline_resultChosenInlineResultОпционально. The result of an inline query that was chosen by a user and sent to their chat partner.
callback_queryCallbackQueryОпционально. New incoming callback query

Этот метод используется для получения обновлений через long polling (wiki). Ответ возвращается в виде массива объектов Update.

ПараметрыТипОбязательныйОписание
offsetIntegerНеобязательныйIdentifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten.
limitIntegerНеобязательныйLimits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100.
timeoutIntegerНеобязательныйTimeout in seconds for long polling. Defaults to 0, i.e. usual short polling
Примечание:

Этот метод необходим для задания URL вебхука, на который бот будет отправлять обновления. Каждый раз при получении обновления на этот адрес будет отправлен HTTPS POST с сериализованным в JSON объектом Update. При неудачном запросе к вашему серверу попытка будет повторена умеренное число раз.

ПараметрыТипОбязательныйОписание
urlStringНетHTTPS url для отправки запросов. Чтобы удалить вебхук, отправьте пустую строку.
certificateInputFileНетЗагрузка публичного ключа для проверки корневого сертификата. Подробнее в разделе про самоподписанные сертификаты.
Примечание:

Содержит информацию о текущем состоянии вебхука.

ПолеТипОписание
urlStringURL вебхука, может быть пустым
has_custom_certificateBooleanTrue, если вебхук использует самозаверенный сертификат
pending_update_countIntegerКоличество обновлений, ожидающих доставки
last_error_dateIntegerОпционально. Unix-время самой последней ошибки доставки обновления на указанный вебхук
last_error_messageStringОпционально. Описание в человекочитаемом формате последней ошибки доставки обновления на указанный вебхук

Все типы, использующиеся в Bot API, являются JSON-объектами.

Для хранения всех полей типа Integer безопасно использовать 32-битные знаковые целые числа, если не указано иначе.

Необязательные поля могут быть опущены в ответе, если они не относятся к ответу.

Этот объект представляет бота или пользователя Telegram.

ПолеТипОписание
idIntegerУникальный идентификатор пользователя или бота
first_nameStringИмя бота или пользователя
last_nameStringОпционально. Фамилия бота или пользователя
usernameStringОпционально. Username пользователя или бота

Этот объект представляет собой чат.

ПолеТипОписание
idIntegerУникальный идентификатор чата. Абсолютное значение не превышает 1e13
typeEnumТип чата: “private”, “group”, “supergroup” или “channel”
titleStringОпционально. Название, для каналов или групп
usernameStringОпционально. Username, для чатов и некоторых каналов
first_nameStringОпционально. Имя собеседника в чате
last_nameStringОпционально. Фамилия собеседника в чате
all_members_are_administratorsBooleanОпционально.True, если все участники чата являются администраторами

Этот объект представляет собой сообщение.

ПолеТипОписание
message_idIntegerУникальный идентификатор сообщения
fromUserОпционально. Отправитель. Может быть пустым в каналах.
dateIntegerДата отправки сообщения (Unix time)
chatChatДиалог, в котором было отправлено сообщение
forward_fromUserОпционально. Для пересланных сообщений: отправитель оригинального сообщения
forward_dateIntegerОпционально. Для пересланных сообщений: дата отправки оригинального сообщения
reply_to_messageMessageОпционально. Для ответов: оригинальное сообщение. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
textStringОпционально. Для текстовых сообщений: текст сообщения, 0-4096 символов
entitiesМассив из MessageEntityОпционально. Для текстовых сообщений: особые сущности в тексте сообщения.
audioAudioОпционально. Информация об аудиофайле
documentDocumentОпционально. Информация о файле
photoМассив из PhotoSizeОпционально. Доступные размеры фото
stickerStickerОпционально. Информация о стикере
videoVideoОпционально. Информация о видеозаписи
voiceVoiceОпционально. Информация о голосовом сообщении
captionStringОпционально. Подпись к файлу, фото или видео, 0-200 символов
contactContactОпционально. Информация об отправленном контакте
locationLocationОпционально. Информация о местоположении
venueVenueОпционально. Информация о месте на карте
new_chat_memberUserОпционально. Информация о пользователе, добавленном в группу
left_chat_memberUserОпционально. Информация о пользователе, удалённом из группы
new_chat_titleStringОпционально. Название группы было изменено на это поле
new_chat_photoМассив из PhotoSizeОпционально. Фото группы было изменено на это поле
delete_chat_photoTrueОпционально. Сервисное сообщение: фото группы было удалено
group_chat_createdTrueОпционально. Сервисное сообщение: группа создана
supergroup_chat_createdTrueОпционально. Сервисное сообщение: супергруппа создана
channel_chat_createdTrueОпционально. Сервисное сообщение: канал создан
migrate_to_chat_idIntegerОпционально. Группа была преобразована в супергруппу с указанным идентификатором. Не превышает 1e13
migrate_from_chat_idIntegerОпционально. Cупергруппа была создана из группы с указанным идентификатором. Не превышает 1e13
pinned_messageMessageОпционально. Указанное сообщение было прикреплено. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.

Этот объект представляет одну из особых сущностей в текстовом сообщении. Например: хештеги, имена пользователей, ссылки итд.

ПолеТипОписание
typeStringType of the entity. One of mention ( @username ), hashtag, bot_command, url, email, bold (bold text), italic (italic text), code (monowidth string), pre (monowidth block), text_link (for clickable text URLs)
offsetIntegerOffset in UTF-16 code units to the start of the entity
lengthIntegerLength of the entity in UTF-16 code units
urlStringОпционально. For “text_link” only, url that will be opened after user taps on the text

Этот объект представляет изображение определённого размера или превью файла / стикера.

ПолеТипОписание
file_idStringУникальный идентификатор файла
widthIntegerPhoto width
heightIntegerPhoto height
file_sizeIntegerОпционально. Размер файла

Этот объект представляет аудиозапись, которую клиенты Telegram воспинимают как музыкальный трек.

ПолеТипОписание
file_idStringУникальный идентификатор файла
durationIntegerDuration of the audio in seconds as defined by sender
performerStringОпционально. Performer of the audio as defined by sender or by audio tags
titleStringОпционально. Title of the audio as defined by sender or by audio tags
mime_typeStringОпционально. MIME файла, заданный отправителем
file_sizeIntegerОпционально. Размер файла

Этот объект представляет файл, не являющийся фотографией, голосовым сообщением или аудиозаписью.

ПолеТипОписание
file_idStringUnique file identifier
thumbPhotoSizeОпционально. Document thumbnail as defined by sender
file_nameStringОпционально. Original filename as defined by sender
mime_typeStringОпционально. MIME файла, заданный отправителем
file_sizeIntegerОпционально. Размер файла

Этот объект представляет стикер.

Этот объект представляет видеозапись.

ПолеТипОписание
file_idStringУникальный идентификатор файла
widthIntegerШирина видео, заданная отправителем
heightIntegerВысота видео, заданная отправителем
durationIntegerПродолжительность видео, заданная отправителем
thumbPhotoSizeОпционально. Превью видео
mime_typeStringОпционально. MIME файла, заданный отправителем
file_sizeIntegerОпционально. Размер файла

Этот объект представляет голосовое сообщение.

ПолеТипОписание
file_idStringУникальный идентификатор файла
durationIntegerПродолжительность аудиофайла, заданная отправителем
mime_typeStringОпционально. MIME-тип файла, заданный отправителем
file_sizeIntegerОпционально. Размер файла

Этот объект представляет контакт с номером телефона.

ПолеТипОписание
phone_numberStringНомер телефона
first_nameStringИмя
last_nameStringОпционально. Фамилия
user_idIntegerОпционально. Идентификатор пользователя в Telegram

Этот объект представляет точку на карте.

ПолеТипОписание
longitudeFloatДолгота, заданная отправителем
latitudeFloatШирота, заданная отправителем

Этот объект представляет объект на карте.

ПолеТипОписание
locationLocationКоординаты объекта
titleStringНазвание объекта
addressStringАдрес объекта
foursquare_idStringОпционально. Идентификатор объекта в Foursquare

Этот объект содержит фотографии профиля пользователя.

ПолеТипОписание
total_countIntegerОбщее число доступных фотографий профиля
photosМассив массивов с объектами PhotoSizeЗапрошенные изображения, каждое в 4 разных размерах.

Максимальный размер файла для скачивания — 20 МБ

ПолеТипОписание
file_idStringУникальный идентификатор файла
file_sizeIntegerОпционально. Размер файла, если известен
file_pathStringОпционально. Расположение файла. Для скачивания воспользуйтейсь ссылкой вида https://api.telegram.org/file/bot /

Этот объект представляет клавиатуру с опциями ответа (см. описание ботов).

Пример: Пользователь отправляет запрос на смену языка бота. Бот отправляет клавиатуру со списком языков, видимую только этому пользователю.

Этот объект представляет одну кнопку в клавиатуре ответа. Для обычных текстовых кнопок этот объект может быть заменён на строку, содержащую текст на кнопке.

Внимание:

Параметры request_contact и request_location будут работать только в версиях Telegram, выпущенных позже 9 апреля 2016 года. Более старые клиенты проигнорируют это поле.

После получения сообщения с этим объектом, приложение Telegram свернёт клавиатуру бота и отобразит стандартную клавиатуру устройства (с буквами). По умолчанию клавиатуры бота отображаются до тех пор, пока не будет принудительно отправлена новая или скрыта старая клавиатура. Исключение составляют одноразовые клавиатуры, которые скрываются сразу после нажатия на какую-либо кнопку (см. ReplyKeyboardMarkup).

ПолеТипОписание
hide_keyboardBooleanУказание клиенту скрыть клавиатуру бота
selectiveBooleanОпционально. Используйте этот параметр, чтобы скрыть клавиатуру только у определённых пользователей. Цели: 1) пользователи, которые были @упомянуты в поле text объекта Message; 2) если сообщения бота является ответом (содержит поле reply_to_message_id), авторы этого сообщения.

Пример: Пользователь голосует в опросе, бот отправляет сообщение с подтверждением и скрывает клавиатуру у этого пользователя, в то время как у всех остальных клавиатура видна.

Этот объект представляет встроенную клавиатуру, которая появляется под соответствующим сообщением.

ПолеТипОписание
inline_keyboardМассив массивов с InlineKeyboardButtonМассив строк, каждая из которых является массивом объектов InlineKeyboardButton.
Внимание:

Эти параметры будут работать только в версиях Telegram, выпущенных позже 9 апреля 2016 года. Более старые клиенты покажут ошибку вместо сообщения.

Этот объект представляет одну кнопку встроенной клавиатуры. Вы обязательно должны задействовать ровно одно опциональное поле.

ПолеТипОписание
textStringТекст на кнопке
urlStringОпционально. URL, который откроется при нажатии на кнопку
callback_dataStringОпционально. Данные, которые будут отправлены в callback_query при нажатии на кнопку
switch_inline_queryStringОпционально. Если этот параметр задан, то при нажатии на кнопку приложение предложит пользователю выбрать любой чат, откроет его и вставит в поле ввода сообщения юзернейм бота и определённый запрос для встроенного режима. Если отправлять пустое поле, то будет вставлен только юзернейм бота.

Примечание: это нужно для того, чтобы быстро переключаться между диалогом с ботом и встроенным режимом с этим же ботом. Особенно полезно в сочетаниями с действиями switch_pm… – в этом случае пользователь вернётся в исходный чат автоматически, без ручного выбора из списка.

switch_inline_query_current_chatStringОпционально. If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat’s input field. Can be empty, in which case only the bot’s username will be inserted.
callback_gameCallbackGameОпционально. Description of the game that will be launched when the user presses the button.

NOTE: This type of button must always be the first button in the first row.

Внимание:

Эти параметры будут работать только в версиях Telegram, выпущенных позже 9 апреля 2016 года. Более старые клиенты покажут ошибку вместо сообщения.

ПолеТипОписание
idStringУникальный идентификатор запроса
fromUserОтправитель
messageMessageОпционально. Сообщение, к которому была привязана вызвавшая запрос кнопка. Обратите внимание: если сообщение слишком старое, содержание сообщения и дата отправки будут недоступны.
inline_message_idStringОпционально. Идентификатор сообщения, отправленного через вашего бота во встроенном режиме
dataStringДанные, связанные с кнопкой. Обратите внимание, что клиенты могут добавлять свои данные в это поле.

Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot‘s message and tapped ’Reply’). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.

ПолеТипОписание
force_replyTrueShows reply interface to the user, as if they manually selected the bot‘s message and tapped ’Reply’
selectiveBooleanОпционально. Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot’s message is a reply (has reply_to_message_id), sender of the original message.
Пример:

A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll:

The last option is definitely more attractive. And if you use ForceReply in your bot‘s questions, it will receive the user’s answers even if it only receives replies, commands and mentions — without any extra work for the user.

Содержит информацию о том, почему запрос не был успешен.

FieldTypeDescription
migrate_to_chat_idIntegerOptional. The group has been migrated to a supergroup with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
retry_afterIntegerOptional. In case of exceeding flood control, the number of seconds left to wait before the request can be repeated

This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser.

There are two ways of sending a file (photo, sticker, audio etc.). If it‘s a new file, you can upload it using multipart/form-data. If the file is already on our servers, you don’t need to reupload it: each file object has a file_id field, you can simply pass this file_id as a parameter instead.

Objects and methods used in the inline mode are described in the Inline mode section.

All methods in the Bot API are case-insensitive. We support GET and POST HTTP methods. Use either URL query string or application/json or application/x-www-form-urlencoded or multipart/form-data for passing parameters in Bot API requests.
On successful call, a JSON-object containing the result will be returned.

A simple method for testing your bot’s auth token. Requires no parameters. Returns basic information about the bot in form of a User object.

Use this method to send text messages. On success, the sent Message is returned.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringYesUnique identifier for the target chat or username of the target channel (in the format @channelusername )
textStringYesText of the message to be sent
parse_modeStringНеобязательныйSend Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot’s message.
disable_web_page_previewBooleanНеобязательныйDisables link previews for links in this message
disable_notificationBooleanНеобязательныйSends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
reply_to_message_idIntegerНеобязательныйIf the message is a reply, ID of the original message
reply_markupInlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReplyНеобязательныйAdditional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to hide reply keyboard or to force a reply from the user.

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:

To use this mode, pass HTML in the parse_mode field when using sendMessage. The following tags are currently supported:

Use this method to forward messages of any kind. On success, the sent Message is returned.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringYesUnique identifier for the target chat or username of the target channel (in the format @channelusername )
from_chat_idInteger or StringYesUnique identifier for the chat where the original message was sent (or channel username in the format @channelusername )
disable_notificationBooleanНеобязательныйSends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
message_idIntegerYesUnique message identifier

Use this method to send photos. On success, the sent Message is returned.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringYesUnique identifier for the target chat or username of the target channel (in the format @channelusername )
photoInputFile or StringYesPhoto to send. You can either pass a file_id as String to resend a photo that is already on the Telegram servers, or upload a new photo using multipart/form-data.
captionStringНеобязательныйPhoto caption (may also be used when resending photos by file_id), 0-200 characters
disable_notificationBooleanНеобязательныйSends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
reply_to_message_idIntegerНеобязательныйIf the message is a reply, ID of the original message
reply_markupInlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReplyНеобязательныйAdditional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to hide reply keyboard or to force a reply from the user.

For sending voice messages, use the sendVoice method instead.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringYesUnique identifier for the target chat or username of the target channel (in the format @channelusername )
audioInputFile or StringYesAudio file to send. You can either pass a file_id as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data.
captionIntegerНеобязательныйНазвание аудио, 0-200 символов
durationIntegerНеобязательныйDuration of the audio in seconds
performerStringНеобязательныйPerformer
titleStringНеобязательныйTrack name
disable_notificationBooleanНеобязательныйSends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
reply_to_message_idIntegerНеобязательныйIf the message is a reply, ID of the original message
reply_markupInlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReplyНеобязательныйAdditional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to hide reply keyboard or to force a reply from the user.

Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringYesUnique identifier for the target chat or username of the target channel (in the format @channelusername )
documentInputFile or StringYesFile to send. You can either pass a file_id as String to resend a file that is already on the Telegram servers, or upload a new file using multipart/form-data.
captionStringНеобязательныйDocument caption (may also be used when resending documents by file_id), 0-200 characters
disable_notificationBooleanНеобязательныйSends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
reply_to_message_idIntegerНеобязательныйIf the message is a reply, ID of the original message
reply_markupInlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReplyНеобязательныйAdditional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to hide reply keyboard or to force a reply from the user.
ПараметрыТипОбязательныйОписание
chat_idInteger or StringYesUnique identifier for the target chat or username of the target channel (in the format @channelusername )
stickerInputFile or StringYesSticker to send. You can either pass a file_id as String to resend a sticker that is already on the Telegram servers, or upload a new sticker using multipart/form-data.
disable_notificationBooleanНеобязательныйSends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
reply_to_message_idIntegerНеобязательныйIf the message is a reply, ID of the original message
reply_markupInlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReplyНеобязательныйAdditional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to hide reply keyboard or to force a reply from the user.

Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringYesUnique identifier for the target chat or username of the target channel (in the format @channelusername )
videoInputFile or StringYesVideo to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.
durationIntegerНеобязательныйDuration of sent video in seconds
widthIntegerНеобязательныйVideo width
heightIntegerНеобязательныйVideo height
captionStringНеобязательныйVideo caption (may also be used when resending videos by file_id), 0-200 characters
disable_notificationBooleanНеобязательныйSends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
reply_to_message_idIntegerНеобязательныйIf the message is a reply, ID of the original message
reply_markupInlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReplyНеобязательныйAdditional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to hide reply keyboard or to force a reply from the user.
ПараметрыТипОбязательныйОписание
chat_idInteger or StringYesUnique identifier for the target chat or username of the target channel (in the format @channelusername )
voiceInputFile or StringYesAudio file to send. You can either pass a file_id as String to resend an audio that is already on the Telegram servers, or upload a new audio file using multipart/form-data.
captionIntegerНеобязательныйНазвание аудиосообщения, 0-200 символов
durationIntegerНеобязательныйDuration of sent audio in seconds
disable_notificationBooleanНеобязательныйSends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
reply_to_message_idIntegerНеобязательныйIf the message is a reply, ID of the original message
reply_markupInlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReplyНеобязательныйAdditional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to hide reply keyboard or to force a reply from the user.

Use this method to send point on the map. On success, the sent Message is returned.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringYesUnique identifier for the target chat or username of the target channel (in the format @channelusername )
latitudeFloat numberYesLatitude of location
longitudeFloat numberYesLongitude of location
disable_notificationBooleanНеобязательныйSends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
reply_to_message_idIntegerНеобязательныйIf the message is a reply, ID of the original message
reply_markupInlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReplyНеобязательныйAdditional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to hide reply keyboard or to force a reply from the user.

Use this method to send information about a venue. On success, the sent Message is returned.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringYesUnique identifier for the target chat or username of the target channel (in the format @channelusername )
latitudeFloat numberYesLatitude of the venue
longitudeFloat numberYesLongitude of the venue
titleStringYesName of the venue
addressStringYesAddress of the venue
foursquare_idStringНеобязательныйFoursquare identifier of the venue
disable_notificationBooleanНеобязательныйSends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
reply_to_message_idIntegerНеобязательныйIf the message is a reply, ID of the original message
reply_markupInlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReplyНеобязательныйAdditional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to hide reply keyboard or to force a reply from the user.

Use this method to send phone contacts. On success, the sent Message is returned.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringYesUnique identifier for the target chat or username of the target channel (in the format @channelusername )
phone_numberStringYesContact’s phone number
first_nameStringYesContact’s first name
last_nameStringНеобязательныйContact’s last name
disable_notificationBooleanНеобязательныйSends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
reply_to_message_idIntegerНеобязательныйIf the message is a reply, ID of the original message
reply_markupInlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardHide or ForceReplyНеобязательныйAdditional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to hide keyboard or to force a reply from the user.

Use this method when you need to tell the user that something is happening on the bot’s side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status).

Пример:

The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use sendChatAction with action = upload_photo. The user will see a “sending photo” status for the bot.

We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringYesUnique identifier for the target chat or username of the target channel (in the format @channelusername )
actionStringYesType of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, upload_document for general files, find_location for location data.

Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.

ПараметрыТипОбязательныйОписание
user_idIntegerYesUnique identifier of the target user
offsetIntegerНеобязательныйSequential number of the first photo to be returned. By default, all photos are returned.
limitIntegerНеобязательныйLimits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.
ПараметрыТипОбязательныйОписание
file_idStringYesFile identifier to get info about

Use this method to kick a user from a group or a supergroup. In the case of supergroups, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the group for this to work. Returns True on success.

Внимание:

This will method only work if the ‘All Members Are Admins’ setting is off in the target group. Otherwise members may only be removed by the group’s creator or by the member that added them.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringYesUnique identifier for the target group or username of the target supergroup (in the format @supergroupusername )
user_idIntegerYesUnique identifier of the target user

Use this method to unban a previously kicked user in a supergroup. The user will not return to the group automatically, but will be able to join via link, etc. The bot must be an administrator in the group for this to work. Returns True on success.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringYesUnique identifier for the target group or username of the target supergroup (in the format @supergroupusername )
user_idIntegerYesUnique identifier of the target user

Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.

ПараметрыТипОбязательныйОписание
callback_query_idStringYesUnique identifier for the query to be answered
textStringНеобязательныйText of the notification. If not specified, nothing will be shown to the user
show_alertBooleanНеобязательныйIf true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false.
urlStringНеобязательныйURL, который будет открыт у пользователя. Если вы создали игру, приняв условия @Botfather, укажите адрес, на котором расположена ваша игра. Учтите, что это будет работать только если запрос исходит от кнопки callback_game.
В остальных случаях вы можете использовать параметр для создания ссылок вида telegram.me/your_bot?start=XXXX

Methods and objects used in the inline mode are described in the Inline mode section.

The following methods allow you to change an existing message in the message history instead of sending a new one with a result of an action. This is most useful for messages with inline keyboards using callback queries, but can also help reduce clutter in conversations with regular chat bots.

Please note, that it is currently only possible to edit messages without reply_markup or with inline keyboards.

Use this method to edit text messages sent by the bot or via the bot (for inline bots). On success, the edited Message is returned.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringNoRequired if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername )
message_idIntegerNoRequired if inline_message_id is not specified. Unique identifier of the sent message
inline_message_idStringNoRequired if chat_id and message_id are not specified. Identifier of the inline message
textStringYesNew text of the message
parse_modeStringНеобязательныйSend Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot’s message.
disable_web_page_previewBooleanНеобязательныйDisables link previews for links in this message
reply_markupInlineKeyboardMarkupНеобязательныйA JSON-serialized object for an inline keyboard.

Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). On success, the edited Message is returned.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringNoRequired if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername )
message_idIntegerNoRequired if inline_message_id is not specified. Unique identifier of the sent message
inline_message_idStringNoRequired if chat_id and message_id are not specified. Identifier of the inline message
captionStringНеобязательныйNew caption of the message
reply_markupInlineKeyboardMarkupНеобязательныйA JSON-serialized object for an inline keyboard.

Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). On success, the edited Message is returned.

ПараметрыТипОбязательныйОписание
chat_idInteger or StringNoRequired if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername )
message_idIntegerNoRequired if inline_message_id is not specified. Unique identifier of the sent message
inline_message_idStringNoRequired if chat_id and message_id are not specified. Identifier of the inline message
reply_markupInlineKeyboardMarkupНеобязательныйA JSON-serialized object for an inline keyboard.

The following methods and objects allow your bot to work in inline mode.
Please see our Introduction to Inline bots for more details.

To enable this option, send the /setinline command to @BotFather and provide the placeholder text that the user will see in the input field after typing your bot’s name.

This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.

ПолеТипОписание
idStringUnique identifier for this query
fromUserSender
locationLocationОпционально. Sender location, only for bots that request user location
queryStringText of the query
offsetStringOffset of the results to be returned, can be controlled by the bot

Use this method to send answers to an inline query. On success, True is returned.
No more than 50 results per query are allowed.

ПараметрыТипОбязательныйОписание
inline_query_idStringYesUnique identifier for the answered query
resultsArray of InlineQueryResultYesA JSON-serialized array of results for the inline query
cache_timeIntegerНеобязательныйThe maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.
is_personalBooleanНеобязательныйPass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query
next_offsetStringНеобязательныйPass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes.
switch_pm_textStringНеобязательныйIf passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter
switch_pm_parameterStringНеобязательныйParameter for the start message sent to the bot when user presses the switch button

Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a ‘Connect your YouTube account’ button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an oauth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot’s inline capabilities.

This object represents one result of an inline query. Telegram clients currently support results of the following 19 types:

Represents a link to an article or web page.

ПолеТипОписание
typeStringType of the result, must be article
idStringUnique identifier for this result, 1-64 Bytes
titleStringTitle of the result
input_message_contentInputMessageContentContent of the message to be sent
reply_markupInlineKeyboardMarkupОпционально. Inline keyboard attached to the message
urlStringОпционально. URL of the result
hide_urlBooleanОпционально. Pass True, if you don’t want the URL to be shown in the message
descriptionStringОпционально. Short description of the result
thumb_urlStringОпционально. Url of the thumbnail for the result
thumb_widthIntegerОпционально. Thumbnail width
thumb_heightIntegerОпционально. Thumbnail height

Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.

ПолеТипОписание
typeStringType of the result, must be photo
idStringUnique identifier for this result, 1-64 bytes
photo_urlStringA valid URL of the photo. Photo must be in jpeg format. Photo size must not exceed 5MB
thumb_urlStringURL of the thumbnail for the photo
photo_widthIntegerОпционально. Width of the photo
photo_heightIntegerОпционально. Height of the photo
titleStringОпционально. Title for the result
descriptionStringОпционально. Short description of the result
captionStringОпционально. Caption of the photo to be sent, 0-200 characters
reply_markupInlineKeyboardMarkupОпционально. Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the photo

Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.

ПолеТипОписание
typeStringType of the result, must be gif
idStringUnique identifier for this result, 1-64 bytes
gif_urlStringA valid URL for the GIF file. Размер файла must not exceed 1MB
gif_widthIntegerОпционально. Width of the GIF
gif_heightIntegerОпционально. Height of the GIF
thumb_urlStringURL of the static thumbnail for the result (jpeg or gif)
titleStringОпционально. Title for the result
captionStringОпционально. Caption of the GIF file to be sent, 0-200 characters
reply_markupInlineKeyboardMarkupОпционально. Inline keyboard attached to the message
input_message_contentinputMessageContentОпционально. Content of the message to be sent instead of the GIF animation

Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.

ПолеТипОписание
typeStringType of the result, must be mpeg4_gif
idStringUnique identifier for this result, 1-64 bytes
mpeg4_urlStringA valid URL for the MP4 file. Размер файла must not exceed 1MB
mpeg4_widthIntegerОпционально. Video width
mpeg4_heightIntegerОпционально. Video height
thumb_urlStringURL of the static thumbnail (jpeg or gif) for the result
titleStringОпционально. Title for the result
captionStringОпционально. Caption of the MPEG-4 file to be sent, 0-200 characters
reply_markupInlineKeyboardMarkupОпционально. Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the video animation

Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.

ПолеТипОписание
typeStringType of the result, must be video
idStringUnique identifier for this result, 1-64 bytes
video_urlStringA valid URL for the embedded video player or video file
mime_typeStringMime type of the content of video url, “text/html” or “video/mp4”
thumb_urlStringURL of the thumbnail (jpeg only) for the video
titleStringTitle for the result
captionStringОпционально. Caption of the video to be sent, 0-200 characters
video_widthIntegerОпционально. Video width
video_heightIntegerОпционально. Video height
video_durationIntegerОпционально. Video duration in seconds
descriptionStringОпционально. Short description of the result
reply_markupInlineKeyboardMarkupОпционально. Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the video

Represents a link to an mp3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.

ПолеТипОписание
typeStringType of the result, must be audio
idStringUnique identifier for this result, 1-64 bytes
audio_urlStringA valid URL for the audio file
titleStringTitle
captionIntegerНеобязательныйНазвание аудио, 0-200 символов
performerStringОпционально. Performer
audio_durationIntegerОпционально. Audio duration in seconds
reply_markupInlineKeyboardMarkupОпционально. Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the audio

Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.

ПолеТипОписание
typeStringType of the result, must be voice
idStringUnique identifier for this result, 1-64 bytes
voice_urlStringA valid URL for the voice recording
titleStringRecording title
captionIntegerНеобязательныйНазвание голосового сообщения, 0-200 символов
voice_durationIntegerОпционально. Recording duration in seconds
reply_markupInlineKeyboardMarkupОпционально. Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the voice recording

Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.

Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.

ПолеТипОписание
typeStringType of the result, must be document
idStringUnique identifier for this result, 1-64 bytes
titleStringTitle for the result
captionStringОпционально. Caption of the document to be sent, 0-200 characters
document_urlStringA valid URL for the file
mime_typeStringMime type of the content of the file, either “application/pdf” or “application/zip”
descriptionStringОпционально. Short description of the result
reply_markupInlineKeyboardMarkupОпционально. Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the file
thumb_urlStringОпционально. URL of the thumbnail (jpeg only) for the file
thumb_widthIntegerОпционально. Thumbnail width
thumb_heightIntegerОпционально. Thumbnail height

Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.

Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.

ПолеТипОписание
typeStringType of the result, must be location
idStringUnique identifier for this result, 1-64 Bytes
latitudeFloat numberLocation latitude in degrees
longitudeFloat numberLocation longitude in degrees
titleStringLocation title
reply_markupInlineKeyboardMarkupОпционально. Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the location
thumb_urlStringОпционально. Url of the thumbnail for the result
thumb_widthIntegerОпционально. Thumbnail width
thumb_heightIntegerОпционально. Thumbnail height

Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.

Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.

ПолеТипОписание
typeStringType of the result, must be venue
idStringUnique identifier for this result, 1-64 Bytes
latitudeFloatLatitude of the venue location in degrees
longitudeFloatLongitude of the venue location in degrees
titleStringTitle of the venue
addressStringAddress of the venue
foursquare_idStringОпционально. Foursquare identifier of the venue if known
reply_markupInlineKeyboardMarkupОпционально. Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the venue
thumb_urlStringОпционально. Url of the thumbnail for the result
thumb_widthIntegerОпционально. Thumbnail width
thumb_heightIntegerОпционально. Thumbnail height

Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.

Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.

ПолеТипОписание
typeStringType of the result, must be contact
idStringUnique identifier for this result, 1-64 Bytes
phone_numberStringContact’s phone number
first_nameStringContact’s first name
last_nameStringОпционально. Contact’s last name
reply_markupInlineKeyboardMarkupОпционально. Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the contact
thumb_urlStringОпционально. Url of the thumbnail for the result
thumb_widthIntegerОпционально. Thumbnail width
thumb_heightIntegerОпционально. Thumbnail height

Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.

Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.

ПолеТипОписание
typeStringType of the result, must be photo
idStringUnique identifier for this result, 1-64 bytes
photo_file_idStringA valid file identifier of the photo
titleStringОпционально. Title for the result
descriptionStringОпционально. Short description of the result
captionStringОпционально. Caption of the photo to be sent, 0-200 characters
reply_markupInlineKeyboardMarkupОпционально. Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the photo

Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.

ПолеТипОписание
typeStringType of the result, must be gif
idStringUnique identifier for this result, 1-64 bytes
gif_file_idStringA valid file identifier for the GIF file
titleStringОпционально. Title for the result
captionStringОпционально. Caption of the GIF file to be sent, 0-200 characters
reply_markupInlineKeyboardMarkupОпционально. An Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the GIF animation

Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.

ПолеТипОписание
typeStringType of the result, must be mpeg4_gif
idStringUnique identifier for this result, 1-64 bytes
mpeg4_file_idStringA valid file identifier for the MP4 file
titleStringОпционально. Title for the result
captionStringОпционально. Caption of the MPEG-4 file to be sent, 0-200 characters
reply_markupInlineKeyboardMarkupОпционально. An Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the video animation

Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.

ПолеТипОписание
typeStringType of the result, must be sticker
idStringUnique identifier for this result, 1-64 bytes
sticker_file_idStringA valid file identifier of the sticker
reply_markupInlineKeyboardMarkupОпционально. An Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the sticker

Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.

Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only pdf-files and zip archives can be sent using this method.

ПолеТипОписание
typeStringType of the result, must be document
idStringUnique identifier for this result, 1-64 bytes
titleStringTitle for the result
document_file_idStringA valid file identifier for the file
descriptionStringОпционально. Short description of the result
captionStringОпционально. Caption of the document to be sent, 0-200 characters
reply_markupInlineKeyboardMarkupОпционально. An Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the file

Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.

Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.

ПолеТипОписание
typeStringType of the result, must be video
idStringUnique identifier for this result, 1-64 bytes
video_file_idStringA valid file identifier for the video file
titleStringTitle for the result
descriptionStringОпционально. Short description of the result
captionStringОпционально. Caption of the video to be sent, 0-200 characters
reply_markupInlineKeyboardMarkupОпционально. An Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the video

Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.

ПолеТипОписание
typeStringType of the result, must be voice
idStringUnique identifier for this result, 1-64 bytes
voice_file_idStringA valid file identifier for the voice message
titleStringVoice message title
captionIntegerНеобязательныйНазвание аудиосообщения, 0-200 символов
reply_markupInlineKeyboardMarkupОпционально. An Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the voice message

Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.

Represents a link to an mp3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.

ПолеТипОписание
typeStringType of the result, must be audio
idStringUnique identifier for this result, 1-64 bytes
captionIntegerНеобязательныйНазвание аудио, 0-200 символов
audio_file_idStringA valid file identifier for the audio file
reply_markupInlineKeyboardMarkupОпционально. An Inline keyboard attached to the message
input_message_contentInputMessageContentОпционально. Content of the message to be sent instead of the audio

Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.

This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 4 types:

Represents the content of a text message to be sent as the result of an inline query.

ПолеТипОписание
message_textStringText of the message to be sent, 1-4096 characters
parse_modeStringОпционально. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot’s message.
disable_web_page_previewBooleanОпционально. Disables link previews for links in the sent message

Represents the content of a location message to be sent as the result of an inline query.

ПолеТипОписание
latitudeFloatLatitude of the location in degrees
longitudeFloatLongitude of the location in degrees

Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.

Represents the content of a venue message to be sent as the result of an inline query.

ПолеТипОписание
latitudeFloatLatitude of the venue in degrees
longitudeFloatLongitude of the venue in degrees
titleStringName of the venue
addressStringAddress of the venue
foursquare_idStringОпционально. Foursquare identifier of the venue, if known

Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.

Represents the content of a contact message to be sent as the result of an inline query.

ПолеТипОписание
phone_numberStringContact’s phone number
first_nameStringContact’s first name
last_nameStringОпционально. Contact’s last name

Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.

Represents a result of an inline query that was chosen by the user and sent to their chat partner.

ПолеТипОписание
result_idStringThe unique identifier for the result that was chosen
fromUserThe user that chose the result
locationLocationОпционально. Sender location, only for bots that require user location
inline_message_idStringОпционально. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message.
queryStringThe query that was used to obtain the result

Боты теперь умеют предоставлять пользователям возможность поиграть в HTML5-игры. Создать игру можно при помощи бота @BotFather и команды /newgame. Обратите внимание, что для создания игры вам нужно принять соглашение.

Этот метод используется для отправки игры в виде обычного сообщения. В случае успеха возвращает объект с отправленным сообщением Message.

ПараметрыТипОбязательный?Описание
chat_idInteger или StringДаУникальный идентификатор целевого чата или юзернейм целевого канала (в формате @channelusername )
game_short_nameStringДаКороткое название игры, служит уникальным идентификатором игры. Задаётся в Botfather.
disable_notificationBooleanOptionalSends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.
reply_to_message_idIntegerНетЕсли сообщение является ответом, ID оригинального сообщения
reply_markupInlineKeyboardMarkup или ReplyKeyboardMarkup или ReplyKeyboardHide или ForceReplyНетДополнительные параметры интерфейса. Сериализованные в JSON встроенные клавиатуры, обычные клавиатуры, инструкция скрыть клавиатуру или принудительного ответа.

Этот объект представляет собой игру.

ПолеТипОписание
titleStringНазвание игры
descriptionStringОписание игры
photoМассив объектов PhotoSizeИзображение, которое будет показываться в качестве обложки игры.
textStringОпционально. Краткое описание игры или таблицы рекордов в сообщении с игрой. Может быть автоматически отредактировано, чтобы показывать текущую таблицу рекордов для игры при вызове ботом метода setGameScore, или ручном редактировании методом editMessageText. 0-4096 символов.
text_entitiesМассив объектов MessageEntityОпционально. Сущности в сообщении, типа имён пользователей, ссылок, команд и т. д.
animationAnimationОпционально. Анимация, которая будет показана в опиании игры в сообщении.

Чтобы сообщение с игрой выглядело более привлекательно, вы можете загрузить для игры анимацию с геймплее. Этот объект представляет собой файл анимации, который будет отображён в сообщении с игрой.

ПолеТипОписание
file_idStringУникальный идентификатор файла
thumbPhotoSizeОпционально. Превью анимации, заданное отправителем
file_nameStringОпционально. Название файла анимации, заданное отправителем
mime_typeStringОпционально. MIME-тип файла анимации, заданное отправителем
file_sizeIntegerОпционально. Размер файла/td>

Заглушка, пока не содержит никакой информации.

Используйте этот метод, чтобы обновить игровой счёт определённого пользователя. Если сообщение было отправлено ботом, вернёт отредактированное сообщение Message, иначе True. Вернёт ошибку, если вы попытаетесь установить новый счёт меньше, чем текущий.

ПараметрыТипОбязательный?Описание
user_idIntegerДаИдентификатор пользователя
scoreIntegerДаНовый счёт, больше нуля
chat_idInteger или StringНетНеобходим, если не указан inline_message_id. Уникальный идентификатор чата или имя пользователя канала (в формате @channelusername ).
message_idIntegerНетНеобходим, если не указан inline_message_id. Уникальный идентификатор отправленного сообщения
inline_message_idStringНетНеобходим, если не указан chat_id или inline_message_id. Идентификатор встроенного сообщения
edit_messageBooleanНетПередайте True, чтобы в сообщение была автоматически встроена таблица рекордов

Используйте этот метод, чтобы получить данные для таблицы рекордов. Этот метод возвращает счёт указанного пользователя и нескольких его соседей по таблице. В случает успеха вернёт массив объектов GameHighScore.

На текущий момент этот метод возвращает счёт пользователя и двух его ближайших соседей сверху и снизу. Кроме того вернёт топ-3 результатов, если запрошенный пользователь не находится среди них.
В ближайшем будущем количество отдаваемых данных будет изменено.

ПараметрыТипОбязательный?Описание
user_idIntegerДаИдентификатор пользователя
chat_idInteger или StringНетНеобходим, если не указан inline_message_id. Уникальный идентификатор чата или имя пользователя канала (в формате @channelusername ).
message_idIntegerНетНеобходим, если не указан inline_message_id. Уникальный идентификатор отправленного сообщения
inline_message_idStringНетНеобходим, если не указан chat_id или inline_message_id. Идентификатор встроенного сообщения

Этот объект представляет собой один из рядов таблицы рекордов игры.

ПолеТипОписание
positionIntegerМесто в таблице результатов
userUserПользователь
scoreIntegerСчёт

Сайт про Telegram на русском (неофициальный).

Здесь собраны приложения на базе MTProto, переведена некоторая документация с официального сайта, а также работает Webogram.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *