Extensions/comfyui-tgbridge
ComfyUI Extension

comfyui-tgbridge

ComfyUI custom node for sending generated videos and workflow metadata to Telegram.

By blkot·Created 2 months ago·Updated 2 months ago· 0
blkot/ComfyUI-tgBridge
Nodes
On cloudLocal install
Stars0
Updated2 months ago
Readme

ComfyUI Telegram Bridge

ComfyUI Telegram Bridge adds output nodes that send generated files and workflow details from ComfyUI to a Telegram chat, group, channel, or forum topic.

The main use case is a VideoHelperSuite workflow:

Video Combine -> Telegram Workflow Report

The node consumes VHS_FILENAMES, uploads the selected output file, posts a compact caption, and can send a detailed metadata reply plus an optional JSON metadata attachment.

Status

This project is usable but early. It has been built for personal ComfyUI video workflows and is now prepared for public use. Expect the common VideoHelperSuite and WanVideo paths to work, but please test with enabled = false first when adding it to an existing workflow.

Features

  • Sends generated videos, images, or documents through the Telegram Bot API.
  • Supports Telegram groups, channels, and forum topics via message_thread_id.
  • Keeps bot tokens out of workflow JSON by loading secrets from environment variables or a local ignored config file.
  • Provides a full manual report node for explicit metadata wiring.
  • Provides a simplified auto report node that reads saved ComfyUI metadata from output files.
  • Returns the original VHS_FILENAMES value unchanged so workflows remain chainable.
  • Supports compact captions, detailed reply messages, and optional JSON metadata export.
  • Includes helper nodes for converting WanVideo model and LoRA objects into readable strings.

Requirements

  • ComfyUI with Python 3.10 or newer.
  • VideoHelperSuite if you want to connect VHS_FILENAMES from Video Combine.
  • A Telegram bot token from BotFather.
  • A target Telegram chat ID, channel ID, group ID, or forum topic thread ID.

Runtime Python dependencies are listed in requirements.txt:

Pillow>=10.0.0
requests>=2.31.0

Installation

Clone this repository into your ComfyUI custom_nodes directory:

cd ComfyUI/custom_nodes
git clone <repo-url> ComfyUI-tgBridge

Install dependencies into the same Python environment used by ComfyUI:

cd ComfyUI-tgBridge
pip install -r requirements.txt

Restart ComfyUI. The nodes appear under the Telegram category.

If you use ComfyUI Manager or another custom-node installer, it should install dependencies by running:

pip install -r requirements.txt

Telegram Setup

  1. Create a bot with BotFather and copy the bot token.
  2. Add the bot to your target chat, group, channel, or forum topic.
  3. Give the bot permission to post messages and media.
  4. Find the target chat ID.
  5. If posting to a forum topic, also find the topic message thread ID.

For groups and channels, Telegram chat IDs often look like -1001234567890.

For forum topics, set both:

  • COMFY_TG_CHAT_ID
  • COMFY_TG_MESSAGE_THREAD_ID

Configuration

Environment variables are recommended for public or shared workflows because they do not get saved inside ComfyUI workflow JSON.

Linux/macOS:

export COMFY_TG_BOT_TOKEN="123456:ABC..."
export COMFY_TG_CHAT_ID="-1001234567890"
export COMFY_TG_MESSAGE_THREAD_ID="7"

Windows PowerShell:

$env:COMFY_TG_BOT_TOKEN = "123456:ABC..."
$env:COMFY_TG_CHAT_ID = "-1001234567890"
$env:COMFY_TG_MESSAGE_THREAD_ID = "7"

Optional settings:

export COMFY_TG_BOT_API_BASE="https://api.telegram.org"
export COMFY_TG_DISABLE_NOTIFICATION="false"
export COMFY_TG_PARSE_MODE="HTML"
export COMFY_TG_TIMEOUT_SECONDS="120"

You can also create config/telegram.json:

{
  "bot_token": "123456:ABC...",
  "chat_id": "-1001234567890",
  "message_thread_id": 7,
  "parse_mode": "HTML",
  "disable_notification": false,
  "timeout_seconds": 120
}

