--- sidebar_position: 2 --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; # Получить обновления Выполняет запрос, возвращающий информацию о событиях бота. Используется при работе в polling режиме `Функция ПолучитьОбновления(Знач Токен, Знач Таймаут = 0, Знач Смещение = "") Экспорт` | Параметр | CLI опция | Тип | Обяз. | Назначение | |-|-|-|-|-| | Токен | --token | Строка | ✔ | Токен бота | | Таймаут | --timeout | Строка,Число | ✖ | Время ожидания новых событий | | Смещение | --offset | Строка,Число | ✖ | Смещение в списке получаемых сообщений | Возвращаемое значение: Соответствие Из КлючИЗначение - сериализованный JSON ответа от Telegram
:::tip Метод в документации API: [getUpdates](https://core.telegram.org/bots/api#getupdates) :::
```bsl title="Пример использования для 1С:Предприятие/OneScript" Токен = "6129457865:AAFyzNYOAFbu..."; Результат = OPI_Telegram.ПолучитьОбновления(Токен); ``` ```bash oint telegram ПолучитьОбновления \ --token "***" ``` ```batch oint telegram ПолучитьОбновления ^ --token "***" ``` ```json title="Результат" { "ok": true, "result": [ { "update_id": 291368988, "channel_post": { "message_id": 9379, "sender_chat": { "id": -1001893407333, "title": "Тестовый канал", "username": "testsichee", "type": "channel" }, "chat": { "id": -1001893407333, "title": "Тестовый канал", "username": "testsichee", "type": "channel" }, "date": 1728325487, "pinned_message": { "message_id": 9360, "sender_chat": { "id": -1001893407333, "title": "Тестовый канал", "username": "testsichee", "type": "channel" }, "chat": { "id": -1001893407333, "title": "Тестовый канал", "username": "testsichee", "type": "channel" }, "date": 1728325259, "text": "Строковое значение" } } }, { "update_id": 291368989, "message": { "message_id": 5363, "from": { "id": 6129457865, "is_bot": true, "first_name": "Бот Виталий", "username": "sicheebot" }, "chat": { "id": -1001971186208, "title": "Тест", "is_forum": true, "type": "supergroup" }, "date": 1728325520, "message_thread_id": 5363, "forum_topic_created": { "name": "Тестовая тема 6893bf69-7fb2-4e58-9069-7d0f17fcb054", "icon_color": 7322096, "icon_custom_emoji_id": "5357419403325481346" }, "is_topic_message": true } }, { "update_id": 291368990, "message": { "message_id": 5365, "from": { "id": 6129457865, "is_bot": true, "first_name": "Бот Виталий", "username": "sicheebot" }, "chat": { "id": -1001971186208, "title": "Тест", "is_forum": true, "type": "supergroup" }, "date": 1728325521, "message_thread_id": 5363, "reply_to_message": { "message_id": 5363, "from": { "id": 6129457865, "is_bot": true, "first_name": "Бот Виталий", "username": "sicheebot" }, "chat": { "id": -1001971186208, "title": "Тест", "is_forum": true, "type": "supergroup" }, "date": 1728325520, "message_thread_id": 5363, "forum_topic_created": { "name": "Тестовая тема 6893bf69-7fb2-4e58-9069-7d0f17fcb054", "icon_color": 7322096, "icon_custom_emoji_id": "5357419403325481346" }, "is_topic_message": true }, "forum_topic_edited": { "name": "Новый тестовый заголовок", "icon_custom_emoji_id": "5310132165583840589" }, "is_topic_message": true } }, { "update_id": 291368991, "message": { "message_id": 5366, "from": { "id": 6129457865, "is_bot": true, "first_name": "Бот Виталий", "username": "sicheebot" }, "chat": { "id": -1001971186208, "title": "Тест", "is_forum": true, "type": "supergroup" }, "date": 1728325526, "forum_topic_reopened": {} } }, { "update_id": 291368992, "message": { "message_id": 5367, "from": { "id": 6129457865, "is_bot": true, "first_name": "Бот Виталий", "username": "sicheebot" }, "chat": { "id": -1001971186208, "title": "Тест", "is_forum": true, "type": "supergroup" }, "date": 1728325526, ... ```