Actions12
Overview
The node implements a Telegram client that interacts with the Telegram API to perform various messaging and chat-related operations. Specifically, the Forward Message operation allows users to forward an existing message from one chat or channel to another chat or channel.
This node is beneficial in scenarios where automated workflows need to relay messages between different Telegram chats or channels without manual intervention. For example, a user might want to forward important alerts from a monitoring channel to a team discussion group automatically.
Practical example:
- Forward a message with ID 12345 from a source chat
@sourceChannelto a target chat@targetGroupas part of an automated notification system.
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 numeric ID of the message to forward. Required. |
| To Chat ID | The ID or username of the destination chat/channel where the message will be forwarded. Required. |
| Options | Additional optional settings: • Silent: Send message silently without notification (boolean). • Caption: Caption for media messages (string). • Parse Mode: How to parse the message text; options are None, Markdown, or HTML. • Limit: Maximum number of items to return (number). |
Note: For the Forward Message operation, only "Chat ID", "Message ID", and "To Chat ID" are required. The "Options" collection is available but not explicitly used in forwarding logic in the provided code.
Output
The output JSON object for the Forward Message operation includes:
success: Boolean indicating if the forwarding was successful.originalMessageId: The ID of the original message that was forwarded.forwardedMessages: An array containing details of the forwarded message(s) returned by the Telegram API.fromChatId: The source chat ID or username from which the message was forwarded.toChatId: The destination chat ID or username to which the message was forwarded.
Example output snippet:
{
"success": true,
"originalMessageId": 12345,
"forwardedMessages": [ /* array of forwarded message objects */ ],
"fromChatId": "@sourceChannel",
"toChatId": "@targetGroup"
}
No binary data output is involved in this operation.
Dependencies
- Requires valid Telegram API credentials including session string, API ID, and API hash.
- Uses the Telegram Client SDK internally to connect and interact with the Telegram API.
- Requires n8n credentials setup for Telegram Client API authentication.
- Network connectivity to Telegram servers is necessary.
- The node uses WebSocket connections (
useWSS: true) with retry logic for robustness.
Troubleshooting
- No credentials provided: The node throws an error if Telegram API credentials are missing. Ensure credentials are configured correctly in n8n.
- Operation not supported: If an unsupported operation name is passed, 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 the IDs and permissions.
- Connection issues: Network problems or incorrect API credentials can cause connection failures. Confirm network access and credential validity.
- Permission errors: Forwarding messages requires appropriate permissions in both source and destination chats/channels.
- The node supports "Continue On Fail" mode to allow workflows to proceed even if forwarding fails for some inputs.