Search code examples
telegramtelegram-bot

How can I detect whether a user deletes the Telegram Bot chat?


Is it possible to check, via an API, whether somebody has deleted the Bot Chat in Telegram?

My test : Currently if a user deletes a chat, new messages will not stop sending to user.


Solution

  • Nope. Only by getting error while sending user something.

    Even calling sendChatAction method does not return error if user blocked the chat:

    $ curl https://api.telegram.org/bot***/sendChatAction -d 'chat_id=7975895' -d "action=typing"
    {"ok":true,"result":true}
    
    $ curl https://api.telegram.org/bot***/sendMessage -d 'chat_id=81083738' -d "text=ololo"
    {"ok":false,"error_code":403,"description":"[Error]: Bot was blocked by the user"}