Telegram Request Phone Number or Location

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

Delphi Example 

oReplyMarkup := TsgcTelegramReplyMarkupShowKeyboard.Create;
  oReplyMarkup.AddButtonTypeRequestPhoneNumber('Give me your phone');
  sgcTelegram.SendTextMessage('123456', 'Please provide the information below', nil, oReplyMarkup);


oReplyMarkup = new TsgcTelegramReplyMarkupShowKeyboard();
oReplyMarkup->AddButtonTypeRequestPhoneNumber("Give me your phone");
sgcTelegram->SendTextMessage("123456", "Please provide the information below", null, oReplyMarkup);

.NET Example 

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.

Stay Informed

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.

Telegram TDLib error: UPDATE_APP_TO_LOGIN
Pusher Custom Authentication

Related Posts