From sgcWebSockets 2022.1 the Telegram Client component is able to request the user the Phone Number or the location when has login as a bot.
Find below an example code in Delphi, CBuilder and .NET
oReplyMarkup := TsgcTelegramReplyMarkupShowKeyboard.Create; Try oReplyMarkup.AddButtonTypeRequestPhoneNumber('Give me your phone'); sgcTelegram.SendTextMessage('123456', 'Please provide the information below', nil, oReplyMarkup); Finally oReplyMarkup.Free; End;
oReplyMarkup = new TsgcTelegramReplyMarkupShowKeyboard(); oReplyMarkup->AddButtonTypeRequestPhoneNumber("Give me your phone"); sgcTelegram->SendTextMessage("123456", "Please provide the information below", null, oReplyMarkup); oReplyMarkup->Free();
oReplyMarkup = new TsgcTelegramReplyMarkupShowKeyboard(); oReplyMarkup.AddButtonTypeRequestPhoneNumber("Give me your phone"); sgcTelegram.SendTextMessage("123456", "Please provide the information below", null, oReplyMarkup);
When the message is sent by the bot, the user see a button where asks if want to share the phone number.
If the user consent to share the phone number a new message with the phone number is sent.
When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.