API Method 🔽
Call any Telegram Bot API method from your workflow
- bot
- params
- RESULT *
API Method is the escape hatch of the ComfyUI Telegram Suite. The pack ships a handful of polished send and edit nodes, but Telegram's Bot API has hundreds of methods - pin a message, delete a message, get chat member count, forward something, set the bot's name. You don't want the author to wrap all of them. This node lets you call any of them by name, passing arbitrary parameters as a DICT. It's in the experimental category for a reason: it's powerful, it's untyped, and it will happily fire whatever method name you type at the API.
How it works
The node is a thin wrapper over the same mechanism every node in the pack uses: your Telegram Bot instance POSTs method_name to the API with the given params. Type the method name into the string input (case-insensitive), optionally hand it a chat_id and a params DICT, and the node returns whatever the API replies. Because the response can be anything - a boolean from deleteMessage, a user object from getMe, a message from sendMessage - the output is typed * (wildcard).
Inputs
bot- your TELEGRAM_BOT instance from the Telegram Bot node.method_name- defaults togetMe, which is a genuinely good first test: it returns your bot's user info if the token is valid, and an error if it isn't. Type any method name, e.g.deleteMessage.chat_id(optional) - the target chat, for methods that need one.params(optional) - a DICT of method parameters, merged withchat_id. This is where you need a DICT from somewhere: a static params object from a node pack that provides one, or output from another node. Note that nested dicts/lists in params are JSON-serialized before sending, which is the correct behavior for the API.
Outputs and the trap to watch
The single output is RESULT * - the raw JSON result of the API call. It's *, so to do anything typed with it you'll need an "Any To" converter.
The real gotcha with this node is that it's unvalidated: method_name is a free string. A typo means a TelegramException with Telegram's "method not found" message, and params that don't match the method's requirements get rejected the same way. Errors are sanitized, so your token won't leak into the log - but you're also on your own for figuring out what the API wanted. Keep a tab open on the Telegram Bot API reference while you build these calls; the error strings are terse.
Install
Nothing special - it's part of the pack, so the standard install applies:
cd ComfyUI/custom_nodes
git clone https://github.com/SwissCore92/comfyui-telegram-suite.git
cd comfyui-telegram-suite
pip install -r requirements.txt
Or install "ComfyUI Telegram Suite" from ComfyUI Manager. Setup beyond that is the shared pack config: bot token and chat id in ComfyUI/user/default/telegram-suite/config.json, then restart. One warning from experience: because this node is an output node (is_output_node: true), it always runs when the workflow executes - if you leave getMe in there for a "test", it'll call the API on every run. That's fine, but it's an extra network round trip you may not want in a production workflow; take it out once you've confirmed the token works.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| bot | TELEGRAM_BOT | Telegram bot instance | |
| method_name | STRING | getMe | The telegram bot api message to call. (case insensitive) |
| chat_idopt | INT | Unique identifier for the target chat | |
| paramsopt | DICT | [object Object] | The method parameters. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| RESULT * | * | — |