Leestex Leestex - 1 year ago 786
Javascript Question

How to hide ReplyKeyboardMarkup after user click in Telegram Bot API

I am using Node.js telegram-bot-api.


  1. Show a custom keyboard with one button - "Share my phone number".

  2. When user clicks this button, contact should be sent and button should be removed from screen.

Here is a code I am using right now:

text: 'Please give us your phone number',
reply_markup: JSON.stringify({
keyboard: [
text: 'Share my phone number',
request_contact: true
resize_keyboard: true,
one_time_keyboard: true


  • When user clicks "Share my phone number" button, it shares his contact but button is visible even after that.

  • When I am not using
    works correctly (hides the button after its usage), but even in that case it just hides the button, so user can click an icon to bring it back to screen, which is not good at all.

Please tell me if I am doing something wrong here. Thanks

Answer Source

Found it.

Here is a solution:

    chat_id: message.chat.id,
    text: 'Some text...',
    reply_markup: JSON.stringify({
        hide_keyboard: true
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download