Nodes/comfy-workflow-api/Workflow API Transformer
ComfyUI Node

Workflow API Transformer

Pull Any Value Out of an HTTP Request and Feed It Into Your Graph

By isala404·Created 8 months ago·Updated 7 months ago· 2
Workflow API Transformer
  • webhook_context
  • default_value
  • value
fieldprompt
debugfalse

WebhookTransformer is the glue node of the comfy-workflow-api pack. It reaches into an incoming HTTP request, pulls out one field - the prompt, a seed, an uploaded image - and hands it to whatever node in your graph is waiting for it. If you've ever wanted to just POST a value into a workflow instead of hand-editing a JSON file, this is the node that makes that happen.

It's the middle of a three-node sandwich. WebhookReceiver opens the door (it collects the request and builds the context), WebhookTransformer reads from that context, and WebhookSend ships results back to your callback URL. The transformer is the part that actually reads: give it the context from the receiver, tell it which field to grab, and it outputs a value you can wire straight into a CLIPTextEncode, a KSampler's seed, a VAEEncode - anything. The README's img2img example runs two of them in parallel, one extracting the prompt and one extracting the uploaded image.

How it works

Every field name is atomic. The tooltip says it plainly: "Field name to extract (atomic, no nesting)". No JSON paths, no dot notation, no nested objects - the request is a flat bag of named parts and this node grabs one by name.

The clever part is the type inference. It doesn't just hand you strings:

  • "42" comes out as an INT, "3.14" as a FLOAT, "true" / "false" as a BOOLEAN.
  • File uploads get decoded by content type - an uploaded PNG becomes an IMAGE tensor, audio becomes AUDIO, video becomes VIDEO.
  • Base64 data: URIs are handled too.

So the same single node feeds a text box and an image input without you doing any conversion yourself.

Inputs and outputs that matter

Three inputs do the work:

  • webhook_context - the context from WebhookReceiver. Required.
  • field - the name of the part to extract. Defaults to "prompt", the common case for a text-to-image API.
  • default_value - fallback if the field is missing. This one decides whether your workflow breaks.

The single output, value, is a wildcard (*). It connects to literally any input type, and ComfyUI sorts out the actual type from what's on the other end of the wire.

Where people get burned

The field must exist. Ask for something the request didn't send and leave default_value empty, and the transformer raises an error that stops the whole workflow - it even prints the list of fields that were available so you can spot the typo. Set a default_value and it shrugs and uses that instead. That's the difference between a brittle API and one that tolerates missing options.

Second, this node only makes sense when the workflow is triggered through the pack's /api/webhook endpoint. Drag it onto a canvas and hit Run yourself and there's no request behind it, so there are no fields - you'll get the "field not found" error unless everything has a default.

One small trap in the type coercion: send "42" and you get an int, not the string "42". That's almost always what you want - it only bites if you were relying on leading zeros or exact string formatting.

Installation

It ships in the comfy-workflow-api pack, so you install the pack once:

cd ComfyUI/custom_nodes
git clone https://github.com/isala404/comfy-workflow-api
pip install -r comfy-workflow-api/requirements.txt

Then restart ComfyUI. Or use ComfyUI Manager and search for "comfy-workflow-api" - same result, one click. The only hard dependency is aiohttp; audio and video decoding want av (PyAV). No models, no weights, nothing to download.

Troubleshooting

Flip debug on. The transformer prints exactly what it found for the field - inferred type, value, source - so when nothing's coming through you can see in one glance whether the request never arrived or the field name just doesn't match. The most common fix is a typo: the field name in your curl or client has to match the field input character-for-character.

Categorywebhook

Inputs (4)

NameTypeDefaultDescription
webhook_contextWEBHOOK_CONTEXT
fieldSTRINGpromptField name to extract (atomic, no nesting)
default_valueopt*Fallback value if field not found (leave empty to require field)
debugoptBOOLEANfalseEnable debug logging

Outputs (1)

NameTypeDescription
value*