DEF STUDIO srl

Manual updates polling

As an aternative to set up a webhook, a bot updates can be fetched by periodically polling Telegram APIs

Warning

Manual updates polling is not available if a webhook is set up for the bot. Webhook should be remove first using its unregisterWebhook method

in order to get the updates, an ->updates() method is available in the TelegraphBot model:

$updates = $telegraphBot->updates();

the call will result in a collection of DefStudio\Telegraph\DTO\TelegramUpdate instances, one for each update, sorted by the oldest one.

It is advised to keep track of the TelegramUpdate::id() in order to avoid processing the same update multiple times.

The content of each update depends on the update type (Chat Message or Callback Query) and on the specific message type. Refer to the DTO section for more details.

Suggest a change
Last updated 02 December 2024