Skip to content

[Bug] New messages fail with "TOPIC_DELETED" if the Telegram topic was removed manually` #69

@mysubcult

Description

@mysubcult

Hello Remi! Everything works fine initially: when a user writes to the bot, a new chat is created in LHC and a corresponding Topic is created in the Telegram admin group.

The Problem:
If an administrator manually deletes the Topic in the Telegram group (while the chat still exists in the LHC database), any subsequent messages from that user fail to create a new chat or update the existing one.

Instead of creating a new topic, the system throws an exception in the Audit Log:
sendMessages: 400 Bad Request: TOPIC_DELETED

Steps to reproduce:

  1. A user writes a message to the Telegram bot.
  2. A chat opens in LHC, and a Topic is created in the Telegram admin group.
  3. The administrator manually deletes the Topic inside the Telegram app.
  4. The user sends a new message to the bot.
  5. Result: The message does not appear in LHC. The Audit Log shows telegram_exception with TOPIC_DELETED.

Current Workaround:
Even if I mark the chat as "Closed" in LHC, the error persists.
The only way to receive messages from this user again is to go into the LHC interface, find the specific chat history, and perform a "Delete chat" action completely. Once the old chat record is deleted from LHC, the next message from the user successfully creates a new chat and a new Topic.

Expected Behavior:
If the plugin receives a TOPIC_DELETED error from the Telegram API, it should treat the session as expired/invalid and create a new chat/topic for the incoming message, rather than failing silently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions