Rahsaz Telegram icon

Rahsaz Telegram

Sends data to Telegram

Overview

The node integrates with Telegram to perform various chat-related operations. Specifically, the "Chat" resource with the "Leave" operation allows the bot to leave a group, supergroup, or channel on Telegram. This is useful in scenarios where a bot needs to programmatically exit chats it no longer needs to participate in, such as after completing a task or when removed from a workflow.

Practical example:

  • A bot that manages multiple group chats can automatically leave groups once certain conditions are met (e.g., after sending a final message or upon admin request), helping keep its active chat list clean.

Properties

Name Meaning
Chat ID Unique identifier for the target chat or username of the target channel (format: @channelusername). Required to specify which chat to leave.

Note: The provided properties JSON includes many options for other operations and resources, but for the "Chat - Leave" operation, only the Chat ID property is required and relevant.

Output

The output JSON contains the result returned by the Telegram API for the leave chat action. Typically, this will be a boolean indicating success (true) or failure (false). The node returns this in an array of items, each with a json field containing the API response.

No binary data output is associated with the "Leave" operation.

Dependencies

  • Requires a valid Telegram Bot API key credential configured in n8n.
  • Uses Telegram Bot API endpoints to perform actions.
  • No additional external services beyond Telegram are needed.

Troubleshooting

  • Common issues:

    • Invalid or missing Chat ID: Ensure the Chat ID or channel username is correct and accessible by the bot.
    • Bot not an administrator or member: The bot must be part of the chat to leave it; otherwise, the API call will fail.
    • Insufficient permissions: The bot may need appropriate rights to leave certain types of chats.
  • Error messages:

    • "Bad Request: chat not found": The specified Chat ID does not exist or the bot cannot access it.
    • "Forbidden: bot is not a member of the chat": The bot is not currently a member of the chat.

    Resolution: Verify the Chat ID, ensure the bot is added to the chat, and has necessary permissions.

Links and References

Discussion