I want to read user names from receiving updates however but I face an special issue.
For some users, $message['from']['username']
contains a Telegram User Name however for some users this parameter is not defined.
How can I reliably receive user names ( get username
field), using Telegram Bot API?
2
Answers
It’s not mandatory to have a username, so there are users with no username.
Simply use this code:
When a user have no username it can’t use the bot.