php - Telegram API, get the sender's phone number? -


i realize not possible use a bot receive sender's phone number.
do, however, need implement bot-like client, responds messaging it. using php on apache.

it not bot, not take commands, rather responds sent text has phone number. add user contact (using phone number), , send text it.

my goal realise sender's phone number receive it, saw on telegram api there's peer id, can't find how phone number if that's possible...

try lib github https://github.com/irazasyed/telegram-bot-sdk

and code create 'visit card' button in private chat:

$keyboard = array(                    array(                         array(                                'text'=>"send visit card",                               'request_contact'=>true                               )                         )                  ); //user button under keyboard.  $reply_markup = $telegram->replykeyboardmarkup([ 'keyboard' => $auth_keyboard, 'resize_keyboard' => true, 'one_time_keyboard' => false ]); $telegram->sendmessage([ 'chat_id' => $chat_id, 'text' => $reply, 'reply_markup' => $reply_markup ]); 

and code unic user phone 'visit card' after user push button

$user_phone = $result["message"]["contact"]["phone_number"]; if ($user_phone) {         $reply = $user_phone;         $telegram->sendmessage([ 'chat_id' => $chat_id, 'text' => $reply, 'reply_markup' => $reply_markup ]);    } 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -