Skip to main content
At the end of this page, you can insert any captured value into messages, prompts, conditions, API calls, and tool settings.

Before you start

Before you start, sign in to the dashboard and select the organization you want to work in.
  • Open an agent in the builder and select a gambit, so the gambit editor panel is open.

Where variables come from

Every reference uses the form {{namespace.name}}. An optional path after the name selects nested values, as in {{enduser.social.linkedin}}. The variable panel groups references by the source that produced them. The panel shows a group only when the flow has variables for it. The enduser values are filled from the end user’s profile when the conversation starts, on Web and on WhatsApp. For a web conversation, the system group also holds the end user’s location. The country code is system.country, and the region or state code is system.region. The city is system.city, and the IANA time zone, such as Europe/London, is system.timezone. Tars reads these values when the widget page loads and stores them when the conversation is created.

Name the variable a gambit captures

Every gambit names its captured value in the VARIABLE field, next to LABEL at the top of the gambit editor. The name follows the label until you edit it by hand, and it must be unique within the agent. Gambit mastery describes the full editor anatomy. When you rename a variable, Tars rewrites its {{...}} references across messages, conditions, and gambit settings.
Custom code reads variables by bare name, and a rename does not touch those reads. Check every code gambit after you rename a variable.

Insert a variable

The same panel works in every field that accepts variables. In the Messages section, the message toolbar shows the hint @ for variables.
1

Place the cursor where the value should appear

For an agent message, open the gambit’s Messages section and click into a message.
2

Type @ to open the variable panel

The panel opens at the cursor, with a Search variables… box on top. Below it, each group header shows a colored dot, its name, and a count.
The variable panel open over a message field after typing @, with the search box, the System and Marketing group headers, and the End User group expanded to show its variables
3

Find the variable

User Responses starts expanded, and the other groups start collapsed. Select a group header to expand it. Keep typing after the @, or use the search box, to filter and expand every group.
4

Select the variable

Move with the arrow keys and insert with Enter, or click the entry. Press Escape to close the panel without inserting. The panel only offers variables from gambits that lead into the one you are editing.

How an inserted variable renders

The inserted variable becomes a pill that shows the full reference, such as {{enduser.name}}. Each panel group has its own color, and the pill keeps the color of its group. When the conversation runs, the pill resolves to the captured value.
A message in the Messages section containing a color-coded variable pill that reads the full reference, with the grip icon on its left edge
  • Drag a pill by the grip icon on its left edge to move it.
  • Select the pill text to edit the path part in place. Press Enter to apply or Escape to cancel.
  • A path that no test response has confirmed gets a dashed amber outline. Hover it to see the unverified marker.

Fill the API Responses group with real fields

An API Call gambit exposes its captured response under {{api.<variable>...}}, plus .status, .ok, .error, and .raw. To make the panel suggest the real response fields, send a test request first.
1

Open the API Call gambit's Configuration section

Set up the request as usual.
2

Select Test

The Test button sends a real request. The fields of the response become suggestions in the variable panel and in pill path editing.
3

Pick the sampled fields where you need them

The section’s hint counts the fields learned from your last test. Select Clear in the hint to forget the sample.
You can still type any path by hand without a sample. The pill marks it unverified until a test response confirms it.

Verify

Select Test in the builder toolbar to open the Test Mode panel, and run the conversation. The Variables section fills as each step captures a value, and every pill resolves to the value shown there. To force a value mid-run, select the pencil icon next to it, which works for User Responses and Flow Variables. See Test your agent for the full panel.