Telegram Bot Chat not found

When you log as bot, the GetChats method cannot be used, so you don't get All available chats. If it's the first time you login as Bot and you try to send a message to a known Chat, you will get this error:

{"@type":"error","code":5,"message":"Chat not found"}

The solution is before send a telegram message, call GetChat method and pass the ChatId as a parameter. Once you get the Chat data, you can send telegram messages as usual.

As a note, you only must call GetChat the FIRST TIME before send a message if you never receive any bot message from this chat. If you close the application and start again, there is no need to call first GetChat because the Chat is already saved on telegram database.
×
Stay Informed

When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.

Coinbase WebSocket API
Telegram Send Message Bold, Italic...

Related Posts