consensus here is. Almost all tutorials I see are using some SDK but I've not really come across any tutorials that use webhooks. Are there high volume bots out there that use these SDKs and just poll or is that just meant for tutorial purposes?
It depends on yourself if you can figure out the bot design without any framework you will have more control but if you want to do everything simply and fast you can use one of them I don't use anything for my own bots cause it's structure will be more simple and configurable.
A lot of the tutorials I've seen use some framework (Python, Node, Java etc) to map commands to command handlers. They all seem to do some hand wavy thing where the register with the bot token and then magically the commands are routed to the correct handlers. How is this happening? Is the framework polling?
It depends on the framework.
most node.js and python bots use polling I use php without anything and it's very good
But both methods are feasible for, high volume? Seems like Telegram would frown upon polling.
I think using webhooks is way better
Why's that?
when polling your server needs to run the code 24/7 but with webhooks only when a new request was received
Ah so you're saying you can leverage something like lambdas?
But let's say you weren't worried about running a container 24/7 from a cost perspective. Is the runtime costs the only reason you prefer webhooks?
no when I was using polling sometimes the messages will be lost because if 2 messages were sent between the update range only the last will be answered and the other will be ignored
😮 That's kind of a big deal.
On webhooks you need to listen to updates all the time as well, so you need it to have it running 24/7 too
Обсуждают сегодня