I am writing an address book bot for my company group chat.
The main idea of the bot is an ability to search users telegram contacts. For example /find <first name & last name>
search bot's database and reply mention of a founded user, so people can contact with that person, clicking on its mention (via [inline mention of a user](tg://user?id=123456789)
).
The problem is sometimes bot get ENTITY_MENTION_USER_INVALID
. Furthermore, after few minutes, mention of that user can be successful.
As a workaround, I try to use @userName instead of mentions by userId, but now I have another trouble: not all the people have @userName.
So the question is: How to avoid ENTITY_MENTION_USER_INVALID
error?
As said here:
These mentions are only guaranteed to work if the user has contacted the bot in the past or is a member in the group where he was mentioned.
You can only mention users that at least started the bot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With