sendMessage - Could not find the input entity for ${peer}
See original GitHub issueWork:
let result = await client.invoke(
new Api.messages.SendMessage({
peer: 'username',
message: 'hello'
})
)
console.log(result);
if peer
is a number, which is chat_id :
let result = await client.invoke(
new Api.messages.SendMessage({
peer: 123456789,
message: 'hello'
})
)
console.log(result);
got error:
throw new Error(`Could not find the input entity for ${peer}.
Error: Could not find the input entity for [object Object].
Any solution?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
ValueError: Could not find the input entity for PeerUser
To “encounter” an ID, you would have to “find it” like you would in the normal app. If the peer is in your...
Read more >Could not find the input entity for <telethon.tl.types.PeerUser ...
This is my Code: client(ImportChatInviteRequest(gruppoF)) except Exception: print("Gia' ci sono") ...
Read more >Entities — Telethon 1.26.1 documentation
If the entity cannot be found, additonal calls like ResolveUsernameRequest or GetContactsRequest may be made to obtain the required information. Entities vs.
Read more >Users, Chats and Channels — Telethon 1.7.7 documentation
Peers are enough to identify an entity, but they are not enough to make a request with them use them. You need to...
Read more >gram-js - Bountysource
I couldn't find any information on deployment best practices. ... Can I cache the peer information to redis and use it to send...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you are using a bot then the bot need to be in that chat or has talked to that user before. If you are using a user then you need to get that chat somehow either with an event being sent there (like a new message) or by getting all dialogs on startup (client.getDialogs())
Great. I forgot to add the limit in the example I sent. Usually something like 100 or 50 is enough.