Skip to content

How to request user's phone number through inline keyboard button? #747

Answered by etteryand0
etteryand0 asked this question in Q&A
Discussion options

You must be logged in to vote

See issue #748. @WaffleLapkin helped me finding the correct type teloxide::types::InlineKeyboardButton.
My code:

use teloxide::types::{ButtonRequest, KeyboardButton, KeyboardMarkup};

let button = KeyboardButton::new(PHONE_PERMISSION_TEXT).request(ButtonRequest::Contact);
let markup = KeyboardMarkup::new([[button]])
  .one_time_keyboard(true)
  .resize_keyboard(true);

bot
  .send_message(msg.chat.id, REQUIRE_CONTACT_TEXT)
  .reply_markup(markup)
  .await?;

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by etteryand0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant