A popular library python-telegram-bot
builds most examples around polling through getUpdates
and later moves on to webhooks, cautiously:
You should have a good reason to switch from polling to a webhook.
https://github.com/python-telegram-bot/python-telegram-bot/wiki/Webhooks
My personal take is that webhook is a cleaner way to receive event information form Telegram API (POST request goes from Telegram right after after the event, no need for idle looping), but it needs more infrastructure:
- expose a public API endpoint
- application must be ready to porcess this call to an endpoint
Most tutorials focus on how to get a bot example running quickly and do that on a local machine, so getUpdates
is a natural choice for this.