I have used dialogflow for telegram bot. Now I need to remove or delete after a user clicks on the button.
Here my custom payload code
{
"telegram": {
"text": "🛒 STOREnn💵 BANK ACCOUNTS 💵",
"parse_mode": "HTML",
"reply_markup": {
"inline_keyboard": [
[
{
"text": " LOG, PASS, ACC, ROUT",
"callback_data": "REFUND POLICY"
}
],
[
{
"text": " AUSTRALIAN BANKS",
"callback_data": "REFUND POLICY"
}
],
[
{
"text": "Back",
"callback_data": "Store"
}
]
]
}
}
}
when a user clicks on back button need to remove the inline keyboard
I’ve tried “hide_keyboard: true”
But it didn’t work.
2
Answers
There is no
hide_keyboard
option in Telegram bot API. TheReplyKeyboardRemove
method is present, but it is used for hiding reply keyboards, not inline keyboards like yours.There is no explicit
hide
method for inline keyboards in Telegram bot API. You can either change previously sent keyboard or simply delete message which contains keyboard.To change inline keyboard of sent message, use
editMessageReplyMarkup
method. Just provide a new version of inline keyboard inreply_markup
parameter, which will replace the current one.To delete the entire message use
deleteMessage
method.You can simply use something like this:
Also don’t forget to add CallbackQueryHandler in main function: