TelegramApi
TelegramApi copied to clipboard
get user phone number from new incoming message.
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.
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