All nodes/Integrations/Widget
Widget function
Calls a JS function declared in the widget embed code (flowWidget.defineFunction). Sends a signal to the visitor's browser, waits for a result (30 s by default) and passes it to the output. Works only in widget mode; on timeout/closed tab it errors (on_error).
Type in the graph: widget_function
Exec
An error branch can be enabled (expose_error_output) to handle failures on their own path.
Ports can be split into separate execution and data handles.
Try it
Minimal working workflow
- Execute + Data
Runs as pasted
When to use it
This node calls a JS function on the page where the widget is embedded: read the cart, look at form fields, highlight an element, open a modal. Reach for it when the call must happen every time and exactly at this point of the graph. When the model should decide instead, use Widget tools: the same browser bridge, but the functions are offered to the agent as tools. Code (JavaScript) has nothing to do with the visitor’s page — that code runs on the server in an isolated sandbox.
How it works
The function has to be declared in the widget embed snippet through
flowWidget.defineFunction (see Embeddable widget). The platform never
sees the list of declared names at design time, so Function name is matched byte for byte
at run time: a typo, a different case or a stray space reaches the browser as an unknown
function.
At execution the node sends a request to the visitor’s browser over the already open chat connection and waits for the answer — up to Timeout (seconds) (1 to 300, 30 by default). Whatever the handler returns goes straight to the output.
The Arguments (JSON / Jinja) field overrides the Input port: leave it empty and the
value arriving on the port becomes the arguments; fill it in and it is rendered through Jinja
and parsed as JSON. A whole-template value ({{ nodes.<id>.output }}) is passed as an object
rather than a string; when the JSON cannot be parsed, the text is sent as it is.
Common mistakes
- Running outside the widget. In the editor’s test panel, in chat and in Telegram there is nobody to answer — the node fails immediately with an explicit message. Test it on a page with the widget installed.
- A closed tab. No answer will arrive, and the node dutifully waits out the whole timeout.
- The error output left off. The “Error output” switch is off by default, and without a
wired
Errorbranch a failed function aborts the whole run. - A heavy handler. Raise the timeout (up to 300 s), but remember that the run’s own limits still apply.
- Large arguments. The serialized arguments are capped at 256 KB — pass an identifier rather than the whole data set.
Inputs
| Port | Wire | Payload | Notes |
|---|---|---|---|
Inputinput | Execute + Dataexecute_data | — | Run trigger; its value is used as arguments when none are set. |
Outputs
| Port | Wire | Payload | Notes |
|---|---|---|---|
Outputoutput | Execute + Dataexecute_data | any |
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
Function namefunction_name | string | "" | The `name` the host page passed to flowWidget.defineFunction({ name, handler, … }) in its embed snippet — see EMBED_SDK.md. The platform never sees the list of declared names at design time, so this is matched byte for byte at run time: a typo, a different case or a stray space reaches the browser as an unknown function and the node fails. |
Arguments (JSON / Jinja)arguments | string | "" | Arguments passed to the function as an object. Supports Jinja ({{inputs.input}}, {{nodes.x.output}}). When non-empty it REPLACES the value arriving on the Input port; leave it empty to forward that value as the arguments. supports templates |
| Advanced | |||
Timeout (seconds)timeout_seconds | integer | 30 | How long to wait for the browser to return a result before failing. |
Shared fields
Every node has these three — the platform adds them, not the node author.
expose_error_output— When enabled, show an execution output to connect nodes that run if this step fails.split_ports_in— Show separate execution and data input handles instead of one combined port.split_ports_out— Show separate execution and data output handles instead of one combined port.