How can the custom reply keyboard be hidden after user interaction in Telegram Bot API?

I’m using Node.js for my Telegram bot and need to hide the custom keyboard after a user shares their phone number. The keyboard remains visible. Example:

chatHandler.sendText({
  message: "Please provide your mobile number",
  reply_markup: JSON.stringify({
    keyboard: [[{ text: "Send Number", request_contact: true }]],
    one_time_keyboard: true,
    resize_keyboard: true
  })
});

In my experience, after the user has submitted their contact information, it is more reliable to send a follow-up message that explicitly sets the remove_keyboard property to true. Despite using one_time_keyboard, I have encountered cases where the keyboard remains visible, particularly on some Telegram client versions. Adding an extra instruction to remove the keyboard through a separate message resolves this issue consistently. This approach ensures that once the user input is processed, the keyboard is reliably cleared from the chat interface.

my workaround was to send a separate msg with reply_markup: { remove_keyboard: true } after getting the contact. one_time_keyboard sometimes doesnt vanish on older clients. hope this helps, cheers!

hey, try using remove_keyboard:true in you reply_markup. this should hid the keybord once the user shared their contact. cheers

After some trial and error with handling custom keyboards in my own Telegram bot, I found that using a post-interaction message to explicitly remove the keyboard works reliably. Rather than relying solely on one_time_keyboard, I now send a separate response with reply_markup configured as { remove_keyboard: true } immediately after receiving the desired input from the user. This explicit instruction seems to guarantee that the client’s keyboard is hidden on all devices, preventing issues where the keyboard remains visible due to delayed updates.