Custom fields
Deprecated
$response
has been deprecated since version 1.10.10. Use $analytics.setSessionData
to add custom fields in session reports instead.The export of custom fields from the $response
object is available in dialog analytics. The content of these fields is exported together with dialog logs.
Syntax
Specify an object for exporting in $response
, for example in the following format:
$response.<object name to be displayed in the exported data> = $<exported object>
For example:
$response.messageText = $parseTree.text;
Here messageText
is the object name, $parseTree.text
is the exported object.
Export
Navigate to the Analytics project section. In the Response Data Json Path field specify the object name; for the above example this is messageText
.
To export logs, on the Sessions tab click Session log.
Use in a script
- Exporting for telephony: here digits dialed by the client in the tone dialing mode are exported.
patterns:
$Digits = $regexp<d+>
theme: /
state: Main
q!: * start
a: Dial 4 digits in the tone dialing mode
script:
$response.replies.push({
type: 'dtmf',
max: 4,
timeout: 15000
});
state: Digits
q: $Digits
a: you dialed {{$parseTree.text}}!
a: Thanks! Goodbye!
script:
$response.replies.push({
type: 'hangup'
});
$response.dtmf = $parseTree.text;
state: NoDigits
q!: *
event: noDtmfAnswerEvent
a: You have not dialed a number!
go!: /Main
- Client data export: add postprocessing to the script and export the content of
$client
along with the dialog logs.
init:
bind("postProcess", function($context){
$context.response.client = $context.client;
});
theme: /
state: Authorisation
q!: * *start
script:
$session = {};
$client = {};
$client.lastName = "Bruce";
$client.name = "Wayne";
$client.patronymic = "Thomas";
a: Hello! Am I speaking to {{$client.name}} {{$client.patronymic}} {{$client.lastName}}?
Specify the fields to be exported:
View the configurable fields for the session
The Dialogs section for sessions displays custom fields specified in Response Data Json Path.
Specify the custom fields > click Apply.
In the Sessions table the values of the specified custom fields will be displayed along with the search results for each session.
The field values are also displayed in the session data block, if you opened the session page from the search results in the Dialogs section where the custom fields have been specified in Response Data Json Path.