Telematic icon

Telematic

Use Telegram Client API

Overview

This node integrates with the Telegram Client API to perform various messaging and chat management operations. Specifically, the "Delete Messages" operation allows users to delete one or more messages from a specified Telegram chat or channel. This is useful for automating message cleanup, managing content, or moderating chats programmatically.

Practical examples include:

  • Automatically deleting outdated or sensitive messages in a group chat.
  • Removing bot-generated messages after a certain time.
  • Moderation workflows where inappropriate messages are deleted based on triggers.

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 identifier of the message to delete within the specified chat. Required.
Options Additional optional parameters:
- Silent: Delete without sending notifications (boolean).
- Caption: Not applicable for delete operation.
- Parse Mode: Not applicable for delete operation.
- Limit: Not applicable for delete operation.

Note: For the "Delete Messages" operation, only Chat ID and Message ID are required and used. The options collection is available generally but does not affect this operation.

Output

The output JSON object for the "Delete Messages" operation contains:

  • success: Boolean indicating if the deletion was successful.
  • deletedMessageId: 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 API client session authenticated via API credentials (API ID and API Hash).
  • Needs a valid API key credential configured in n8n to connect to the Telegram Client API.
  • Uses WebSocket Secure (WSS) connection with retry logic for reliability.

Troubleshooting

  • Common issues:

    • Missing or invalid credentials will cause authentication failure.
    • Incorrect Chat ID or Message ID may result in errors or no action.
    • Attempting to delete messages without proper permissions in the chat can fail.
    • Network connectivity issues can interrupt the connection to Telegram servers.
  • Error messages:

    • "No credentials provided": Ensure the API credentials are set up correctly in n8n.
    • "Operation "deleteMessages" is not supported": Verify the operation name is correct.
    • Errors related to message deletion usually indicate permission issues or invalid IDs; verify the chat and message identifiers.
  • Resolution tips:

    • Double-check the chat and message IDs.
    • Confirm the bot or user has rights to delete messages in the target chat.
    • Ensure stable internet connection.
    • Use the "Continue On Fail" option to handle individual message deletion failures gracefully.

Links and References

Discussion