Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide 429 exception for webhook updates on inline query #648

Open
chaslain opened this issue Oct 8, 2024 · 8 comments
Open

Provide 429 exception for webhook updates on inline query #648

chaslain opened this issue Oct 8, 2024 · 8 comments

Comments

@chaslain
Copy link

chaslain commented Oct 8, 2024

When several users are active on my bot at one time, mostly interacting with callback queries, I am getting a 429 error sending the update back.
I believe if my bot is receiving one callback query, a 1:1 ratio of requests in to requests out should not trigger the 429 rate limiter, especially in reference to the same inline message id, as this cannot be used to spam.

@levlam
Copy link
Contributor

levlam commented Oct 9, 2024

You can call answerCallbackQuery without any limits, editing of the message in question is still subject to per chat limits.

@chaslain
Copy link
Author

chaslain commented Nov 29, 2024

@levlam I have rewritten the bot to edit the message in the http response, but when mutliple users are simultaneously using the bot, I still sometimes get drops, only now there is no error to inspect.

What are the "per chat limits"?
With the state of the bot being changed, the users enter an irredeemable loop where they cannot proceed.

@levlam
Copy link
Contributor

levlam commented Dec 1, 2024

Per chat limits are documented at https://core.telegram.org/bots/faq#my-bot-is-hitting-limits-how-do-i-avoid-this:

In a single chat, avoid sending more than one message per second. We may allow short bursts that go over this limit, but eventually you'll begin receiving 429 errors.
In a group, bots are not be able to send more than 20 messages per minute.

@chaslain
Copy link
Author

chaslain commented Dec 1, 2024

@levlam does this include editing messages? I saw this FAQ but it does not mention that, and I'm still surprised to be running into limits like this.

@levlam
Copy link
Contributor

levlam commented Dec 1, 2024

Yes, it includes message editing.

@chaslain
Copy link
Author

chaslain commented Dec 1, 2024

@levlam in that case, my thought is this: If I receive an inline query, and send back an edit for that same message, there is no way to abuse the system with those kind of updates, especially with it being 1:1 with user interaction. Couple that with cutting down traffic by giving a webhook response rather than a separate request, and it seems reasonable that these not be rated.

Is there some other consideration I am missing?

@levlam
Copy link
Contributor

levlam commented Dec 1, 2024

This is possible, but it would require harder limits for callback query sending by users.

@chaslain
Copy link
Author

chaslain commented Dec 1, 2024

@levlam that is my suggestion then, especially because responding to a webhook query yields no way to know if the action was successful.

I cannot picture a use case where a bot would require more than, say, 1 interaction per second per message with callback queries, and the bot I am asking about is a game- which would be more interaction than most bots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants