Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Telegram bot api limit of incoming updates

I was testing the Telegram bot api in order to get updates using

https://api.telegram.org/bot<tokenOfBot>/getUpdates

However, I realized I can get only 100 updates, and other ones don't appear. Is there any way to get the rest of my updates?

like image 589
Oscar Corpus Avatar asked Dec 15 '15 18:12

Oscar Corpus


People also ask

How many requests can a Telegram bot handle?

If you're sending bulk notifications to multiple users, the API will not allow more than 30 messages per second or so. Consider spreading out notifications over large intervals of 8—12 hours for best results. Also note that your bot will not be able to send more than 20 messages per minute to the same group.

Is Telegram API free?

The Telegram API and TDLib allow you to build your own customized Telegram clients. You are welcome to use both APIs free of charge. You can also add Telegram Widgets to your website. Designers are welcome to create Animated Stickers or Custom Themes for Telegram.

Can Telegram bots store data?

Python Telegram BOT ables to store and retrive data from database (create, delete and read items from your personal list) and set alarms.

Can I get a phone number by user ID via Telegram bot API?

It's possible with bots 2.0 check out bot api docs. you can check what is it. User can send itself phone number and also user can sand a contact. You need to compare user_id of sender of the message and user_id of contact.


1 Answers

You may use the limit parameter to control how many updates you received. However, according to the documentation:

limit: ... Values between 1—100 are accepted. Defaults to 100

That means you cannot receive more than 100 updates at a time.

If you want to receive newer updates, you would have to acknowledge the older updates, so the server won't give you the same old messages over and over. Pay attention to update_id. For example, if you have received an update_id of 999, next time you call getUpdates, you should use:

https://api.telegram.org/bot<token>/getUpdates?offset=1000

This way, the server knows you have received update_ids below 1000, and will not give the same old messages over and over.

like image 154
Nick Lee Avatar answered Sep 19 '22 00:09

Nick Lee