Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Saves the survey results on the datacollection dataCollections section of the Contact Object

Parameters:

Name

Mandatory

Type

Description

chat_id

Status
colourRed
titleYES

Status
titleSTRING

Unique chat identifier

surveyResults

Status
colourRed
titleYES

Status
titleOBJECT

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

Status
titleboolean

true in case the survey results are being saved with success, false otherwise

err

Status
titlenull
/
Status
titlestring

if the result is false, contains the error description

Example:

Code Block
languagejs
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);
});