TelegramApi icon indicating copy to clipboard operation
TelegramApi copied to clipboard

get user phone number from new incoming message.

Open ilhamiarie opened this issue 8 years ago • 1 comments

Hello, rubenlagus. Thanks for the development of this api. I really appreciate it. by the way, how do I know the phone number user, when the user sends a message to us. maybe you can give some simple examples. Thanks.

ilhamiarie avatar Oct 21 '16 02:10 ilhamiarie

hi @ilhamiarie ,

You should first get message.getFromId() to get the sender user ID. Then in our UserHandler when onUsers() is triggerred, you look for the user with the same ID. You can check if user shares phone number with you with user.hasPhone() and if yes, get it by user.getPhone().

hope it helps

afshar-mohammad avatar Oct 24 '16 09:10 afshar-mohammad