config/telegram.json is ignored by Git. Environment variables take precedence over the local config file.

Nodes

Telegram Workflow Report

Use this node when you want reliable, explicit control over what is reported.

Typical connection:

VideoHelperSuite Video Combine: filenames -> Telegram Workflow Report: filenames

Important inputs:

  • enabled: when false, no Telegram upload is attempted, but the preview string is still produced.
  • upload_mode: final_only uploads the last existing output; all_files uploads all existing outputs.
  • send_as: auto, video, photo, or document.
  • message_mode: caption only, caption plus detail reply, or caption plus detail reply plus JSON.
  • failure_mode: warn logs errors and lets the workflow finish; raise stops on errors.
  • title, prompts, model fields, LoRA fields, seed, steps, CFG, sampler, scheduler, size, frames, and FPS: optional metadata shown in Telegram.
  • reference_image and send_reference_image: optionally send a reference image as a reply.

The node also accepts WanVideo model and LoRA object inputs where available:

  • base_model_obj, high_model_obj, low_model_obj
  • high_loras_obj, low_loras_obj

String inputs still work and are useful when your workflow uses different node types.

Telegram Auto Workflow Report

Use this node when you want a simpler workflow. It only requires filenames and reads metadata from saved output metadata where possible.

Typical connection:

VideoHelperSuite Video Combine: filenames -> Telegram Auto Workflow Report: filenames

The auto node looks for metadata in:

  • The output file itself when it is a supported metadata image.
  • A companion .json file with the same base filename.
  • A companion .png or .webp file with embedded ComfyUI metadata.

It currently attempts to extract:

  • Positive and negative prompts.
  • Seed, steps, CFG, sampler, and scheduler.
  • Width, height, frames, and FPS.
  • Checkpoint/model names.
  • LoRA names and strengths.

Automatic extraction depends on how the upstream saver writes metadata. If the report is missing important details, use Telegram Workflow Report and wire those values explicitly.

WanVideo Model -> String

Converts a WANVIDEOMODEL object into a readable model name string.

WanVideo Lora List -> String

Converts WANVIDLORA lists into readable strings for report fields.

Output Format

The first uploaded file receives a compact caption, for example:

Generation Complete

My clip title
Seed: 123456
Size: 832x480 | Frames: 81 | FPS: 16

When detail replies are enabled, the node posts sections such as:

Generation Details

Prompt:
...

Negative:
...

Model:
Base: ...

Settings:
Seed: ...
Steps: ...
CFG: ...

Safe Testing

Before posting to Telegram, set:

enabled = false

Run the workflow and inspect the message_preview output. When the preview looks correct, set enabled = true.

For stricter debugging, set:

failure_mode = raise

This makes ComfyUI show the underlying error instead of only logging a warning.

Troubleshooting

The node does not appear

  • Confirm the repository is inside ComfyUI/custom_nodes.
  • Install dependencies with pip install -r requirements.txt in ComfyUI's Python environment.
  • Restart ComfyUI after installation.
  • Check the ComfyUI console for import errors.

Telegram says chat not found

  • Make sure the bot was added to the target chat or channel.
  • Check that COMFY_TG_CHAT_ID is the numeric Telegram chat ID, not the visible chat name.
  • For channels, the bot must be allowed to post.

Messages do not go to the topic

  • Set COMFY_TG_MESSAGE_THREAD_ID.
  • Make sure the topic belongs to the chat configured by COMFY_TG_CHAT_ID.

Upload fails but the workflow continues

That is expected when failure_mode = warn. Set failure_mode = raise while debugging.

Auto report is missing metadata

The auto node can only report metadata that was saved by upstream nodes. Use the manual Telegram Workflow Report node for fields that must always appear.

Development

This repository uses uv for local development:

uv sync --dev
uv run pytest
uv run ruff check .

The public runtime dependency path remains requirements.txt for ComfyUI compatibility.

Security Notes

  • Do not commit bot tokens, chat IDs for private groups, or local config files.
  • Prefer environment variables for shared workflows.
  • config/telegram.json is intended for local use and is ignored by Git.