Telegram Client icon

Telegram Client

Use Telegram Client API

Overview

This node implements a Telegram client that interacts with the Telegram API to perform various messaging operations. Specifically, the "Forward Message" operation allows users to forward an existing message from one chat or channel to another chat or channel.

Common scenarios where this node is beneficial include:

  • Automatically forwarding important messages from monitored channels to specific groups or users.
  • Creating workflows that redistribute content across multiple chats without manual intervention.
  • Archiving or backing up messages by forwarding them to a dedicated chat.

For example, you can configure the node to forward a message with a given message ID from a source chat to a target chat, enabling automated message sharing between different Telegram communities.

Properties

Name Meaning
Chat ID The ID or username of the source chat/channel where the original message exists (e.g., @username or -100xxxx). Required for forwarding.
Message ID The unique identifier of the message to be forwarded. Required.
To Chat ID The ID of the destination chat/channel where the message will be forwarded. Required.
Options Additional options (not used in Forward Message operation but available generally):
- Silent: Send message silently without notification
- Caption: Caption for media messages
- Parse Mode: How to parse message text (None, Markdown, HTML)
- Limit: Maximum number of items to return

Output

The output JSON object for the "Forward Message" operation contains:

  • success (boolean): Indicates if the forwarding was successful.
  • originalMessageId (number): The ID of the original message that was forwarded.
  • forwardedMessages (array): An array of message objects representing the forwarded messages returned by the Telegram API.
  • fromChatId (string): The source chat ID from which the message was forwarded.
  • toChatId (string): The destination chat ID to which the message was forwarded.

This output provides confirmation and details about the forwarded message(s).

Dependencies

  • Requires an API authentication token with Telegram Client API credentials including session string, API ID, and API hash.
  • Uses the Telegram Client SDK internally to connect and interact with Telegram's API.
  • Requires network connectivity to Telegram servers with WebSocket support enabled.
  • The node expects proper configuration of these credentials within n8n before execution.

Troubleshooting

  • No credentials provided: The node throws an error if the required Telegram API credentials are missing. Ensure credentials are configured correctly.
  • Operation not supported: If an unsupported operation name is specified, an error is thrown. Verify the operation parameter is set to "forwardMessage".
  • Message or chat not found: Errors may occur if the specified message ID or chat IDs are invalid or inaccessible. Double-check IDs and permissions.
  • Connection issues: Network problems or incorrect API credentials can cause connection failures. Confirm internet access and credential validity.
  • Permission errors: Forwarding messages requires appropriate permissions in both source and destination chats. Make sure the bot/user has rights to read and send messages.

If the node is set to continue on failure, errors will be included in the output JSON with success: false and an error message.

Links and References

Discussion