Skip to main content

Triage

The Triage is an Onlive solution that allows you to create a flow where the customers can be guided through a series of questions to help them find the best solution for their needs.

One triage is composed by nodes interconnected by transitions. Each node represents a step in the flow and can have a question with multiple answers, or a list of data input fields.

All nodes have common properties, such as:

{
"id": "node-id",
"initialNode": false, // optional field to define if the node is the initial node of the triage
"finalNode": false, // optional field to define if the node is the final node of the triage
"type": "node-type", // should be one of the types described below
"title": "Node Title", // should be an string or an object with translations
"content": "Node Description", // should be an string or an object with translations
"footerContent": "Footer information", // optional field to define a footer content in HTML format
"contextFeed": [
// list of context feed items
],
"stageId": "stage-id", // optional field to group nodes in stages,
"translations": {
// list of translations for keys defined in the node
},
"actions": [
// list of actions
],
"nonWorkingHoursNextNodeId": "node-id", // optional field to define the next node when the triage is out of working hours
}

Triages Context

The triage context is a set of variables that can be used to store information during the triage execution. The context can be used to store information like the user's name, email, or any other that is relevant to the triage.

The context can be updated using two different fields:

  • contextFeed: to update the context using external sources
  • context: to define a set of variables to be stored in the context

ContextFeed field

The contextFeed field define a list of external sources that will provide data to the triage context. You can use external API like Onlive API or any other source to feed the context.

The contextFeed is a list of objects with the following fields:

{
"name": <string>, // variable name to store in the context
"source": <onliveApi|calendarApi>, // source name implemented in the triage
"path": <string>, // path to the data in the source
"params": <object> // optional field to define parameters to the API call
}

For example:

{
"contextFeed": [
{
"name": "geoLocationItems", // variable name to store in the context
"source": "onliveApi", // Onlive API source
"path": "/taxonomies/market/children" // API path
},
{
"name": "serviceItems",
"source": "onliveApi",
"path": "/taxonomies/market/children",
"params": { // optional field to define parameters to the API call
"query": {
"dealerId": "{{dealerId}}"
}
}
}
]
}

Context field

We have another way to update the context using the context field in the triage definition, this field allows you to define a set of variables to be stored in the context. For example:

{
"context": {
"bookingTitle": {
"en": "Appointment from cms with {{firstName}}",
"es": "Cita desde el cms con {{firstName}}"
},
"bookingDescription": {
"en": "Testing custom description for events.Phone:{{phone}}",
"es": "Test de descripcion personalizada.Telefono:{{phone}}"
}
},
}

The values can be specified using template parameters.

Reserved fields

Some reserved values of the context establish certain behaviors in Triage.

  • trackingFields: Allows you to specify additional values that will be included in the sending of the tracks.
{
trackingFields: {
extraField: "{{field.key}}"
}
}
  • trackingFieldsByType: Similar trackingFields, but allows to specify the sending of additional tracking fields for specific track types.
{
trackingFields: {
"node_impression": {
extraField: "{{field.key}}"
}
}
}
  • persistStage: Specifies whether the current stage should be remembered, which allows the user to resume triage from that node if the page is reloaded. Default is true.
  • persistContext: Determines whether the current node's context values should be remembered, allowing the user to auto-complete in future interactions. Default is true.
  • sendLostOpportunity: It can be set to true to indicate that on reaching this node a lost opportunity request should be sent.

Actions

Pipeline

The pipeline actions allows you to define a sequence of actions to be executed in a specific order.

{
"pipeline": [
{
"function": <string>, // should be one of the functions described below
"params": <object>, // optional field to define the parameters of the function
}
]
}
FunctionDescription
validateCodeValidates a code.

example:

{
"pipeline": [
{
"function": "validateCode",
"params": {
"email": "{{guestEmail}}",
"code": "{{code}}"
}
},
{
"function": "scheduleAppointment",
"params": {
"email": "{{guestEmail}}",
"title": "New appointment with {{agentName}}"
},
"options": {
"errorCodes": {
"MULTIPLE_APPOINTMENT_NOT_ALLOWED": {
"en": "You already have an appointment scheduled",
"es": "Ya tienes una cita programada"
}
}
}
},
]
}

Conditional actions

It uses the conditions parameter to display an action according to certain conditions. By default if no or or and linking operator is used, conditions are evaluated using the logical AND operator.

