Nodes/SP-Nodes/Send Image To Telegram Bot
ComfyUI Node

Send Image To Telegram Bot

Get pinged on Telegram the second your render finishes

By bananasss00·Created 2 years ago·Updated 5 days ago· 20
Send Image To Telegram Bot
  • images
    bot_token_envTG_BOT_TOKEN
    chat_id_envTG_BOT_CHATID
    compressfalse
    send_as_documenttrue
    album_size1

    If you've ever queued a long batch and then just... kept refreshing the ComfyUI tab to see if it's done, this node fixes that. Drop it at the end of your workflow and it pushes your output images straight to a Telegram chat the moment they're ready. No polling, no browser tab, just a phone buzz.

    How it works

    This is a plain output node - it takes images and sends them, nothing comes back out of it to wire further downstream. The interesting design choice is bot_token_env and chat_id_env: these aren't the actual bot token and chat ID, they're the names of environment variables that hold them (defaulting to TG_BOT_TOKEN and TG_BOT_CHATID). That's deliberate - it keeps your bot token out of the workflow JSON itself, so you can share a workflow file without also handing someone your bot's credentials. You set the actual values as environment variables before launching ComfyUI.

    To get there you need a Telegram bot in the first place: message @BotFather to create one and get a token, then message your new bot (or add it to a group) and use its getUpdates endpoint to find the numeric chat ID. Set both as env vars under the names this node expects (or point the fields at whatever variable names you actually used), restart ComfyUI, and you're set.

    The inputs that matter

    • images - whatever you want sent.
    • bot_token_env / chat_id_env - the env var names, not the secrets themselves.
    • send_as_document (default true) - sends the file as-is rather than as a compressed Telegram photo, which matters because Telegram recompresses regular photo uploads hard. Keep this on if you actually care about the pixels you generated.
    • compress (default false) - the node's own optional pre-compression step, separate from Telegram's.
    • album_size (1–10) - groups multiple images into a single Telegram album message instead of flooding the chat with one message per image, which is the difference between a usable chat and a wall of notifications after a batch run.

    How to install it

    Through ComfyUI Manager: search "SP-Nodes," install, restart. Or clone it directly:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bananasss00/ComfyUI-SP-Nodes
    

    Restart ComfyUI, then set your two environment variables before the next launch - a node restart alone won't pick up newly set env vars, the whole ComfyUI process needs to start with them present.

    Common issues

    The most common failure is simply forgetting to set the environment variables before launching, or setting them in a shell/session that isn't the one ComfyUI actually starts from - the node has no token or chat ID to fall back on if the env vars aren't there. A wrong chat ID is the second most likely culprit; make sure you've actually messaged the bot (or added it to the group) before pulling the chat ID from getUpdates, since Telegram won't have a chat ID to report otherwise. And if you're sending large batches with send_as_document off, remember Telegram's own upload limits apply on top of whatever this node does - very large images sent as compressed photos can get downsized by Telegram itself, which is exactly what send_as_document: true is there to avoid.

    CategorySP-Nodes

    Inputs (6)

    NameTypeDefaultDescription
    imagesIMAGE
    bot_token_envSTRINGTG_BOT_TOKEN
    chat_id_envSTRINGTG_BOT_CHATID
    compressBOOLEANfalse
    send_as_documentBOOLEANtrue
    album_sizeINT11–10

    Outputs (0)

    No outputs