I am trying to send a message to a user that does not have username and not in my contact list (using telethon ), but I don't know the access_hash, only the user_id.
1- Is it possible to do that?
2- How do I fetch the access_hash for a user?
I am trying to send a message to a user that does not have username and not in my contact list (using telethon ), but I don't know the access_hash, only the user_id.
1- Is it possible to do that?
2- How do I fetch the access_hash for a user?
No library can figure out the
access_hashfrom only the user, chat or channel ID. However, if the library has "seen" this user before (through.get_dialogs(), or through anUpdate, or in any other way).Telethon will by default save the received information into the
*.sessionfile. To make use of it, callclient.get_input_entity(user_id), and it will return aInputPeerUserif possible (i.e. the library saw such user). This function also accepts usernames and phone numbers, in case those are more convenient, and don't forget to check the official documentation.