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;
Try
  oReplyMarkup.AddButtonTypeRequestPhoneNumber('Give me your phone');
  sgcTelegram.SendTextMessage('123456', 'Please provide the information below', nil, oReplyMarkup);
Finally
  oReplyMarkup.Free;
End; 

CBuilder 

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

.NET Example 

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

Telegram 

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