This script is a custom node for ComfyUI that allows you to send images and text messages to a Telegram chat or channel using a Telegram bot.
- Send images generated by ComfyUI to a Telegram chat or channel
- Send text messages with various formatting options (bold, italic, code, strikethrough, underline, spoiler)
- Customize image format, compression level, and quality
- Enable or disable notifications and content protection
- Python 3.x
requests
library- ComfyUI
-
Make sure you have Python 3.x installed on your system.
-
Install the required
requests
library by running the following command:
pip install requests
-
Clone or download this repository to your local machine.
-
Copy the
telegram_sender.py
script to thecustom_nodes
directory of your ComfyUI installation.
-
Create a new Telegram bot by talking to the BotFather on Telegram. Follow the prompts to set a name and username for your bot, and obtain the bot token.
-
In ComfyUI, add the "Telegram Sender" node to your workflow.
-
Configure the node with the following inputs:
chat_id
: The ID of the Telegram chat or channel where you want to send the messages.bot_token
: The token of your Telegram bot.enable_image
: Enable or disable sending images (default: True).enable_text
: Enable or disable sending text messages (default: False).text
: The text message to send (only applicable ifenable_text
is True).bold
,italic
,code
,strikethrough
,underline
,spoiler
: Formatting options for the text message.disable_notification
: Enable or disable notifications for the messages (default: False).protect_content
: Enable or disable content protection for the messages (default: False).image_format
: The format of the image to send (default: PNG).png_compress_level
,jpeg_quality
,webp_lossless
,webp_quality
: Image compression and quality settings.
-
Connect the output of an image node to the "images" input of the Telegram Sender node.
-
Run the workflow. The generated images and/or text messages will be sent to the specified Telegram chat or channel.
This script is released under the MIT License.
Special thanks to the developers and contributors of ComfyUI and the crew at Banodoco discord! This script was developed with the assistance of the AI language model Claude Opus by Anthropic.
If you encounter any issues or have questions regarding this script, please open an issue on the GitHub repository.