简体   繁体   中英

Telegram bot send message to chat error : chat not found

I use a telegram bot in my site to send messages to channel. This was working fine but suddenly 2 days ago when I'd send a message ,it returns "chat not found ! "

My published source in host has not changed in 2 month ago but this problem accrued !

Do someone know about this problem ? I live in Iran, is it problem telegram server block Iranian server ?

Using telegram.bot api in c#

In the new version of bot api, admins of channels have different types of permissions.

creator of the channel should make sure(in his app) that if the bot has the required permissions. (In this case "can send message")

I've found answer here in this link :

How to obtain the chat_id of a private Telegram channel?

We should use id of channel.

Send message to this channel through Bot API

https://api.telegram.org/bot111:222/sendMessage?chat_id=@channelName&text=123 As response you will get info with chat_id of your channel.

{ "ok" : true, "result" : { "chat" : { "id" : -1001005582487, "title" :
  "Test Private Channel", "type" : "channel" }, "date" : 1448245538,
  "message_id" : 7, "text" : "123ds" } }

Now you can convert Channel back to private (by deleting channel's link) and send message directly to this chat_id "-1001005582487"

检查频道的 id 是否正确,检查机器人是否仍然是频道中的管理员,如果是,请检查机器人的权限。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM