sgcWebSockets 2022.1 より、Telegram クライアントコンポーネントはボットとしてログインした際に電話番号または位置情報をユーザーにリクエストできます。
以下に Delphi・CBuilder・.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
ボットがメッセージを送信すると、ユーザーには電話番号を共有するかどうかを尋ねるボタンが表示されます。

ユーザーが電話番号の共有に同意すると、電話番号を含む新しいメッセージが送信されます。

