I am developing a Telegram bot using C# and I’m looking for a way to allow the bot to show a positive reaction—similar to a "like" or thumbs up—to user messages when certain conditions are met (e.g., the text has no errors). I understand that the Telegram Bot API does not support reactions in the same way a user can "like" messages. However, is there a recommended way to express similar feedback from my bot?
Currently, my bot sends a reply message with a thumbs-up emoji to commend error-free messages. Are there other, perhaps more subtle or interactive ways to achieve this within the Telegram framework, such as using inline keyboards or custom emojis?
Here’s the snippet from my C# code handling the response:
if (!response.Contains("NO CHANGES"))
{
// Logic to handle and respond to user's text here
}
else
{
// Logic when no changes have been made to the user's text
await botClient.SendTextMessageAsync(chatId: chatId,
text: $"{userName}, your text is error-free! 👍",
replyToMessageId: messageId,
parseMode: ParseMode.Html,
cancellationToken: cancellationToken);
}
Any guidance or suggestions for implementing an effective feedback feature in Telegram bots would be greatly appreciated.
2
Answers
setMessageReaction
actually, from Bot API 7.0, Telegram Bots can handle reactions just like normal users can do. So, you can implement this feature with Bot API itself.
NB: I’m not good with C#, but I’ve gone through the code of the Bot API framework you’re possibly using and found that it supports setting reactions.
Here’s a sample code, please let me know if it works:
if I’m wrong with the C# code, probably this endpoint help you:
Call this API endpoint with data like:
Here’s setMessageReaction method’s documentation.
Hope this helps 🙂