Nodes/ComfyUI-TelegramSender/Telegram: Send Image
ComfyUI Node

Telegram: Send Image

Shove your render straight into a Telegram chat (workflow metadata included)

By smbdsbrain·Created 3 months ago·Updated 3 months ago· 0
Telegram: Send Image
  • image
    caption
    send_as_phototrue
    send_as_documenttrue

    You're mid-queue, forty renders to go, and the machine that matters is in another room or another city. The workflow end you actually want is "put the finished image in my hand the moment it's done," and that is exactly what Telegram: Send Image does. It's an output node that fires every render to a Telegram chat as it finishes - no saving to disk, no screencasting, no dragging files off a headless box. You keep queuing, your phone buzzes, you judge from the couch.

    The name undersells one genuinely nice trick: in document mode it embeds the full ComfyUI workflow into the PNG, so the file that lands on your phone can be dragged straight back into ComfyUI and the whole graph rebuilds. The image is the project file - this node is your delivery pipeline for that idea. (If that sentence makes no sense yet, it's the "workflow in the PNG" convention, and it's the most useful thing about this pack.)

    How it works

    Under the hood it's boring in the best way: no model, no GPU work, no API key from a model vendor. It takes the IMAGE tensor (the standard B×H×W×C float batch in [0,1]), converts each frame to PNG bytes, and POSTs them to Telegram's Bot API. It mirrors ComfyUI's SaveImage behavior - prompt and extra_pnginfo go into the PNG's text chunks, and it honors the --disable-metadata flag if you run a privacy-stripped instance.

    It's an OUTPUT_NODE, which means it has no outputs and ends the workflow. You can (and should) just hang it off your final VAE Decode and let the graph stop there.

    The inputs that matter

    • image (IMAGE, required) - what it sends. A batch is fine: each frame goes out as its own message with a (#1), (#2)… suffix on the caption.
    • caption (STRING, multiline) - the message text. Optional.
    • send_as_photo (boolean, default True) - sends via Telegram's sendPhoto. Great for a quick look, but Telegram recompresses photos and strips metadata.
    • send_as_document (boolean, default True) - sends the original PNG via sendDocument, which Telegram leaves mostly alone. This is the one that keeps the workflow metadata.

    There are also hidden prompt / extra_pnginfo inputs ComfyUI wires up for you - you never touch them; they're what make the document PNG round-trip work.

    The trap that gets everyone on the first run

    Both toggles default to True, so the first time you use this you get two Telegram messages per render: one photo, one document. That's not a bug, it's the author's choice, and it's annoying. Decide which one you want. Only keeping masters? Turn send_as_photo off. Only want a quick glance on the bus and don't care about round-tripping? Turn send_as_document off.

    Installing it

    Easiest path is ComfyUI Manager - search "TelegramSender" and install. Otherwise, from the terminal:

    cd ComfyUI/custom_nodes
    git clone https://github.com/smbdsbrain/ComfyUI-TelegramSender
    

    Then, in the same Python environment ComfyUI uses:

    pip install requests
    

    (The imageio / imageio-ffmpeg packages in the pack's README are only needed by the video nodes in this pack - skip them for pure image use, but they're harmless.) Restart ComfyUI and you'll find the node under utils/telegram.

    Credentials work three ways, first match wins: Settings → Telegram Sender → Credentials in the ComfyUI UI (recommended; stored in user/default/comfy.settings.json), a telegram_config.json next to the node, or the TELEGRAM_BOT_TOKEN / TELEGRAM_CHAT_ID environment variables. Get the token from @BotFather - it takes two minutes. For the chat ID, either message your bot and read off the numeric ID, or just use a channel username like @my_channel.

    Troubleshooting

    • "requests not installed" - you skipped the pip install step or installed it into the wrong environment.
    • "bot_token and/or chat_id not specified" - the error message points you at the Settings page; check the token is the full 123456789:ABC... form and the chat ID isn't empty.
    • Photo saved but the workflow won't come back - that's Telegram recompressing the photo. Resend in document mode; the photo path was never going to keep the graph.
    • A batch of 8 floods you - yes, 8 messages, each with its index. If you want them grouped instead, that's what the album node in this pack is for.

    For the long-encode use case - render a video and let it deliver itself - grab the sibling Telegram: Send Video.

    Categoryutils/telegram

    Inputs (4)

    NameTypeDefaultDescription
    imageIMAGE
    captionSTRING
    send_as_photoBOOLEANtrue
    send_as_documentBOOLEANtrue

    Outputs (0)

    No outputs