Saves the survey results on the datacollection dataCollections section of the Contact Object
Parameters:
Name | Mandatory | Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
chat_id |
|
| Unique chat identifier | ||||||||||
surveyResults |
|
| Data Collection Object corresponding to te survey result |
Returns:
Type | Description |
---|---|
JS Promise | A Javascript Promise that return the object described in the table below |
Name | Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
result |
| true in case the survey results are being saved with success, false otherwise | ||||||||
err |
| if the result is false, contains the error description |
Example:
Code Block | ||
---|---|---|
| ||
LIVECHAT.saveSurveyResults(
"CHAT_DEFAULT_fc8a0cde-2155-4a8e-8ef4-8e71ca76c43e",
{
"survey-web-star" : {
"_id":"66068b56aa1b46d6cd75e335",
"id":"survey-web-star",
"title":{
"it-it":"Survey",
"en-gb":"Survey"
},
"dc_mode":"survey_chat",
"next":"",
"datacollection":[
{
"dc_type":"rating_star",
"label":"Dai un voto alla conversazione avvenuta!",
"isMandatory":false,
"isVisibleAgent":false,
"isVisibleCustomer":true,
"isEditable":true,
"custom_regexp":"",
"customMandatoryErrorMessage":"",
"customValidationErrorMessage":"",
"value":"4",
"name":"survey_chat",
"mode":"manual",
"min":0,
"max":5,
"step":1
}
],
"__v":0
}
}
)
.catch(function (err) {
console.log("[CTLIVE WIDGET] [ERROR]", err);
}); |