Чат-бот вместо сайта и мобильного приложения: как бизнесу использовать новые возможности Telegram
Telegram выпустил обновления, которые изменили суть чат-ботов не только в этом мессенджере, но и в целом. Теперь виртуальные помощники способны заменить мобильные приложения и сайты. Рассказываем, как это работает и как компаниям использовать новые возможности.
Команда Telegram не просто подкрутила пару винтиков — по сути, она предложила революционную концепцию. Разработчикам чат-ботов предоставили средства для создания разнообразных интерфейсов на JavaScript. Это означает, что телеграм-боты 2.0 смогут без преувеличения заменить любое мобильное приложение или сайт. Новые функции работают и в веб-версии мессенджера.
Давайте сравним, что умели чат-боты в Telegram до обновлений и какими они могут стать сейчас.
Прежде виртуальные помощники позволяли совершать оплату, могли интегрироваться с любыми CRM-системами, проводить авторизацию пользователей, начислять бонусы за покупки, выдавать купоны, отвечать на вопросы клиентов. Умный ассистент с модулем NLU умел распознавать запросы на естественном языке, а в случае неудачи или отсутствия информации в базе — подключать к задаче оператора.
При этом общаться с ботом можно было только с помощью кнопок или ввода текста, а его интерфейс нельзя было изменить: это всегда был формат диалога, предполагающий вопросы и ответы.
Телеграм-боты нового поколения могут выполнять все те же функции, но это лишь верхушка айсберга. Теперь виртуальный ассистент станет швейцаром, который открывает пользователю двери в любой интерактивный интерфейс. Взаимодействие человека и системы больше не ограничено рамками диалога, а значит компании могут перенести в мессенджер свое мобильное приложение и даже интернет-магазин.
Пример интерфейса можно увидеть в демонстрационном боте @DurgerKingBot.
Теперь в чат-боте можно создать интерактивный каталог с изображениями товаров. Пользователь сможет добавлять продукты в корзину и оплачивать их через Telegram Payments.
При этом дизайн страниц будет выглядеть так же, как в привычном мобильном приложении или в мобильной версии сайта. Разработчикам доступно использование таких же анимаций, как и в интерфейсах для iOS и Android.
Интересная фишка — автоматическая адаптация дизайна под темную или светлую тему, в зависимости от выбора пользователя.
Мы немного поэкспериментировали, чтобы показать вам, как могут выглядеть разные функциональные блоки внутри чат-бота. Навигация стала удобнее для пользователей, плюс появились новые возможности для интерактивов.
Итак, в мессенджер теперь можно перенести, например, мобильное приложение банка, при этом сохранив привычный клиентам интерфейс. Или сделать полноценный интернет-магазин с возможностью пополнять корзину и оплачивать заказы.
FMCG-компании могут реализовать в Telegram интерактивную программу лояльности c провекой чеков и выдачей купонов. А HR-отделам крупных организаций будет удобно использовать обновленных ботов для онбординга или создания корпоративного университета.
Здесь возникает вопрос: а зачем вообще переносить мобильное приложение или сайт в Telegram?
Во-первых, если компания вдруг попадет под санкции, ей не грозит удаление сервиса из GooglePlay или AppStore. Во-вторых, создание интерфейса в Telegram может обойтись заметно дешевле, чем разработка мобильного приложения или сайта.
Кроме того, для обновления функционала пользователю не нужно обновлять приложение: чат-бот автоматически подтянет информацию.
Для компаний, которые активно размещают рекламные сообщения в Telegram, есть отдельная опция: запуск веб-приложений из меню вложений. Это означает, что боты будут предлагать пользователям добавить их иконку в меню, которое открывается нажатием «скрепки». Вот так это выглядит на примере @DurgerKingBot.
Благодаря этой функции клиент сможет запускать бота компании в два клика из любого чата.
До того, как сервис прокачал чат-ботов, у него уже было много преимуществ.
Во-первых, в начале этого года Telegram впервые обошел WhatsApp в России. По данным компании «МегаФон», за первые две недели марта его доля в общем объеме трафика в мессенджерах увеличилась с 48% до 63%.
В это же время доля WhatsApp упала с 48% до 32%. Напомним, что в прошлом году он был безусловным лидером: по информации разных исследований, через него общались от 52 до 82% российских пользователей. Доля Viber остается незначительной, при этом она тоже сократилась — с 5% до 4%.
Во-вторых, WhatsApp принадлежит компании Meta, которая признана экстремистской организацией в России. И хотя его не заблокировали, создание на этой платформе чат-ботов пока под вопросом.
В-третьих, создать виртуального помощника в Telegram проще и быстрее, чем в WhatsApp. Это дает возможность автоматизировать общение с клиентами чуть ли не за неделю.
Если вы все еще сомневаетесь в перспективах Telegram, добавим, что он завоевал лидерство почти во всех уголках России. Согласно тому же исследованию «МегаФона», на конец 2021 года этот сервис был главным средством общения в 55 регионах, а в начале 2022 года — уже в 82. Ежедневная аудитория Telegram с 24 февраля по 15 марта выросла на 46%, с 31 млн человек до 45,5 млн.
Все эти данные показывают, что увеличение количества чат-ботов на этой площадке неизбежен, как и рост уровня сложности таких проектов. Теперь, когда функционал еще шире, создание виртуальных помощников в Telegram дает почти неограниченные возможности. Так что скоро мы будем открывать мессенджер, чтобы перевести деньги с банковской карты, заказать пиццу или даже купить квартиру в новом ЖК.
Если вы хотите знать больше о том, как технологии помогают компаниям расти и совершенствовать процессы, подписывайтесь на наш телеграм-канал «ИИшечная». Там мы публикуем полезные материалы, подборки мировых новостей о развитии искусственного интеллекта и его применении в решении бизнес-задач.
А потом вашу телегу блочат. И колесо сансары делает новый оборот.
Видимо блокировки соц сеток недавние ничему не учат.
Попытки заблокировать уже были, но как-то у успеху не привели) Да и VPN никто не отменял
Я понял о чем вы. Но предсказывать что будет в будущем основываясь на прошлом заранее неверная позиция. Так просто делать нельзя. На ошибках учатся, знаете?
По поводу блокировок. Это может сделать сама телега банхаммером и весь ваш бизнес пойдет к чертям.
Плюс как Павел активно пишет что он не российский бизнесмен, то вполне вероятно в будущем в попытке избежать санкций прикроет лавочку.
По поводу впн, как показали последние события, не особо помогает. Видно падение аудитории в инсте. Нет аудитории, бизнес сосет лапу.
Согласен, но в текущей ситуации никто не может предсказать, что будет дальше. Уйдут одни соц сети/мессенджеры — появятся новые, аудитория сама по себе не исчезнет, а просто перекачует в какой-то другой канал: новый или существующий. Поэтому нужно просто быть антихрупким, так сказать, и подстраиваться под эти изменения. Пока есть какой-то работающий инструмент, его, как мне кажется, нужно по максимуму использовать, заблокируют, нужно искать новый и использовать уже его.
Это так и есть. Да их нужно использовать, но при этом иметь хотя бы небольшой сайт.
И переливать трафик на него с соцсеток. Приучать клиентов делать на нем заказы, собирать емайлы, телефоны.
Это страховка от пожара. Хоть риск и будет, стратегию штанги никто не отменял, хе хе. Объяснять не буду, думаю вы сами знаете что это.
Более менее серьезному бизнесу сайт всегда нужен
Да, заблочат прослушку для всей страны. Пока Дуров устраивает PR акции, что он точно не пёс Путина. Телеграм будет превращаться в супер-апп для выкачки мегатон данных с жителей
где же посадки на основании мегатонн данных?
Если бы вы знали какая идеология у Павла Дурова, вы бы так не писали. Все его технологии в последнее время связаны с максимальной свободой слова, и не только слова. Чтобы государство не могло вмешаться в это. Посмотрите его проект The Open Network.
Посмотрел. Они же вроде отказались от этой идеи официально. Я понимаю что вы написали. Но я бы не верил всему что заявляет Дуров. Слова это мишура, главное поступки.
это телега, кого надо телега.
вангую что из нее будут лепить wechat по-русски, чтоб сразу всё было под надзором — и деньги, и разговоры.
Просто риск есть всегда. И надо думать наперед. Будущее таит в себе столько неожиданного.
Если бы у кого-нибудь спросили, полгода назад, возможно ли что США заморозят резервы РФ. Я думаю что они сказали бы нет.
Верхах сидят люди православные, устраивают библейские сценарии. Вместо яблока — телеграм. Запретят еще больше искушений и скачиваний будет.
Хм,или это уже было пару лет назад? Когда Роскомпозор бегал дырявой сеточкой и ловил телегу
Я уже писал что строить догадки на основе прошлых событий неверно. Может произойти что угодно, с той или иной вероятностью.
Вс связи с последними событиями, это еще более очевидно.
Не знаю что то,а телегу пока ни разу не блочили
"Вместо" плохая затея, чем больше каналов вы используете тем проще клиенту найти вас. Использование одного канала в случае изменения обстоятельств обычно приводит к слезам.
Мобильные приложения для разовых покупок неудобно устанавливать и захламлять телефон. А сделать заказ через бота с удобством на уровне приложения в самый раз
С заменой приложения идея неплохая, главное, чтобы ресурсами это обеспечили. А телега думаю потянет неплохо
На саму телегу нагрузка не сильно ложится. Мы в студии проверили — в случае с Durker King можно открыть отдельно js-сайт, который встроен в окно Телеграм.
Скоро вообще все переедет в Телеграм, будем там и чатиться, и продукты на дом заказывать, и услуги жкх оплачивать, музыку слушать и фильмы смотреть
Хотя большинство из этого списка уже можно там делать.
В Китае вичат уже давно так работает)
В мобильном приложении вы ведь наверное заказываете? Тут по сути аналог мобильного приложения, только его не нужно устанавливать.
хоспаде сайт хостить копейки и при наличии нормальной навигации, даже в статике может быть весьма полезным, пусть и сверстано все будет дубово, но зато информативно.
Вот недавно после апдейта телеги обсуждал с коллегами, а можно ли реально заменить ботом продукт (без сайта и мобильного приложения). Технически — да, будут конечно ограничения по аналитике например, но услуги предоставлять можно. Но лично моя позиция, что у меня все равно нет доверия ко всему где есть название бот и например я бы побоялся давать данные карты для оплаты или какие-то персональные данные типа скана паспорта или типа того, а многим продуктам это нужно. Ну и как-то меньше доверия к компании у которой мало технического стафа который можно увидеть. Я считаю, что как дополнительный канал взаимодействия с клиентом бот это хорошо, но для компании с именем, с которой был уже опыт взаимодействия вне бота. Т.е. как второстепенный канал предоставления услуг — отлично, но как основной канал он будет вызывать меньше доверия, чем тот же сайт.
Ребят, а уже кто-то делал веб-боты? Или только этот пример с бургерами и все?
Почему обновление ботов Telegram — это настоящий прорыв
Внимательные пользователи Telegram знают, что последнее обновление совершило тихую революцию, причем не только внутри мессенджера, но и в Сети в целом. Правда, пока это никто толком не заметил. Но это пока.
Я, естественно, говорю про новые возможности для создания ботов. Вы скажите: «Ну и что? Боты в Telegram были всегда». Но вот в чём дело: с 2015 по апрель 2022 боты хоть и решали множество задач, но интерфейсом напоминали в лучшем случае текстовый квест из 80-ых. Теперь же это полноценный «стор» приложений или, если хотите, метавселенная.
Нововведение даёт возможность создавать интерфейсы на JavaScript. А это значит, что внутри мессенджера можно делать целые мобильные приложения, сайты, игры — вы ограничены только своей фантазией (и своими кодерами). Это, простите за англицизм, game changer.
Демо-бот @DurgerKingBot, сделанный командой мессенджера, уже демонстрирует функциональность условного Glovo (чтоб не обижать игроков российского рынка). И это только начало: через шаг — Сбер и Альфа делают своих ботов на замену удалённых мобильных приложений, через два —условный Epic сделает на их базе казуальную игру, через три — у нас вообще исчезнут какие-либо причины выходить из Telegram. Боты могут закрыть любые потребности для бизнеса, сервисов и медиа.
Я связался с Александром Корсом, создателем конструктора ботов Botmaker, у которого в конце прошлого года брал интервью для своего канала. И на примере своего конструктора он вживую показал, как может выглядеть реализация подобных ботов.
За всю нашу деятельность мы работали исключительно на базе Telegram, и эта стратегия была и остаётся верной.
Задолго до реализации web-интерфейса мы начали создавать чат-боты для разного бизнеса, которые привлекали, возвращали и повышали качество обслуживания их клиентов. Теперь в наши наработки мы будем внедрять web-интерфейс. Кстати, наш сервис уже готов дать коробочные решения для разных ниш, тем самым мы обеспечим бизнес эффективным инструментом.
С приходом web-интерфейса чат-боты станут полноценной заменой приложениям и станут скорее всего основным инструментом для коммуникации с пользователями.
Павел Дуров никогда ещё не был так близок к тому, чтобы стать, по сути, третьей, альтернативной экосистемой, основанной на принципах Telegram — свободе, открытости, удобстве и простоте. В основе этой экосистемы, как и сейчас, будет месседжинг, но вокруг него тут и там будут возникать различные сервисы и возможности на основе новых ботов. Причём с бесшовным переходом от смартфона к десктопу и от приложения к вебу.
А это уже совершенно новый сценарий пользования смартфоном и ПК. Не говорите потом, что я вас не предупреждал.
Справочник по Bot API
Bot API представляет из себя HTTP-интерфейс для работы с ботами в Telegram.
Подробнее о том, как создать и настроить своего бота, читайте в статье с информацией для разработчиков.
Авторизация бота
Каждому боту при создании присваивается уникальный токен вида 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11 . В документации для простоты вместо него будет использоваться <token> . Подробнее о том, как получить или заменить токен для вашего бота, читайте в этой статье.
Отправка запросов
Все запросы к Telegram Bot API должны осуществляться через HTTPS в следующем виде: https://api.telegram.org/bot<token>/НАЗВАНИЕ_МЕТОДА . Например:
Допускаются GET и POST запросы. Для передачи параметров в Bot API доступны 4 способа:
Ответ придёт в виде JSON-объекта, в котором всегда будет булево поле ok и опциональное строковое поле description , содержащее человекочитаемое описание результата. Если поле ok истинно, то запрос прошёл успешно и результат его выполнения можно увидеть в поле result . В случае ошибки поле ok будет равно false , а причины ошибки будут описаны в поле description . Кроме того, в ответе будет целочисленное поле error_code , но коды ошибок будут изменены в будущем.
Все методы регистрозависимы и должны быть в кодировке UTF-8.
Отправка запросов при получении обновления
Если ваш бот работает через вебхуки, то вы можете осуществить запрос к Bot API одновременно с отправкой ответа на вебхук. Для передачи параметров нужно использовать один из типов:
- application/json
- application/x-www-form-urlencoded
- multipart/form-data
Метод для вызова должен быть определён в запросе в поле method . Однако, имейте в виду: невозможно узнать статус и результат такого запроса.
Примеры таких запросов описаны в FAQ.
Получение обновлений
Существует два диаметрально противоположных по логике способа получать обновления от вашего бота: getUpdates и вебхуки. Входящие обновления будут храниться на сервере до тех пор, пока вы их не обработаете, но не дольше 24 часов.
Независимо от способа получения обновлений, в ответ вы получите объект Update, сериализованный в JSON.
Update
Этот объект представляет из себя входящее обновление. Под обновлением подразумевается действие, совершённое с ботом — например, получение сообщения от пользователя.
Только один из необязательных параметров может присутствовать в каждом обновлении.
| Поле | Тип | Описание |
|---|---|---|
| update_id | Integer | The 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. |
| message | Message | Опционально. New incoming message of any kind — text, photo, sticker, etc. |
| inline_query | InlineQuery | Опционально. New incoming inline query |
| chosen_inline_result | ChosenInlineResult | Опционально. The result of an inline query that was chosen by a user and sent to their chat partner. |
| callback_query | CallbackQuery | Опционально. New incoming callback query |
getUpdates
Этот метод используется для получения обновлений через long polling (wiki). Ответ возвращается в виде массива объектов Update.
| Параметры | Тип | Обязательный | Описание |
|---|---|---|---|
| offset | Integer | Необязательный | 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. |
| limit | Integer | Необязательный | Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100. |
| timeout | Integer | Необязательный | Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling |
Примечание:
- Этот метод не будет работать, если у вас уже подключен webhook.
- Во избежания повторяющихся обновлений, рекомендуется высчитывать offset каждый раз заново.
setWebhook
Этот метод необходим для задания URL вебхука, на который бот будет отправлять обновления. Каждый раз при получении обновления на этот адрес будет отправлен HTTPS POST с сериализованным в JSON объектом Update. При неудачном запросе к вашему серверу попытка будет повторена умеренное число раз.
Для большей безопасности рекомендуется включить токен в URL вебхука, например, так: https://yourwebhookserver.com/<token> . Так как никто посторонний не знает вашего токена, вы можете быть уверены, что запросы к вашему вебхуку шлёт именно Telegram.
| Параметры | Тип | Обязательный | Описание |
| url | String | Нет | HTTPS url для отправки запросов. Чтобы удалить вебхук, отправьте пустую строку. |
| certificate | InputFile | Нет | Загрузка публичного ключа для проверки корневого сертификата. Подробнее в разделе про самоподписанные сертификаты. |
Примечание:
- При подключенном и настроенном вебхуке метод getUpdates не будет работать.
- При использовании самоподписанного сертификата, вам необходимо загрузить публичный ключ с помощью параметра certificate .
- На текущий момент отправка обновлений через вебхуки доступна только на эти порты: 443, 80, 88, 8443.
getWebhookInfo
Содержит информацию о текущем состоянии вебхука.
| Поле | Тип | Описание |
| url | String | URL вебхука, может быть пустым |
| has_custom_certificate | Boolean | True, если вебхук использует самозаверенный сертификат |
| pending_update_count | Integer | Количество обновлений, ожидающих доставки |
| last_error_date | Integer | Опционально. Unix-время самой последней ошибки доставки обновления на указанный вебхук |
| last_error_message | String | Опционально. Описание в человекочитаемом формате последней ошибки доставки обновления на указанный вебхук |
Доступные типы
Все типы, использующиеся в Bot API, являются JSON-объектами.
Для хранения всех полей типа Integer безопасно использовать 32-битные знаковые целые числа, если не указано иначе.
Этот объект представляет бота или пользователя Telegram.
| Поле | Тип | Описание |
| id | Integer | Уникальный идентификатор пользователя или бота |
| first_name | String | Имя бота или пользователя |
| last_name | String | Опционально. Фамилия бота или пользователя |
| username | String | Опционально. Username пользователя или бота |
Этот объект представляет собой чат.
| Поле | Тип | Описание |
| id | Integer | Уникальный идентификатор чата. Абсолютное значение не превышает 1e13 |
| type | Enum | Тип чата: “private”, “group”, “supergroup” или “channel” |
| title | String | Опционально. Название, для каналов или групп |
| username | String | Опционально. Username, для чатов и некоторых каналов |
| first_name | String | Опционально. Имя собеседника в чате |
| last_name | String | Опционально. Фамилия собеседника в чате |
| all_members_are_administrators | Boolean | Опционально.True, если все участники чата являются администраторами |
Message
Этот объект представляет собой сообщение.
| Поле | Тип | Описание |
| message_id | Integer | Уникальный идентификатор сообщения |
| from | User | Опционально. Отправитель. Может быть пустым в каналах. |
| date | Integer | Дата отправки сообщения (Unix time) |
| chat | Chat | Диалог, в котором было отправлено сообщение |
| forward_from | User | Опционально. Для пересланных сообщений: отправитель оригинального сообщения |
| forward_date | Integer | Опционально. Для пересланных сообщений: дата отправки оригинального сообщения |
| reply_to_message | Message | Опционально. Для ответов: оригинальное сообщение. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. |
| text | String | Опционально. Для текстовых сообщений: текст сообщения, 0-4096 символов |
| entities | Массив из MessageEntity | Опционально. Для текстовых сообщений: особые сущности в тексте сообщения. |
| audio | Audio | Опционально. Информация об аудиофайле |
| document | Document | Опционально. Информация о файле |
| photo | Массив из PhotoSize | Опционально. Доступные размеры фото |
| sticker | Sticker | Опционально. Информация о стикере |
| video | Video | Опционально. Информация о видеозаписи |
| voice | Voice | Опционально. Информация о голосовом сообщении |
| caption | String | Опционально. Подпись к файлу, фото или видео, 0-200 символов |
| contact | Contact | Опционально. Информация об отправленном контакте |
| location | Location | Опционально. Информация о местоположении |
| venue | Venue | Опционально. Информация о месте на карте |
| new_chat_member | User | Опционально. Информация о пользователе, добавленном в группу |
| left_chat_member | User | Опционально. Информация о пользователе, удалённом из группы |
| new_chat_title | String | Опционально. Название группы было изменено на это поле |
| new_chat_photo | Массив из PhotoSize | Опционально. Фото группы было изменено на это поле |
| delete_chat_photo | True | Опционально. Сервисное сообщение: фото группы было удалено |
| group_chat_created | True | Опционально. Сервисное сообщение: группа создана |
| supergroup_chat_created | True | Опционально. Сервисное сообщение: супергруппа создана |
| channel_chat_created | True | Опционально. Сервисное сообщение: канал создан |
| migrate_to_chat_id | Integer | Опционально. Группа была преобразована в супергруппу с указанным идентификатором. Не превышает 1e13 |
| migrate_from_chat_id | Integer | Опционально. Cупергруппа была создана из группы с указанным идентификатором. Не превышает 1e13 |
| pinned_message | Message | Опционально. Указанное сообщение было прикреплено. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. |
MessageEntity
Этот объект представляет одну из особых сущностей в текстовом сообщении. Например: хештеги, имена пользователей, ссылки итд.
| Поле | Тип | Описание |
| type | String | Type 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) |
| offset | Integer | Offset in UTF-16 code units to the start of the entity |
| length | Integer | Length of the entity in UTF-16 code units |
| url | String | Опционально. For “text_link” only, url that will be opened after user taps on the text |
PhotoSize
Этот объект представляет изображение определённого размера или превью файла / стикера.
| Поле | Тип | Описание |
| file_id | String | Уникальный идентификатор файла |
| width | Integer | Photo width |
| height | Integer | Photo height |
| file_size | Integer | Опционально. Размер файла |
Audio
Этот объект представляет аудиозапись, которую клиенты Telegram воспинимают как музыкальный трек.
| Поле | Тип | Описание |
| file_id | String | Уникальный идентификатор файла |
| duration | Integer | Duration of the audio in seconds as defined by sender |
| performer | String | Опционально. Performer of the audio as defined by sender or by audio tags |
| title | String | Опционально. Title of the audio as defined by sender or by audio tags |
| mime_type | String | Опционально. MIME файла, заданный отправителем |
| file_size | Integer | Опционально. Размер файла |
Document
Этот объект представляет файл, не являющийся фотографией, голосовым сообщением или аудиозаписью.
| Поле | Тип | Описание |
| file_id | String | Unique file identifier |
| thumb | PhotoSize | Опционально. Document thumbnail as defined by sender |
| file_name | String | Опционально. Original filename as defined by sender |
| mime_type | String | Опционально. MIME файла, заданный отправителем |
| file_size | Integer | Опционально. Размер файла |
Sticker
Этот объект представляет стикер.
| Поле | Тип | Описание |
| file_id | String | Уникальный идентификатор файла |
| width | Integer | Ширина стикера |
| height | Integer | Высота стикера |
| thumb | PhotoSize | Опционально. Превью стикера в формате .webp или .jpg |
| file_size | Integer | Опционально. Размер файла |
Video
Этот объект представляет видеозапись.
| Поле | Тип | Описание |
| file_id | String | Уникальный идентификатор файла |
| width | Integer | Ширина видео, заданная отправителем |
| height | Integer | Высота видео, заданная отправителем |
| duration | Integer | Продолжительность видео, заданная отправителем |
| thumb | PhotoSize | Опционально. Превью видео |
| mime_type | String | Опционально. MIME файла, заданный отправителем |
| file_size | Integer | Опционально. Размер файла |
Voice
Этот объект представляет голосовое сообщение.
| Поле | Тип | Описание |
| file_id | String | Уникальный идентификатор файла |
| duration | Integer | Продолжительность аудиофайла, заданная отправителем |
| mime_type | String | Опционально. MIME-тип файла, заданный отправителем |
| file_size | Integer | Опционально. Размер файла |
Contact
Этот объект представляет контакт с номером телефона.
| Поле | Тип | Описание |
| phone_number | String | Номер телефона |
| first_name | String | Имя |
| last_name | String | Опционально. Фамилия |
| user_id | Integer | Опционально. Идентификатор пользователя в Telegram |
Location
Этот объект представляет точку на карте.
| Поле | Тип | Описание |
| longitude | Float | Долгота, заданная отправителем |
| latitude | Float | Широта, заданная отправителем |
Venue
Этот объект представляет объект на карте.
| Поле | Тип | Описание |
| location | Location | Координаты объекта |
| title | String | Название объекта |
| address | String | Адрес объекта |
| foursquare_id | String | Опционально. Идентификатор объекта в Foursquare |
UserProfilePhotos
Этот объект содержит фотографии профиля пользователя.
| Поле | Тип | Описание |
| total_count | Integer | Общее число доступных фотографий профиля |
| photos | Массив массивов с объектами PhotoSize | Запрошенные изображения, каждое в 4 разных размерах. |
Этот объект представляет файл, готовый к загрузке. Он может быть скачан по ссылке вида https://api.telegram.org/file/bot<token>/<file_path> . Ссылка будет действительна как минимум в течение 1 часа. По истечении этого срока она может быть запрошена заново с помощью метода getFile.
| Поле | Тип | Описание |
| file_id | String | Уникальный идентификатор файла |
| file_size | Integer | Опционально. Размер файла, если известен |
| file_path | String | Опционально. Расположение файла. Для скачивания воспользуйтейсь ссылкой вида https://api.telegram.org/file/bot<token>/<file_path> |
ReplyKeyboardMarkup
Этот объект представляет клавиатуру с опциями ответа (см. описание ботов).
KeyboardButton
Этот объект представляет одну кнопку в клавиатуре ответа. Для обычных текстовых кнопок этот объект может быть заменён на строку, содержащую текст на кнопке.
| Поле | Тип | Описание |
| text | String | Текст на кнопке. Если ни одно из опциональных полей не использовано, то при нажатии на кнопку этот текст будет отправлен боту как простое сообщение. |
| request_contact | Boolean | Опционально. Если значение True , то при нажатии на кнопку боту отправится контакт пользователя с его номером телефона. Доступно только в диалогах с ботом. |
| request_location | Boolean | Опционально. Если значение True , то при нажатии на кнопку боту отправится местоположение пользователя. Доступно только в диалогах с ботом. |
Внимание:
ReplyKeyboardHide
После получения сообщения с этим объектом, приложение Telegram свернёт клавиатуру бота и отобразит стандартную клавиатуру устройства (с буквами). По умолчанию клавиатуры бота отображаются до тех пор, пока не будет принудительно отправлена новая или скрыта старая клавиатура. Исключение составляют одноразовые клавиатуры, которые скрываются сразу после нажатия на какую-либо кнопку (см. ReplyKeyboardMarkup).
InlineKeyboardMarkup
Этот объект представляет встроенную клавиатуру, которая появляется под соответствующим сообщением.
| Поле | Тип | Описание |
| inline_keyboard | Массив массивов с InlineKeyboardButton | Массив строк, каждая из которых является массивом объектов InlineKeyboardButton. |
Внимание:
InlineKeyboardButton
Этот объект представляет одну кнопку встроенной клавиатуры. Вы обязательно должны задействовать ровно одно опциональное поле.
Внимание:
CallbackQuery
Этот объект представляет входящий запрос обратной связи от инлайн-кнопки с заданным callback_data .
Если кнопка, создавшая этот запрос, была привязана к сообщению, то в запросе будет присутствовать поле message .
Если кнопка была показана в сообщении, отправленном при помощи встроенного режима, в запросе будет присутствовать поле inline_message_id .
| Поле | Тип | Описание |
| id | String | Уникальный идентификатор запроса |
| from | User | Отправитель |
| message | Message | Опционально. Сообщение, к которому была привязана вызвавшая запрос кнопка. Обратите внимание: если сообщение слишком старое, содержание сообщения и дата отправки будут недоступны. |
| inline_message_id | String | Опционально. Идентификатор сообщения, отправленного через вашего бота во встроенном режиме |
| data | String | Данные, связанные с кнопкой. Обратите внимание, что клиенты могут добавлять свои данные в это поле. |
ForceReply
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_reply | True | Shows reply interface to the user, as if they manually selected the bot‘s message and tapped ’Reply’ |
| selective | Boolean | Опционально. 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. |
Пример:
- Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish.
- Guide the user through a step-by-step process. ‘Please send me your question’, ‘Cool, now let’s add the first answer option‘, ’Great. Keep adding answer options, then send /done when you‘re ready’.
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.
ResponseParameters
Содержит информацию о том, почему запрос не был успешен.
| Field | Type | Description |
| migrate_to_chat_id | Integer | Optional. 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_after | Integer | Optional. In case of exceeding flood control, the number of seconds left to wait before the request can be repeated |
InputFile
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.
Resending files without reuploading
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.
- It is not possible to change the file type when resending by file_id. I.e. a video can’t be sent as a photo, a photo can’t be sent as a document, etc.
- It is not possible to resend thumbnails.
- Resending a photo by file_id will send all of its sizes.
Inline mode objects
Objects and methods used in the inline mode are described in the Inline mode section.
Доступные методы
getMe
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.
sendMessage
Use this method to send text messages. On success, the sent Message is returned.
| Параметры | Тип | Обязательный | Описание |
| chat_id | Integer or String | Yes | Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| text | String | Yes | Text of the message to be sent |
| parse_mode | String | Необязательный | 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_preview | Boolean | Необязательный | Disables link previews for links in this message |
| disable_notification | Boolean | Необязательный | Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. |
| reply_to_message_id | Integer | Необязательный | If the message is a reply, ID of the original message |
| reply_markup | InlineKeyboardMarkup 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. |
Formatting options
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).
Markdown style
To use this mode, pass Markdown in the parse_mode field when using sendMessage. Use the following syntax in your message:
HTML style
To use this mode, pass HTML in the parse_mode field when using sendMessage. The following tags are currently supported:
- 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 " .
forwardMessage
Use this method to forward messages of any kind. On success, the sent Message is returned.
| Параметры | Тип | Обязательный | Описание |
| chat_id | Integer or String | Yes | Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| from_chat_id | Integer or String | Yes | Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername ) |
| disable_notification | Boolean | Необязательный | Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. |
| message_id | Integer | Yes | Unique message identifier |
sendPhoto
Use this method to send photos. On success, the sent Message is returned.
| Параметры | Тип | Обязательный | Описание |
| chat_id | Integer or String | Yes | Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| photo | InputFile or String | Yes | Photo 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. |
| caption | String | Необязательный | Photo caption (may also be used when resending photos by file_id), 0-200 characters |
| disable_notification | Boolean | Необязательный | Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. |
| reply_to_message_id | Integer | Необязательный | If the message is a reply, ID of the original message |
| reply_markup | InlineKeyboardMarkup 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. |
sendAudio
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
For sending voice messages, use the sendVoice method instead.
| Параметры | Тип | Обязательный | Описание |
| chat_id | Integer or String | Yes | Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| audio | InputFile or String | Yes | Audio 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. |
| caption | Integer | Необязательный | Название аудио, 0-200 символов |
| duration | Integer | Необязательный | Duration of the audio in seconds |
| performer | String | Необязательный | Performer |
| title | String | Необязательный | Track name |
| disable_notification | Boolean | Необязательный | Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. |
| reply_to_message_id | Integer | Необязательный | If the message is a reply, ID of the original message |
| reply_markup | InlineKeyboardMarkup 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. |
sendDocument
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_id | Integer or String | Yes | Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| document | InputFile or String | Yes | File 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. |
| caption | String | Необязательный | Document caption (may also be used when resending documents by file_id), 0-200 characters |
| disable_notification | Boolean | Необязательный | Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. |
| reply_to_message_id | Integer | Необязательный | If the message is a reply, ID of the original message |
| reply_markup | InlineKeyboardMarkup 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. |
sendSticker
Use this method to send .webp stickers. On success, the sent Message is returned.
| Параметры | Тип | Обязательный | Описание |
| chat_id | Integer or String | Yes | Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| sticker | InputFile or String | Yes | Sticker 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_notification | Boolean | Необязательный | Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. |
| reply_to_message_id | Integer | Необязательный | If the message is a reply, ID of the original message |
| reply_markup | InlineKeyboardMarkup 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. |
sendVideo
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_id | Integer or String | Yes | Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| video | InputFile or String | Yes | Video 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. |
| duration | Integer | Необязательный | Duration of sent video in seconds |
| width | Integer | Необязательный | Video width |
| height | Integer | Необязательный | Video height |
| caption | String | Необязательный | Video caption (may also be used when resending videos by file_id), 0-200 characters |
| disable_notification | Boolean | Необязательный | Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. |
| reply_to_message_id | Integer | Необязательный | If the message is a reply, ID of the original message |
| reply_markup | InlineKeyboardMarkup 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. |
sendVoice
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
| Параметры | Тип | Обязательный | Описание |
| chat_id | Integer or String | Yes | Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| voice | InputFile or String | Yes | Audio 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. |
| caption | Integer | Необязательный | Название аудиосообщения, 0-200 символов |
| duration | Integer | Необязательный | Duration of sent audio in seconds |
| disable_notification | Boolean | Необязательный | Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. |
| reply_to_message_id | Integer | Необязательный | If the message is a reply, ID of the original message |
| reply_markup | InlineKeyboardMarkup 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. |
sendLocation
Use this method to send point on the map. On success, the sent Message is returned.
| Параметры | Тип | Обязательный | Описание |
| chat_id | Integer or String | Yes | Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| latitude | Float number | Yes | Latitude of location |
| longitude | Float number | Yes | Longitude of location |
| disable_notification | Boolean | Необязательный | Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. |
| reply_to_message_id | Integer | Необязательный | If the message is a reply, ID of the original message |
| reply_markup | InlineKeyboardMarkup 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. |
sendVenue
Use this method to send information about a venue. On success, the sent Message is returned.
| Параметры | Тип | Обязательный | Описание |
| chat_id | Integer or String | Yes | Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| latitude | Float number | Yes | Latitude of the venue |
| longitude | Float number | Yes | Longitude of the venue |
| title | String | Yes | Name of the venue |
| address | String | Yes | Address of the venue |
| foursquare_id | String | Необязательный | Foursquare identifier of the venue |
| disable_notification | Boolean | Необязательный | Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. |
| reply_to_message_id | Integer | Необязательный | If the message is a reply, ID of the original message |
| reply_markup | InlineKeyboardMarkup 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. |
sendContact
Use this method to send phone contacts. On success, the sent Message is returned.
| Параметры | Тип | Обязательный | Описание |
| chat_id | Integer or String | Yes | Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| phone_number | String | Yes | Contact’s phone number |
| first_name | String | Yes | Contact’s first name |
| last_name | String | Необязательный | Contact’s last name |
| disable_notification | Boolean | Необязательный | Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. |
| reply_to_message_id | Integer | Необязательный | If the message is a reply, ID of the original message |
| reply_markup | InlineKeyboardMarkup 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. |
sendChatAction
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).
Пример:
We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.
| Параметры | Тип | Обязательный | Описание |
| chat_id | Integer or String | Yes | Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| action | String | Yes | Type 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. |
getUserProfilePhotos
Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
| Параметры | Тип | Обязательный | Описание |
| user_id | Integer | Yes | Unique identifier of the target user |
| offset | Integer | Необязательный | Sequential number of the first photo to be returned. By default, all photos are returned. |
| limit | Integer | Необязательный | Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100. |
getFile
Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path> , where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
| Параметры | Тип | Обязательный | Описание |
| file_id | String | Yes | File identifier to get info about |
kickChatMember
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.
Внимание:
| Параметры | Тип | Обязательный | Описание |
| chat_id | Integer or String | Yes | Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername ) |
| user_id | Integer | Yes | Unique identifier of the target user |
unbanChatMember
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_id | Integer or String | Yes | Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername ) |
| user_id | Integer | Yes | Unique identifier of the target user |
answerCallbackQuery
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_id | String | Yes | Unique identifier for the query to be answered |
| text | String | Необязательный | Text of the notification. If not specified, nothing will be shown to the user |
| show_alert | Boolean | Необязательный | If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. |
| url | String | Необязательный | URL, который будет открыт у пользователя. Если вы создали игру, приняв условия @Botfather, укажите адрес, на котором расположена ваша игра. Учтите, что это будет работать только если запрос исходит от кнопки callback_game. В остальных случаях вы можете использовать параметр для создания ссылок вида telegram.me/your_bot?start=XXXX |
Inline mode methods
Methods and objects used in the inline mode are described in the Inline mode section.
Updating messages
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.
editMessageText
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_id | Integer or String | No | Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| message_id | Integer | No | Required if inline_message_id is not specified. Unique identifier of the sent message |
| inline_message_id | String | No | Required if chat_id and message_id are not specified. Identifier of the inline message |
| text | String | Yes | New text of the message |
| parse_mode | String | Необязательный | 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_preview | Boolean | Необязательный | Disables link previews for links in this message |
| reply_markup | InlineKeyboardMarkup | Необязательный | A JSON-serialized object for an inline keyboard. |
editMessageCaption
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_id | Integer or String | No | Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| message_id | Integer | No | Required if inline_message_id is not specified. Unique identifier of the sent message |
| inline_message_id | String | No | Required if chat_id and message_id are not specified. Identifier of the inline message |
| caption | String | Необязательный | New caption of the message |
| reply_markup | InlineKeyboardMarkup | Необязательный | A JSON-serialized object for an inline keyboard. |
editMessageReplyMarkup
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_id | Integer or String | No | Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername ) |
| message_id | Integer | No | Required if inline_message_id is not specified. Unique identifier of the sent message |
| inline_message_id | String | No | Required if chat_id and message_id are not specified. Identifier of the inline message |
| reply_markup | InlineKeyboardMarkup | Необязательный | A JSON-serialized object for an inline keyboard. |
Inline-режим
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.
InlineQuery
This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
| Поле | Тип | Описание |
| id | String | Unique identifier for this query |
| from | User | Sender |
| location | Location | Опционально. Sender location, only for bots that request user location |
| query | String | Text of the query |
| offset | String | Offset of the results to be returned, can be controlled by the bot |
answerInlineQuery
Use this method to send answers to an inline query. On success, True is returned.
No more than 50 results per query are allowed.
InlineQueryResult
This object represents one result of an inline query. Telegram clients currently support results of the following 19 types:
InlineQueryResultArticle
Represents a link to an article or web page.
| Поле | Тип | Описание |
| type | String | Type of the result, must be article |
| id | String | Unique identifier for this result, 1-64 Bytes |
| title | String | Title of the result |
| input_message_content | InputMessageContent | Content of the message to be sent |
| reply_markup | InlineKeyboardMarkup | Опционально. Inline keyboard attached to the message |
| url | String | Опционально. URL of the result |
| hide_url | Boolean | Опционально. Pass True, if you don’t want the URL to be shown in the message |
| description | String | Опционально. Short description of the result |
| thumb_url | String | Опционально. Url of the thumbnail for the result |
| thumb_width | Integer | Опционально. Thumbnail width |
| thumb_height | Integer | Опционально. Thumbnail height |
InlineQueryResultPhoto
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.
| Поле | Тип | Описание |
| type | String | Type of the result, must be photo |
| id | String | Unique identifier for this result, 1-64 bytes |
| photo_url | String | A valid URL of the photo. Photo must be in jpeg format. Photo size must not exceed 5MB |
| thumb_url | String | URL of the thumbnail for the photo |
| photo_width | Integer | Опционально. Width of the photo |
| photo_height | Integer | Опционально. Height of the photo |
| title | String | Опционально. Title for the result |
| description | String | Опционально. Short description of the result |
| caption | String | Опционально. Caption of the photo to be sent, 0-200 characters |
| reply_markup | InlineKeyboardMarkup | Опционально. Inline keyboard attached to the message |
| input_message_content | InputMessageContent | Опционально. Content of the message to be sent instead of the photo |
InlineQueryResultGif
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.
| Поле | Тип | Описание |
| type | String | Type of the result, must be gif |
| id | String | Unique identifier for this result, 1-64 bytes |
| gif_url | String | A valid URL for the GIF file. Размер файла must not exceed 1MB |
| gif_width | Integer | Опционально. Width of the GIF |
| gif_height | Integer | Опционально. Height of the GIF |
| thumb_url | String | URL of the static thumbnail for the result (jpeg or gif) |
| title | String | Опционально. Title for the result |
| caption | String | Опционально. Caption of the GIF file to be sent, 0-200 characters |
| reply_markup | InlineKeyboardMarkup | Опционально. Inline keyboard attached to the message |
| input_message_content | inputMessageContent | Опционально. Content of the message to be sent instead of the GIF animation |
InlineQueryResultMpeg4Gif
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.
| Поле | Тип | Описание |
| type | String | Type of the result, must be mpeg4_gif |
| id | String | Unique identifier for this result, 1-64 bytes |
| mpeg4_url | String | A valid URL for the MP4 file. Размер файла must not exceed 1MB |
| mpeg4_width | Integer | Опционально. Video width |
| mpeg4_height | Integer | Опционально. Video height |
| thumb_url | String | URL of the static thumbnail (jpeg or gif) for the result |
| title | String | Опционально. Title for the result |
| caption | String | Опционально. Caption of the MPEG-4 file to be sent, 0-200 characters |
| reply_markup | InlineKeyboardMarkup | Опционально. Inline keyboard attached to the message |
| input_message_content | InputMessageContent | Опционально. Content of the message to be sent instead of the video animation |
InlineQueryResultVideo
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.
| Поле | Тип | Описание |
| type | String | Type of the result, must be video |
| id | String | Unique identifier for this result, 1-64 bytes |
| video_url | String | A valid URL for the embedded video player or video file |
| mime_type | String | Mime type of the content of video url, “text/html” or “video/mp4” |
| thumb_url | String | URL of the thumbnail (jpeg only) for the video |
| title | String | Title for the result |
| caption | String | Опционально. Caption of the video to be sent, 0-200 characters |
| video_width | Integer | Опционально. Video width |
| video_height | Integer | Опционально. Video height |
| video_duration | Integer | Опционально. Video duration in seconds |
| description | String | Опционально. Short description of the result |
| reply_markup | InlineKeyboardMarkup | Опционально. Inline keyboard attached to the message |
| input_message_content | InputMessageContent | Опционально. Content of the message to be sent instead of the video |
InlineQueryResultAudio
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.
| Поле | Тип | Описание | |
| type | String | Type of the result, must be audio | |
| id | String | Unique identifier for this result, 1-64 bytes | |
| audio_url | String | A valid URL for the audio file | |
| title | String | Title | |
| caption | Integer | Необязательный | Название аудио, 0-200 символов |
| performer | String | Опционально. Performer | |
| audio_duration | Integer | Опционально. Audio duration in seconds | |
| reply_markup | InlineKeyboardMarkup | Опционально. Inline keyboard attached to the message | |
| input_message_content | InputMessageContent | Опционально. 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.
InlineQueryResultVoice
Represents a link to a voice recording in an .ogg container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
| Поле | Тип | Описание | |
| type | String | Type of the result, must be voice | |
| id | String | Unique identifier for this result, 1-64 bytes | |
| voice_url | String | A valid URL for the voice recording | |
| title | String | Recording title | |
| caption | Integer | Необязательный | Название голосового сообщения, 0-200 символов |
| voice_duration | Integer | Опционально. Recording duration in seconds | |
| reply_markup | InlineKeyboardMarkup | Опционально. Inline keyboard attached to the message | |
| input_message_content | InputMessageContent | Опционально. 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.
InlineQueryResultDocument
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.
| Поле | Тип | Описание |
| type | String | Type of the result, must be document |
| id | String | Unique identifier for this result, 1-64 bytes |
| title | String | Title for the result |
| caption | String | Опционально. Caption of the document to be sent, 0-200 characters |
| document_url | String | A valid URL for the file |
| mime_type | String | Mime type of the content of the file, either “application/pdf” or “application/zip” |
| description | String | Опционально. Short description of the result |
| reply_markup | InlineKeyboardMarkup | Опционально. Inline keyboard attached to the message |
| input_message_content | InputMessageContent | Опционально. Content of the message to be sent instead of the file |
| thumb_url | String | Опционально. URL of the thumbnail (jpeg only) for the file |
| thumb_width | Integer | Опционально. Thumbnail width |
| thumb_height | Integer | Опционально. Thumbnail height |
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
InlineQueryResultLocation
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.
| Поле | Тип | Описание |
| type | String | Type of the result, must be location |
| id | String | Unique identifier for this result, 1-64 Bytes |
| latitude | Float number | Location latitude in degrees |
| longitude | Float number | Location longitude in degrees |
| title | String | Location title |
| reply_markup | InlineKeyboardMarkup | Опционально. Inline keyboard attached to the message |
| input_message_content | InputMessageContent | Опционально. Content of the message to be sent instead of the location |
| thumb_url | String | Опционально. Url of the thumbnail for the result |
| thumb_width | Integer | Опционально. Thumbnail width |
| thumb_height | Integer | Опционально. Thumbnail height |
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
InlineQueryResultVenue
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.
| Поле | Тип | Описание |
| type | String | Type of the result, must be venue |
| id | String | Unique identifier for this result, 1-64 Bytes |
| latitude | Float | Latitude of the venue location in degrees |
| longitude | Float | Longitude of the venue location in degrees |
| title | String | Title of the venue |
| address | String | Address of the venue |
| foursquare_id | String | Опционально. Foursquare identifier of the venue if known |
| reply_markup | InlineKeyboardMarkup | Опционально. Inline keyboard attached to the message |
| input_message_content | InputMessageContent | Опционально. Content of the message to be sent instead of the venue |
| thumb_url | String | Опционально. Url of the thumbnail for the result |
| thumb_width | Integer | Опционально. Thumbnail width |
| thumb_height | Integer | Опционально. Thumbnail height |
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
InlineQueryResultContact
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.
| Поле | Тип | Описание |
| type | String | Type of the result, must be contact |
| id | String | Unique identifier for this result, 1-64 Bytes |
| phone_number | String | Contact’s phone number |
| first_name | String | Contact’s first name |
| last_name | String | Опционально. Contact’s last name |
| reply_markup | InlineKeyboardMarkup | Опционально. Inline keyboard attached to the message |
| input_message_content | InputMessageContent | Опционально. Content of the message to be sent instead of the contact |
| thumb_url | String | Опционально. Url of the thumbnail for the result |
| thumb_width | Integer | Опционально. Thumbnail width |
| thumb_height | Integer | Опционально. Thumbnail height |
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
InlineQueryResultCachedPhoto
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.
| Поле | Тип | Описание |
| type | String | Type of the result, must be photo |
| id | String | Unique identifier for this result, 1-64 bytes |
| photo_file_id | String | A valid file identifier of the photo |
| title | String | Опционально. Title for the result |
| description | String | Опционально. Short description of the result |
| caption | String | Опционально. Caption of the photo to be sent, 0-200 characters |
| reply_markup | InlineKeyboardMarkup | Опционально. Inline keyboard attached to the message |
| input_message_content | InputMessageContent | Опционально. Content of the message to be sent instead of the photo |
InlineQueryResultCachedGif
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.
| Поле | Тип | Описание |
| type | String | Type of the result, must be gif |
| id | String | Unique identifier for this result, 1-64 bytes |
| gif_file_id | String | A valid file identifier for the GIF file |
| title | String | Опционально. Title for the result |
| caption | String | Опционально. Caption of the GIF file to be sent, 0-200 characters |
| reply_markup | InlineKeyboardMarkup | Опционально. An Inline keyboard attached to the message |
| input_message_content | InputMessageContent | Опционально. Content of the message to be sent instead of the GIF animation |
InlineQueryResultCachedMpeg4Gif
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.
| Поле | Тип | Описание |
| type | String | Type of the result, must be mpeg4_gif |
| id | String | Unique identifier for this result, 1-64 bytes |
| mpeg4_file_id | String | A valid file identifier for the MP4 file |
| title | String | Опционально. Title for the result |
| caption | String | Опционально. Caption of the MPEG-4 file to be sent, 0-200 characters |
| reply_markup | InlineKeyboardMarkup | Опционально. An Inline keyboard attached to the message |
| input_message_content | InputMessageContent | Опционально. Content of the message to be sent instead of the video animation |
InlineQueryResultCachedSticker
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.
| Поле | Тип | Описание |
| type | String | Type of the result, must be sticker |
| id | String | Unique identifier for this result, 1-64 bytes |
| sticker_file_id | String | A valid file identifier of the sticker |
| reply_markup | InlineKeyboardMarkup | Опционально. An Inline keyboard attached to the message |
| input_message_content | InputMessageContent | Опционально. 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.
InlineQueryResultCachedDocument
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.
| Поле | Тип | Описание |
| type | String | Type of the result, must be document |
| id | String | Unique identifier for this result, 1-64 bytes |
| title | String | Title for the result |
| document_file_id | String | A valid file identifier for the file |
| description | String | Опционально. Short description of the result |
| caption | String | Опционально. Caption of the document to be sent, 0-200 characters |
| reply_markup | InlineKeyboardMarkup | Опционально. An Inline keyboard attached to the message |
| input_message_content | InputMessageContent | Опционально. 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.
InlineQueryResultCachedVideo
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.
| Поле | Тип | Описание |
| type | String | Type of the result, must be video |
| id | String | Unique identifier for this result, 1-64 bytes |
| video_file_id | String | A valid file identifier for the video file |
| title | String | Title for the result |
| description | String | Опционально. Short description of the result |
| caption | String | Опционально. Caption of the video to be sent, 0-200 characters |
| reply_markup | InlineKeyboardMarkup | Опционально. An Inline keyboard attached to the message |
| input_message_content | InputMessageContent | Опционально. Content of the message to be sent instead of the video |
InlineQueryResultCachedVoice
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.
| Поле | Тип | Описание | |
| type | String | Type of the result, must be voice | |
| id | String | Unique identifier for this result, 1-64 bytes | |
| voice_file_id | String | A valid file identifier for the voice message | |
| title | String | Voice message title | |
| caption | Integer | Необязательный | Название аудиосообщения, 0-200 символов |
| reply_markup | InlineKeyboardMarkup | Опционально. An Inline keyboard attached to the message | |
| input_message_content | InputMessageContent | Опционально. 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.
InlineQueryResultCachedAudio
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.
| Поле | Тип | Описание | |
| type | String | Type of the result, must be audio | |
| id | String | Unique identifier for this result, 1-64 bytes | |
| caption | Integer | Необязательный | Название аудио, 0-200 символов |
| audio_file_id | String | A valid file identifier for the audio file | |
| reply_markup | InlineKeyboardMarkup | Опционально. An Inline keyboard attached to the message | |
| input_message_content | InputMessageContent | Опционально. 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.
InputMessageContent
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:
InputTextMessageContent
Represents the content of a text message to be sent as the result of an inline query.
| Поле | Тип | Описание |
| message_text | String | Text of the message to be sent, 1-4096 characters |
| parse_mode | String | Опционально. 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_preview | Boolean | Опционально. Disables link previews for links in the sent message |
InputLocationMessageContent
Represents the content of a location message to be sent as the result of an inline query.
| Поле | Тип | Описание |
| latitude | Float | Latitude of the location in degrees |
| longitude | Float | Longitude of the location in degrees |
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
InputVenueMessageContent
Represents the content of a venue message to be sent as the result of an inline query.
| Поле | Тип | Описание |
| latitude | Float | Latitude of the venue in degrees |
| longitude | Float | Longitude of the venue in degrees |
| title | String | Name of the venue |
| address | String | Address of the venue |
| foursquare_id | String | Опционально. 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.
InputContactMessageContent
Represents the content of a contact message to be sent as the result of an inline query.
| Поле | Тип | Описание |
| phone_number | String | Contact’s phone number |
| first_name | String | Contact’s first name |
| last_name | String | Опционально. Contact’s last name |
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
ChosenInlineResult
Represents a result of an inline query that was chosen by the user and sent to their chat partner.
| Поле | Тип | Описание |
| result_id | String | The unique identifier for the result that was chosen |
| from | User | The user that chose the result |
| location | Location | Опционально. Sender location, only for bots that require user location |
| inline_message_id | String | Опционально. 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. |
| query | String | The query that was used to obtain the result |
Боты теперь умеют предоставлять пользователям возможность поиграть в HTML5-игры. Создать игру можно при помощи бота @BotFather и команды /newgame. Обратите внимание, что для создания игры вам нужно принять соглашение.
- Игры — новый тип контента, представленный объектами Game и InlineQueryResultGame.
- Как только вы создали игру с помощью бота BotFather, вы сможее отправлять игры в чаты или при помощи метода sendGame, или используя встроенный режим с методом InlineQueryResultGame.
- Если вы отправите сообщение с игрой без каких-либо кнопок, к нему автоматически добавится кнопка ‘Играть в ИмяИгры‘. Когда кто-то нажмёт на эту кнопку, вашему боту придёт CallbackQuery с параметром game_short_name. После этого вы должны предоставить корректный URL страницы с игрой, который автоматически откроется во встроенном браузере у пользователя.
- Вы можете сами добавить сколько угодно кнопок к сообщению с игрой. Пожалуйста, обратите внимание, что первая кнопка в первом ряду всегда должна открывать игру. Для этого существует поле callback_game в объекте InlineKeyboardButton. Остальные кнопки могут быть какими угодно: ссылки на сайт игры, вызов правил, и т. д.
- Чтобы описание игры выглядело более привлекательно, вы можете загрузить GIF-анимацию с геймплеем игры. Сделать это можно при помощи бота BotFather (пример такой игры: Lumberjack).
- В сообщении с игрой также будет отображаться таблица рекордов для текущего чата. Чтобы отображать рекорды в чате с игрой, вы можете использовать метод setGameScore. Добавьте параметр edit_message, чтобы автоматически обновлять сообщение с таблицей рекордов.
- Чтобы отобразить таблицу рекордов прямо в вашем приложении, используйте метод getGameHighScores.
- Вы можете добавить кнопки «Поделиться», которые позволят пользователям отправлять свои результаты в чаты или группы.
sendGame
Этот метод используется для отправки игры в виде обычного сообщения. В случае успеха возвращает объект с отправленным сообщением Message.
| Параметры | Тип | Обязательный? | Описание |
| chat_id | Integer или String | Да | Уникальный идентификатор целевого чата или юзернейм целевого канала (в формате @channelusername ) |
| game_short_name | String | Да | Короткое название игры, служит уникальным идентификатором игры. Задаётся в Botfather. |
| disable_notification | Boolean | Optional | Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound. |
| reply_to_message_id | Integer | Нет | Если сообщение является ответом, ID оригинального сообщения |
| reply_markup | InlineKeyboardMarkup или ReplyKeyboardMarkup или ReplyKeyboardHide или ForceReply | Нет | Дополнительные параметры интерфейса. Сериализованные в JSON встроенные клавиатуры, обычные клавиатуры, инструкция скрыть клавиатуру или принудительного ответа. |
Этот объект представляет собой игру.
| Поле | Тип | Описание |
| title | String | Название игры |
| description | String | Описание игры |
| photo | Массив объектов PhotoSize | Изображение, которое будет показываться в качестве обложки игры. |
| text | String | Опционально. Краткое описание игры или таблицы рекордов в сообщении с игрой. Может быть автоматически отредактировано, чтобы показывать текущую таблицу рекордов для игры при вызове ботом метода setGameScore, или ручном редактировании методом editMessageText. 0-4096 символов. |
| text_entities | Массив объектов MessageEntity | Опционально. Сущности в сообщении, типа имён пользователей, ссылок, команд и т. д. |
| animation | Animation | Опционально. Анимация, которая будет показана в опиании игры в сообщении. |
Animation
Чтобы сообщение с игрой выглядело более привлекательно, вы можете загрузить для игры анимацию с геймплее. Этот объект представляет собой файл анимации, который будет отображён в сообщении с игрой.
| Поле | Тип | Описание |
| file_id | String | Уникальный идентификатор файла |
| thumb | PhotoSize | Опционально. Превью анимации, заданное отправителем |
| file_name | String | Опционально. Название файла анимации, заданное отправителем |
| mime_type | String | Опционально. MIME-тип файла анимации, заданное отправителем |
| file_size | Integer | Опционально. Размер файла/td> |
CallbackGame
Заглушка, пока не содержит никакой информации.
setGameScore
Используйте этот метод, чтобы обновить игровой счёт определённого пользователя. Если сообщение было отправлено ботом, вернёт отредактированное сообщение Message, иначе True. Вернёт ошибку, если вы попытаетесь установить новый счёт меньше, чем текущий.
| Параметры | Тип | Обязательный? | Описание |
| user_id | Integer | Да | Идентификатор пользователя |
| score | Integer | Да | Новый счёт, больше нуля |
| chat_id | Integer или String | Нет | Необходим, если не указан inline_message_id. Уникальный идентификатор чата или имя пользователя канала (в формате @channelusername ). |
| message_id | Integer | Нет | Необходим, если не указан inline_message_id. Уникальный идентификатор отправленного сообщения |
| inline_message_id | String | Нет | Необходим, если не указан chat_id или inline_message_id. Идентификатор встроенного сообщения |
| edit_message | Boolean | Нет | Передайте True, чтобы в сообщение была автоматически встроена таблица рекордов |
getGameHighScores
Используйте этот метод, чтобы получить данные для таблицы рекордов. Этот метод возвращает счёт указанного пользователя и нескольких его соседей по таблице. В случает успеха вернёт массив объектов GameHighScore.
| Параметры | Тип | Обязательный? | Описание |
| user_id | Integer | Да | Идентификатор пользователя |
| chat_id | Integer или String | Нет | Необходим, если не указан inline_message_id. Уникальный идентификатор чата или имя пользователя канала (в формате @channelusername ). |
| message_id | Integer | Нет | Необходим, если не указан inline_message_id. Уникальный идентификатор отправленного сообщения |
| inline_message_id | String | Нет | Необходим, если не указан chat_id или inline_message_id. Идентификатор встроенного сообщения |
GameHighScore
Этот объект представляет собой один из рядов таблицы рекордов игры.
| Поле | Тип | Описание |
| position | Integer | Место в таблице результатов |
| user | User | Пользователь |
| score | Integer | Счёт |
Сайт про Telegram на русском (неофициальный).
Здесь собраны приложения на базе MTProto, переведена некоторая документация с официального сайта, а также работает Webogram.