{
"id": "action_id",
"type": "forward",
"conditions": [
{
"exists": {
"valueA": "{{valueOnContext}}",
"valueB": true
}
},
{
"equal": {
"valueA": "{{valueOnContext}}",
"valueB": 0
}
}
]
}

Use the union operators or or and to create complex expressions. The operators can be used nested.

{
"id": "action_id",
"type": "forward",
"conditions": [
{
"or": [
{
"exists": {
"valueA": "{{valueOnContext}}",
"valueB": true
}
},
{
"exists": {
"valueA": "{{otherValueOnContext}}",
"valueB": true
}
}
]
}
],
}

Node Types

We have some different types of nodes that can be used in a triage:

  • Logic
  • Form
  • Decision
  • iCall
  • Information
  • AgentSelection
  • iChat
  • Geolocator

Here is an example of a node:

{
"id": "node-id",
"type": "node-type",
"title": "Node Title", // should be an string or an object with translations
"content": "Node Description", // should be an string or an object with translations
"contextFeed": [
{
"name": "geoLocationItems",
"source": "onliveApi",
"path": "/taxonomies/market/children"
}
]
}

Logic

The logical node allows you to evaluate conditions and based on these results execute an action, such as going to a specific next node.

{
"type": "logic",
"cases": [
{
"equal": {
"valueA": "{{property}}",
"valueB": 1
},
"action": {
"nextNodeId": "node-id"
}
},
{
"equal": {
"valueA": "{{property}}",
"valueB": 2
},
"action": {
"nextNodeId": "other-node-id"
}
}
],
"defaultNextNodeId": "fallback-node-id"
}

Evaluation cases can be grouped using operators such as or or and.

{
"type": "logic",
"cases": [
{
"and": [
{
"equal": {
"valueA": "{{property1}}",
"valueB": 1
}
},
{
"equal": {
"valueA": "{{property2}}",
"valueB": 1
}
}
],
"action": {
"nextNodeId": "node-id"
}
}
],
"defaultNextNodeId": "fallback-node-id"
}

Form

A form represents a node that encompasses a collection of data input fields. Users can populate these fields and submit the form, thereby navigating to the subsequent node.

{
"type": "form",
"fields": [
{
"id": <string>, // should be unique in the form
"type": <string>, // should be one of the types described below
"name": <string>, // should be unique in the form and represent the field name
"label": <string|translationObject>, // label of the field
"content": <string|translationObject>, // content used to describe as preambule of the field
"required": <boolean>, // optional field to define if the field is required, false by default
"pattern": <string>, // optional field to define a pattern used to validate the field
}
]
}

Field Types

The following are the types of fields that can be used in a form node:

  • phone: A phone number field.
  • email: An email field.
  • text: A text field.
  • selection: A selection field.
  • date: A date field.
  • gdpr: A GDPR field. Visually, it is a checkbox.
  • memo: A memo field. Visually, it is a text field with multiple lines.

Example

{
"id": "formContactDetails",
"type": "Form",
"fields": [
{
"type": "text",
"required": true,
"name": "firstName",
"label": {
"en": "First name",
"es": "Nombre",
},
"pattern": "^[\\p{L} '.-]*$"
},
{
"type": "text",
"required": true,
"name": "lastName",
"label": {
"en": "Last name",
"es": "Apellido",
},
"pattern": "^[\\p{L} '.-]*$"
},
{
"type": "phone",
"required": true,
"name": "phone",
"label": {
"en": "Phone",
"es": "Teléfono",
},
"phonePrefix": "+34"
},
{
"type": "email",
"required": true,
"name": "email",
"label": {
"en": "Email",
"es": "Correo electrónico",
}
},
{
"type": "gdpr",
"required": true,
"name": "gdpr",
"contentField": false,
"text": {
"es": "Respetamos tu privacidad. Antes de empezar, lee la política de protección de datos Confirma que has leido la <a href=\"https://legal.gml.mx/terminos_condiciones_jacmx.html\" target=\"_blank\">obligación informativa</a> y aceptas el tratamiento de tus datos.",
"en": "We respect your privacy. Before starting, read the privacy policy. Confirm that you have read the <a href=\"https://legal.gml.mx/terminos_condiciones_jacmx.html\" target=\"_blank\">obligation information</a> and accept the treatment of your data."
},
"items": []
}
],
"actions": [
{
"id": "1",
"type": "forward",
"title": {
"en": "Continue",
"es": "Continuar",
},
"priority": "primary",
"nextNodeId": "dataConfirmation",
"name": "continue"
}
],
"stageId": "2",
"stepNumber": 3,
"stepName": "contact-data"
},

