Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Obtain Reactions Updates via Telegram Bot API

Tags:

telegram-bot

Good day,

Is it any chance to obtain via webhooks or long-pooling requests updates related to reactions to messages which was posted by bot? Or at least obtain any reactions updates in channel/group to which a bot was added.

In documentation found API Method: https://core.telegram.org/bots/api#getupdates

But based on how the response model looks like there are no chance to obtain updates related to reactions.

Did someone has solved such issue?

Thank you in advance

like image 780
pryabov Avatar asked Jan 01 '26 01:01

pryabov


2 Answers

Response was received in @BotTalk community group.

Right now (Apr 2022) there is no way to do that.
like image 120
pryabov Avatar answered Jan 03 '26 15:01

pryabov


Situation changed! As of Telegram Bot API 7.0 your bot can set one reaction per message and it can receive reactions.

First of all, To receive reaction updates you must explicitly specify that your bot want to receive reaction updates in your getUpdates/setWebhook call.

A call to getUpdates/setWebhook usually hidden inside a library you use for Telegram Bot API. A library I use has special object BotOptions supplied at bot start. Your library might have something like that.

getUpdates/setWebhook http requests have parameter allowed_updates, that contains a json-serialized list of all update types you want to receive. Names correspond to Update field names. For example, 'message' to receive new messages. See Update for a complete list of available update types. Specify an empty list to receive all update types except 'chat_member', 'message_reaction', and 'message_reaction_count' (default). If not specified, the previous setting will be used.

'message_reaction' and 'message_reaction_count' are types we need, so, you have to specify a list of desired update types, including 'message_reaction' for personal chats and 'message_reaction_count' for chats with anonymous reactions.

After that you bot will receive updates with reactions.

like image 44
babay Avatar answered Jan 03 '26 14:01

babay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!