question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Acquiring access_hash for Input Types

See original GitHub issue

I see multiple examples for sending messages/files…etc that instantiate a new Input Type, for example InputChannel or InputPeer…etc. Here’s an example for SendMessage

It seems like most Input types take an access_hash, yet I can’t find anything in gramjs or from Telegram on how exactly to get an access_hash other than results from different libraries like Telethon.

Do you have any examples or pointers on how I get an access_hash for a private channel that my user is already invited to? Can I do this with built in functionality from GramJS or do I need to use API Methods? Any pointers appreciated, and thanks for the work on this project, it’s extremely helpful for what I’m working on.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
painorcommented, Sep 6, 2021

you can just pass an ID. if channel/superroup => add -100 if group add => - if user don’t add anything for example for your test group2 it would be client.sendMessage(-463172658,{params})

https://core.telegram.org/constructor/inputPeerChat doesn’t require an accessHash

0reactions
KidA001commented, Sep 6, 2021

@painor ok thank you. I was under the false assumption that what I had were groups, not chats. Makes sense that I can use inputPeerChat without an accessHash. Appreciate the clarification, and thank you so much for being responsive. Much appreciated

Read more comments on GitHub >

github_iconTop Results From Across the Web

Users, Chats and Channels — Telethon 1.7.7 documentation
Entities' ID are the same for all user and bot accounts, however, the access hash is different for each account, so trying to...
Read more >
Entities — Telethon 1.26.1 documentation
Input Entities; Full Entities; Accessing Entities; Summary ... entities: usernames, phone numbers, chat links, invite links, IDs, and the types themselves.
Read more >
Access Hash value when key is a number with undescore (1_1)
JS engine is disposing of the underscore and converting the key from 1_1 to 11 . But if you wrap it in quotes,...
Read more >
Telethon Documentation - Read the Docs
trying to reuse the access hash from one account in another will not work. Sometimes, Telegram only needs to indicate the type of...
Read more >
Adding Telegram Group Members to Your Groups Using ...
Go to 'API development tools' and fill out the form. ... Note: You need to cast the user id and access hash to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found