Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a pop-up notification in Telegram bot?

I´m developing a telegram bot in c#. Using the class TelegramBotClient in Telegram.Bot library.

I want to create a pop-up notification after click on a InlineKeyboardButton.

Does anyone know how to do it? Thank you very much.

I want to create something similar to this image:

enter image description here

like image 894
David Con Avatar asked Aug 06 '19 16:08

David Con


Video Answer


2 Answers

I have done in python:

bot.answer_callback_query(call.id, "THIS IS AN ALERT", show_alert=True)

you have it in doc: https://core.telegram.org/bots/api#answercallbackquery

the parameter is show_alert

like image 83
Batichico Avatar answered Oct 16 '22 10:10

Batichico


Just use method AnswerCallbackQueryAsync with optional "show alert" parameter in true, like this:

await botClient.AnswerCallbackQueryAsync(e.CallbackQuery.Id, "Notification already enabled", true);
like image 21
Андрій Петрук Avatar answered Oct 16 '22 11:10

Андрій Петрук