Skip to main content
This reference enumerates every message in the WebView bridge protocol, in both directions. All messages are JSON objects with a type field prefixed tars:.
Handshake sequence where the widget posts a bare tars:ready on mount, the app sends tars:init, the bridge answers with a second tars:ready carrying its capabilities, and a later tars:init is ignored

App → widget messages

tars:init

Starts the bridge session. Only the first tars:init takes effect. The widget answers with tars:ready.

tars:inject

Injects additional userData or context into the running conversation, same shapes as in tars:init. Send it any time after the handshake.

tars:command

Sends a command to the conversation. restart restarts the conversation. set_variable writes one context variable into the running conversation.

Widget → app messages

tars:ready

The widget posts this message twice, and the two carry different fields. The first one arrives when the widget page mounts, and it holds only its type. It tells the app that the page is ready to receive tars:init. The second one is the bridge’s answer to tars:init, and it carries the fields below. Treat only the second one as the handshake, because the capabilities arrive with it.

tars:navigate

Asks the app to navigate to a native route. Fired by a gambit’s navigate bridge event.

tars:data

Delivers captured conversation variables. Fired by a gambit’s data bridge event.

tars:close

Asks the app to dismiss the chat screen. Fired by a gambit’s close bridge event. No payload.

Per-gambit bridge events

With Enable Bridge Events on, each gambit’s editor can attach one bridge event. The event fires when the conversation reaches the gambit. Reaching the same gambit twice in a row fires it once. A loop through another bridge gambit and back fires it again.

Variable interpolation

Route and param strings interpolate conversation variables with the {{scope.key}} syntax, for example {{response.email}} or {{enduser.name}}. One namespace and one key per token.

Chrome control

chrome in tars:init controls the widget header for a native fit.