Decision

A decision node represents multiple options that the user can choose from. Each option leads to a different node. Visually is represented as a list of buttons, normally in vertical orientation.

Decision Node
{
"type": "Decision",
}

iCall

An iCall node represents a node that allows the user to request a call to an agent or organization.

{
"type": "iCall",
}

Information

An information node represents a node that displays information to the user. It can be used to provide context or instructions to the user.

{
"type": "Information",
}

AgentSelection

An agent selection node represents a node that allows the user to select an agent to communicate with.

{
"type": "AgentSelection",
}

iChat

An iChat node represents a node that allows the user to start a chat with an agent or organization.

{
"type": "iChat",
}

Geolocator

A Geolocator node represents a node that allows the user to share their location with the organization.

{
"type": "Geolocator",
"filters": {
"country": <string>; // optional field to filter the countries that can be selected
"region": <string>; // optional field that determines a region filtering for the operations
"maximumRadius": <number>; // optional field specifying the maximum radius on the distance selector scale
"maxZoom": <number>; // optional field specifying the maximum zoom of the map. Default 14.
"minZoom": <number>; // optional field specifying the minimum zoom of the map. Default null.
"distanceUnit": <'meters' | 'kilometers' | 'miles'>; // optional field specifying the unit of measurement for distances
"showPostalCode": <boolean>; // optional field that determines if the search by zip code should be displayed.
"radiusSelector": {
"initialLocationsToShow": <number>; // optional field to define the number of locations to show initially
"initialDistance": <number>; // optional field that specifies the initial distance at which the range selector would be
"initialLocationsToShow": <number>;
"minDistance": <number>; // optional field to define the minimum distance in meters
"maxDistance": <number>; // optional field to define the maximum distance in meters
"stepDistance": <number>; // optional field specifying the spacing of the distance selector steps
},
"showPostalCodeRegion": <boolean> // optional field to define if the postal code region should be shown in the map. Default is false
"showPostalCodePin": <boolean>; // optional field that determines whether to display the pin on the map for the zip code region
}
}

Example of a Geolocator node:

{
"id": "geolocator",
"type": "Geolocator",
"title": {
"en": "Select your store",
"es": "Selecciona tu tienda"
},
"filters": {
"country": "spain",
"radiusSelector": {
"initialLocationsToShow": 5,
"maxDistance": 10000
},
"persistSelectionVariable": "selectedLocation"
},
"actions": [
{
"id": "1",
"type": "forward",
"title": {
"en": "Select",
"es": "Seleccionar"
},
"priority": "primary",
"nextNodeId": "booking"
}
]
}

Template parameters

Node title, content, context, params, actions url and pipeline function params can be specified in template format.

Variables in the template can be specified with 3 different syntaxes:

  • {{property}}: The native mustache template engine. The context is used to replace the values.
  • [[Text to translate]]: Localized texts, which are translated based on the translations defined in the node and the current language.
  • @{object.nested.key}: Partial selection of an object's properties. The context is used to replace the values.
{
"content": "[[Name]]: {{user.name}}",
"translations": {
"Name": {
"es": "Nombre"
}
}
}
{
"params": {
"form": {
"user": "@{user}",
"policyAccepted": "@{{policy}}"
}
}
}
tip

To assign a particular value to a parameter use @{} for efficiency. Use {{}} instead to create custom strings.

Modifier functions

Modifier functions are additional parameters that can be added to the @{} template selector to transform its values. Use commas to specify more than one function, they are executed preferentially from left to right.

{
value: "@{firstName capitalize}" // 'john' => 'John'
}
//
{
value: "@{users notEmpty,lowercase}" // ['John', '', 'Petter'] => ['john', 'petter']
}
//
{
value: "@{assets concat}" // ['0000', '0001', '0002'] => '0001,0002,0003'
}
//
{
value: "@{ages split,toNumber}" // '20, 21, 22' => [20, 21, 22]
}
  • capitalize: Convert the first letter to capital letters
  • uppercase: Convert all letters to capital letters
  • lowercase: Convert all the letters to lowercase letters
  • reverse: Reverses a text string
  • notEmpty: Removes all empty elements from an array
  • toNumber: Convert to number, array or values
  • toString: Convert to string, array or values
  • toBool: Convert to boolean, array or values
  • toArray: Convert to array
  • split: Convert a comma-separated string into an array
  • concat: Joins an array of elements by comma giving a text string as a result