Optimiza tus respuestas para mejores experiencias

A complement is an HTML element which allows us to display visual components on agentbot window. Leveraging its functionalities to improve user experience.
Some of them are:

  • Buttons Complement
  • File Complement
  • FormData Complement
  • Generic Carousel Complement
  • OpenChat Derivation Complement
  • Retargeting
{
 "message": "Hi! I’m a virtual assistant. Are you interested in one
of our awesome products?",
 "type": "message",
 "params": null
}

Fields

Field Description Type Default Required
Message Must be UTF-8 and corresponds to the message that will be sent to the client. String Null No
Type Corresponds to the message type that will be rendered.
It can be “message”, “buttons”, “formData” or any supported complement.
String “Message” No
Params Complement Data Object Object String No

Buttons Complement

The buttons complement allows the user to add buttons to the message to request actions. The buttons can send a message from client to agent, open a URL, or transfer conversation to AgentIQ.

Example

{
	"message": "",
	"type": "buttons",
	"params": {
		"type": "message",
		"blockInput": false,
		"oneChoice": false,
		"data": [{
			"label": "Smartphones",
			"value": "Smartphones"
		}, {
			"label": "TVs",
			"value": "TVs"
		}, {
			"label": "Tablets",
			"value": "Tablets"
		}, {
			"label": "Other products",
			"value": "Other products"
		}]
	}
}

Fields

Field Description Type Default Required
Message Must be UTF-8 and corresponds to the message that will be sent to the client. String Null No
Type Must be “buttons” and corresponds to the message type that will be rendered. String “Message” Yes
Params Buttons Component Object Object Null Yes

Buttons Complement Object

Field Description Type Default Required
BlockInput Block the text field to send message. It can be true or false Boolean False No
OneChoice Allow select a single option. After selecting an option the complement will be blocked. It can be true or false b Boolean False No
QuickReplies Show buttons like a quick replies Boolean False No
Data Array of Button Objects Array Null Yes

Button Object

Field Description Type Default Required
type Type of actions that will be dispatched for buttons.
It can be “message”, “link”, “transferToLive”, “step” or “call”.
If quickReplies is true, button type must by “message” or “link”
String “message” No
label Text to show into button String null Yes
value Value to be sent when dispatch the button event String null Yes
conditions Array of Conditions Array null No

FormData Complement

The form data complement allows the agent to request data to client to
dispatch an event. The form may transfer the conversation to AgentIQ or perform other events that not yet available

Example

{
	"message": "",
	"type": "formData",
	"params": {
		"type": "transfer",
		"blockInput": true,
		"groupId": 123,
		"data": [{
				"ref": "name",
				"label": "Name",
				"type": "text",
				"required": true
			},
			{
				"ref": "email",
				"label": "E-mail",
				"type": "email",
				"required": true
			},
			{
				"ref": "typeofProduct",
				"label": "Type of Product",
				"type": "select",
				"required": true,
				"options": [{
						"label": "Smartphones",
						"value": "1"
					},
					{
						"label": "TVs",
						"value": "2"
					},
					{
						"label": "Tablets",
						"value": "3"
					},
					{
						"label": "Other products",
						"value": "4"
					}
				]
			},
			{
				"ref": "tyc",
				"label": "Terms and Conditions",
				"type": "checkbox",
				"required": true
			}
		]
	}
}

Fields

Field Description Type Default Required
message Must be UTF-8 and corresponds to the message that will be sent to the client. string null No
type Must be “formData” and corresponds to the message type that will be rendered. string “message” Yes
params FormData Component Object object null Yes

FormData Complement Object

Field Description Type Default Required
type Type of actions that will be dispatched to submit form. It can be “transfer” or “step”. string “transfer” No
blockinput Block the text field to send message. It can be true or false. Boolean False No
groupld Grpup Id of AgentIQ to send form data integer null No
data Array of Input Field Objects. Array Default Input Fields Array No
nextStep For forms of steps string null No

Input Field Object

Field Description Type Default Required
ref Input field reference keyword. Should be on lowerCamelCase and written in English. string null Yes
label Text to show into input field. (like a placeholder) string null Yes
type Type of field. It can be “text”, “email”, “number”, “checkbox”, “select” or “search”. string “text” No
required Required field. Validate that the field is not empty. Validate that the text entered corresponds with the type of
field. It can be true or false.
boolean false No
regex Regular expression for validation. Not include the / at the beginning and end of the string. string null No
options Only to inputs with type “select” and “search” Array of Option Objects. array null No
conditions Only to inputs with type “select” and “search” is condition field. boolean null No
error All inputs of any type. This field set the error tooltip message shown when the validation fail. If isn’t setted, a
default message will be shown.
string null No
dependency This object set a relationship between two fields. When the parent match the value, the child field is shown. object null No

Dependency Object

An input with this property object is shown when the parent match his value with the dependency. The object has two properties:

  • ref: The name of the parent field.
  • value: The parent input value. If the parent input value match his child dependency value, then the child is shown.

The required property on an input with dependency property, is only validated when the input is shown.
In the next example, if the user check the subscription field, the two fields (name and email) will shown:

[{
	"message": "",
	"type": "formData",
	"params": {
		"type": "transfer",
		"blockInput": true,
		"groupId": 123,
		"data": [{
				"ref": "subscribe",
				"label": "Subscribe to our Sales Notifications",
				"type": "checkbox",
				"required": true
			},
			{
				"ref": "name",
				"label": "Name",
				"type": "text",
				"required": true,
				"dependency": {
					"ref": "subscribe",
					"value": true
				}
			},
			{
				"ref": "email",
				"label": "E-mail",
				"type": "email",
				"required": true,
				"dependency": {
					"ref": "subscribe",
					"value": true
				}
			}
		]
	}
}]