Mergers
The Mergers page in the application allows users to define and manage mergers. Mergers are used to combine data from various variables into a single output, which is then stored in a destination variable. This is useful for constructing complex strings, JSON objects, or XML structures from multiple pieces of information.
Overview
The page provides functionalities to:
- Add new mergers.
- List existing mergers, filtered by the selected agent.
- Edit existing mergers.
- Associate mergers with specific agents.
- Delete mergers.
Adding a New Merger
To add a new merger:
- Navigate to the Mergers page.
- Expand the "New Merger" section.
- A form will appear with the following fields:
- Lookup Names: (Button) Opens a dialog for looking up existing names of variables, prompts, APIs, etc., which can be useful when constructing the merge template.
- Merger Name: (Text Input) A unique and descriptive name for the merger (e.g., "CreateCustomerJSON", "BuildResponseMessage").
- Status: (Toggle) Activates or deactivates the merger. Default is
True
(active). - Agent(s): (Multiselect) Select one or more agents that will be able to use this merger.
- Destination Variable: (Selectbox) The variable where the result of the merge operation will be stored.
- Output Type: (Selectbox) The format of the merged output. Options:
json
,xml
,text
. - Merge Template: (Text Area) The template string that defines how data from variables will be combined. Supports embedding variables using
{var["variableName"]}
. - Example for JSON output:
{"name": "{var["firstName"]} {var["lastName"]}", "email": "{var["emailAddress"]}"}
- Example for text output:
Hello {var["userName"]}, your order number is {var["orderId"]}.
- Click the "Create Merger" button.
- Upon submission, the system stores the merger configuration.
Listing Mergers
Existing mergers are listed under the "Mergers" subheader.
- Filtering: The list is automatically filtered to display mergers associated with the globally selected agent (if an agent is selected).
- Display: Each merger is shown in an expandable section, displaying its name, status (✅ for active, ❌ for inactive), and associated agents.
- Details: Expanding a merger's section reveals:
- Destination Variable
- Output Type
- Merge Template
- Each merger entry has "Edit" and "Delete" buttons.
Editing a Merger
To edit an existing merger:
- Click the "Edit" button next to the desired merger in the list.
- The "Edit [Merger Name]" form will appear, pre-filled with the merger's current information.
- All fields from the "Add Merger" form are available for modification. Additionally:
- Lookup Names: (Button) Available for looking up system names.
- Add Variable: (Button) Opens a dialog to quickly add a new variable if needed during configuration.
- Click "Save Changes" to update the merger or "Cancel" to discard changes and hide the edit form.
Adding an Agent to a Merger
If an agent is selected (via the global agent selector), a section appears allowing you to associate existing mergers (that are not already associated with the selected agent) to that agent.
- A dropdown lists "Available mergers for [Selected Agent Name] Agent:".
- Select a merger and click "Include Merger" to add the selected agent to that merger's
merger_agents
list.
Deleting a Merger
To delete a merger:
- Click the "Delete" button next to the desired merger in the list.
- Confirm the deletion when prompted. The merger will be permanently removed from the database.
Quick Help - Merger Configuration Examples
Mergers are used to combine multiple variables into a single new variable using a template. This is useful for creating formatted strings, JSON objects, or other structured data.
Using Dynamic Variables:
You can embed variables from the agent's session state into the Merge Template field. The syntax is {var["variable_name"]}
.
Example 1: Creating a Full Name (Text Output)
This merger combines a first and last name into a single full_name
variable.
- Merger Name:
build fullname
- Destination Variable:
full_name
- Output Type:
text
- Merge Template:
If var["first_name"]
is "Jane" and var["last_name"]
is "Doe", the full_name
variable will be set to "Jane Doe".
Example 2: Creating a JSON Payload
This merger constructs a JSON object to be used later, perhaps in an API call.
- Merger Name:
create_user_payload
- Destination Variable:
user_api_body
- Output Type:
json
- Merge Template:
{
"user": {
"email": "{var["email"]}",
"profile": {
"firstName": "{var["first_name"]}",
"lastName": "{var["last_name"]}"
}
}
}
This will create a JSON object in the user_api_body
variable.
This documentation should provide a good understanding of how to use the Mergers page.