...
TEXT
IMAGE
DOCUMENT
MENU
QUICK_REPLY
FORM
Text message
To define a text response, simply select "Text Response" from the possible response options and type one or more messages.
...
Quick reply configured with header, footer, title and three options:
...
Form
To return a form as a response, we use “Custom Payload” to configure the object structure sent.
So, remove the text response and click on the button “Add Responses” and select the option “Custom Paylod” to define the object structure.
The object must have all the following parameters (all required):
Property | Type | Description | ||||
---|---|---|---|---|---|---|
response_to_bot |
| Query sent back to the bot after the form is submitted by the customer | ||||
title |
| title of the form to be displayed | ||||
type |
| must be equal to “form” | ||||
formData |
| array of objects representing the inputs of the form. See table below for details |
formData object:
Property | Type | Description | ||||
---|---|---|---|---|---|---|
customMandatoryErrorMessage |
| label to be displayed in case a mandatory input is not submitted by the customer | ||||
isVisibleAgent |
| indicates if the content is intended or not to be shown to agent for privacy reason | ||||
mode |
| it describes how to use the value field. “manual” the value is used as default value, “auto” it's evaluated as a JS function | ||||
name |
| key name of the input field (must be unique) | ||||
isEditable |
| False if user is not allowed to change default value, true otherwise | ||||
isMandatory |
| true if the field is required, false otherwise | ||||
dc_type |
| Type of field. Supported values are:
| ||||
value |
| if mode is manual it has to be set with an empty string (then it will contain the customer response), if auto it's evaluted as a JS function returning a value | ||||
custom_regexp |
| Regular expression for validating input | ||||
isVisibleCustomer |
| indicates if the field is intended or not to be shown to the customer. (eg: a field with mode “auto” could be hidden) | ||||
label |
| field label to be displayed | ||||
customValidationErrorMessage |
| label to be displayed in case an input is not valid according to the custom_regexp configured |
Example of custom payload:
Code Block | ||
---|---|---|
| ||
{
"response_to_bot": "operatore",
"title": "Titolo Form",
"type": "form",
"formData": [
{
"customMandatoryErrorMessage": "Nome obbligatorio",
"isVisibleAgent": true,
"mode": "manual",
"name": "name",
"isEditable": true,
"isMandatory": true,
"dc_type": "text",
"value": "",
"custom_regexp": "",
"isVisibleCustomer": true,
"label": "Nome",
"customValidationErrorMessage": ""
},
{
"isEditable": true,
"isVisibleAgent": true,
"custom_regexp": "",
"value": "",
"mode": "manual",
"name": "surname",
"isMandatory": true,
"customValidationErrorMessage": "",
"customMandatoryErrorMessage": "Cognome obbligatorio",
"isVisibleCustomer": true,
"dc_type": "text",
"label": "Cognome"
},
{
"isVisibleCustomer": true,
"dc_type": "email",
"value": "",
"isMandatory": true,
"customValidationErrorMessage": "Email non valida",
"mode": "manual",
"isEditable": true,
"label": "Email",
"customMandatoryErrorMessage": "Email obbligatoria",
"isVisibleAgent": true,
"name": "email2",
"custom_regexp": ".*@.*"
}
]
} |