skip to Main Content

I’m trying to use telethon and telebot to send notification from my code in python.
I have configureted everythings, but the code ask me the following:

receiver = InputPeerUser('user_id', 'user_hash')

I fund user_id, but I don’t understand where I could catch my user_hash.

2

Answers


  1. You must have an open dialogue with that user. Or you received a message from him. When all the dialogs are loaded, the information of that user comes with it.

    Login or Signup to reply.
  2. If you don’t have a ‘user_hash’, just enter 0.

    I.e.:

    userid=555555555
    userhash=0
    
    receiver=InputPeerUser(userid, userhash)
    

    For those requests having a “limit” parameter, you can often set it to
    zero to signify “return default amount”. This won’t work for all of
    them though, for instance, in “messages.search” it will actually
    return 0 items.

    Reference:
    https://telethonn.readthedocs.io/en/latest/extra/advanced-usage/accessing-the-full-api.html

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search