Skip to content

Unable to delete ephemeral messages via deleteMessage (ephemeral_message_id is not accepted) #31196

Description

@Cuptam4ik

Is your feature request related to a problem?

Yes. When sending an ephemeral message to a supergroup using ephemeral_message_parameters (so only a specific user sees it), Telegram Bot API returns message_id: 0 along with an ephemeral_message_id (e.g. 29341834).

Currently, there is no way to auto-delete or clear this message after a timeout using deleteMessage:

  • Calling deleteMessage(chat_id, 0) fails with 400: Bad Request: message to delete not found.
  • Calling deleteMessage(chat_id, ephemeral_message_id) also fails with 400: Bad Request: message to delete not found.

Describe the solution you'd like

I would like deleteMessage to support deleting ephemeral messages, either by:

  1. Allowing ephemeral_message_id to be passed as the message ID parameter in deleteMessage.
  2. Or adding an optional parameter to deleteMessage specifically for ephemeral_message_id.

Describe alternatives you've considered

I considered sending a direct private message to the user instead, but if the user hasn't started a DM with the bot, the API rejects it with 400: Bad Request: bot can't initiate conversation with a user. Sending a standard group message works with deleteMessage, but then all group members see the message instead of only the target user.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions