Telegram MTProto Client icon

Telegram MTProto Client

Use Telegram Client API with MTProto protocol

Overview

This node enables interaction with Telegram using the MTProto protocol, allowing advanced messaging and chat management capabilities. Specifically, the "Delete Messages" operation lets users delete one or more messages from a specified chat or channel.

Common scenarios for this operation include:

  • Automatically cleaning up messages in a group or channel after certain events.
  • Moderation bots that remove inappropriate content.
  • Workflow automations that manage message lifecycle by deleting outdated or processed messages.

Example: A bot deletes a specific message by its ID in a given chat to maintain chat cleanliness or enforce rules.

Properties

Name Meaning
Chat ID The identifier of the chat or channel where the message exists. Can be a numeric ID or username (e.g., @username or -100xxxx). Required.
Message ID The unique numeric ID of the message to delete within the specified chat. Required.
Options No options are applicable for the Delete Messages operation in this context.

Output

The output JSON contains the following fields:

  • success (boolean): Indicates whether the deletion was successful.
  • deletedMessageId (number): The ID of the message that was deleted.

Example output:

{
  "success": true,
  "deletedMessageId": 12345
}

No binary data is produced by this operation.

Dependencies

  • Requires an active Telegram client API connection authenticated via credentials containing session information, API ID, and API hash.
  • The node uses the Telegram MTProto protocol through an underlying Telegram client library.
  • Proper permissions are needed on the Telegram account to delete messages in the target chat or channel.

Troubleshooting

  • Error: No credentials provided
    Ensure that valid Telegram client API credentials are configured in n8n before running the node.

  • Permission errors when deleting messages
    The Telegram account used must have rights to delete messages in the specified chat/channel. For groups/channels, admin privileges may be required.

  • Invalid Chat ID or Message ID
    Verify that the Chat ID and Message ID correspond to existing entities accessible by the authenticated account.

  • Network or connection issues
    The node attempts to connect via WebSocket with retries; ensure stable internet connectivity and that Telegram services are reachable.

  • Operation not supported error
    This indicates an invalid operation parameter; confirm that "deleteMessages" is selected as the operation.

Links and References

Discussion