Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 2 Next »

Returns the contact object of a currently active chat.

Parameters:

Name

Mandatory

Type

Description

chatId

YES

STRING

Unique chat identifier

Returns:

Type

Description

JS Promise

A Javascript Promise that return an object containing the chat object. See Contact Object

Example:

LIVECHAT.getContactByChatID("CHAT_97656d2c-28b4-41fc-af38-111066cefcaf")
.then(function(data){
  console.log("Chat contact", data);
});

Response example:

{
   "result":true,
   "contact":{
      "id":"CHAT_DEFAULT_cdccec91-7b95-47f4-9b14-b6f8cf944b73",
      "servid":"LiveChat_Popup",
      "ctlive_type":"chat",
      "widgetid":"classic_popup",
      "serv_name":"LiveChat_Popup",
      "domain":"DEFAULT",
      "beginTime":1740412183580,
      "endTime":"",
      "title":"",
      "lang":"it-it",
      "userID":"USER_DEFAULT_MarcoRossi12543",
      "agentID":"USER_gverde1@acd.enghouse.com",
      "contact_events":[
         {
            "event":"newContactAccepted",
            "ts":1740412183881,
            "origin":"USER_DEFAULT_MarcoRossi12543"
         },
         {
            "event":"joinContact",
            "ts":1740412188191,
            "origin":"USER_gverde1@acd.enghouse.com"
         }
      ],
      "users":{
         "USER_DEFAULT_MarcoRossi12543":{
            "id":"USER_DEFAULT_MarcoRossi12543",
            "nickname":"Gabry",
            "isAgent":false,
            "beginTime":1740412183580,
            "endTime":"",
            "isOnline":true,
            "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36",
            "firstUri":"http://localhost:3001/domain/test.html",
            "uriHistory":[
               "http://localhost:3001/domain/test.html"
            ],
            "firstTitle":"LiveChat - Test Page",
            "channel":"web",
            "firstIP":"::1"
         },
         "USER_gverde1@acd.enghouse.com":{
            "id":"USER_gverde1@acd.enghouse.com",
            "nickname":"Gabriele Verde",
            "isAgent":true,
            "beginTime":1740412188007,
            "endTime":"",
            "isOnline":true,
            "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36",
            "firstUri":"http://localhost:3003/AD/AD.html",
            "uriHistory":[
               "http://localhost:3003/AD/AD.html"
            ],
            "firstTitle":"AgentDesktop - Enghouse Interactive",
            "channel":"web",
            "firstIP":"::ffff:127.0.0.1"
         }
      },
      "dataCollections":{
         "67990d2d-5d35-4d7d-93ac-df3d9edb636d":{
            "_id":"5c6e700404445e26d8dbeee1",
            "id":"67990d2d-5d35-4d7d-93ac-df3d9edb636d",
            "title":{
               "it-it":"Anagrafica #1",
               "en-gb":"Data Collection #1"
            },
            "dc_mode":"chat",
            "next":"",
            "datacollection":[
               {
                  "_id":"5c6e700404445e26d8dbeee4",
                  "dc_type":"nickname",
                  "label":{
                     "it-it":"Soprannome",
                     "en-gb":"Nickname"
                  },
                  "isMandatory":true,
                  "isVisibleAgent":true,
                  "isVisibleCustomer":true,
                  "isEditable":true,
                  "custom_regexp":"",
                  "customMandatoryErrorMessage":{
                     "it-it":"Soprannome obbligatorio",
                     "en-gb":"Nickname is mandatory"
                  },
                  "customValidationErrorMessage":{
                     "default":""
                  },
                  "value":"Gabry",
                  "name":"nickname",
                  "mode":"manual"
               },
               {
                  "_id":"5c6e700404445e26d8dbeee3",
                  "dc_type":"name",
                  "label":{
                     "it-it":"Nome",
                     "en-gb":"Name"
                  },
                  "isMandatory":false,
                  "isVisibleAgent":false,
                  "isVisibleCustomer":false,
                  "isEditable":false,
                  "custom_regexp":"",
                  "customMandatoryErrorMessage":{
                     "default":""
                  },
                  "customValidationErrorMessage":{
                     "default":""
                  },
                  "value":"",
                  "name":"name",
                  "mode":"manual"
               },
               {
                  "_id":"66f42d55a315401d12643e69",
                  "dc_type":"info",
                  "label":{
                     "it-it":"",
                     "en-gb":""
                  },
                  "isMandatory":false,
                  "isVisibleAgent":true,
                  "isVisibleCustomer":true,
                  "isEditable":false,
                  "custom_regexp":"",
                  "customMandatoryErrorMessage":{
                     "default":""
                  },
                  "customValidationErrorMessage":{
                     "default":""
                  },
                  "value":"<strong style=\"border: 1px solid; border-radius: 4px; background-color: #99ccf0; color: #f7ecdc; font-style: italic;\">Testo di prova</strong>",
                  "name":"text_info",
                  "mode":"manual"
               },
               {
                  "_id":"5c6e700404445e26d8dbeee2",
                  "dc_type":"surname",
                  "label":{
                     "it-it":"Cognome",
                     "en-gb":"Surname"
                  },
                  "isMandatory":false,
                  "isVisibleAgent":true,
                  "isVisibleCustomer":true,
                  "isEditable":true,
                  "custom_regexp":"",
                  "customMandatoryErrorMessage":{
                     "default":""
                  },
                  "customValidationErrorMessage":{
                     "default":""
                  },
                  "value":"",
                  "name":"surname",
                  "mode":"manual"
               },
               {
                  "_id":"66f42d55a315401d12643e6b",
                  "dc_type":"text",
                  "label":{
                     "it-it":"full",
                     "en-gb":"full"
                  },
                  "isMandatory":false,
                  "isVisibleAgent":true,
                  "isVisibleCustomer":false,
                  "isEditable":true,
                  "custom_regexp":"",
                  "customMandatoryErrorMessage":{
                     "default":""
                  },
                  "customValidationErrorMessage":{
                     "default":""
                  },
                  "value":"Gabry ",
                  "name":"full",
                  "mode":"auto"
               },
               {
                  "dc_type":"text",
                  "label":{
                     "default":"Client name"
                  },
                  "isMandatory":true,
                  "isVisibleAgent":true,
                  "isVisibleCustomer":false,
                  "isEditable":true,
                  "custom_regexp":"",
                  "value":"",
                  "name":"name",
                  "mode":"auto",
                  "min":0,
                  "max":5,
                  "step":1
               }
            ],
            "__v":5
         },
         "fc0450c8-4b2c-42b3-b8c9-04b672ca4a90":{
            "_id":"5c6e700404445e26d8dbeee5",
            "id":"fc0450c8-4b2c-42b3-b8c9-04b672ca4a90",
            "title":{
               "it-it":"Anagrafica #2",
               "en-gb":"Data Collection #2"
            },
            "dc_mode":"chat",
            "next":"",
            "datacollection":[
               {
                  "_id":"5c6e700404445e26d8dbeee8",
                  "dc_type":"email",
                  "label":"Email",
                  "isMandatory":true,
                  "isVisibleAgent":true,
                  "isVisibleCustomer":true,
                  "isEditable":true,
                  "custom_regexp":"",
                  "customMandatoryErrorMessage":{
                     "it-it":"Email obbligatoria",
                     "en-gb":"Email is mandatory"
                  },
                  "customValidationErrorMessage":"",
                  "value":"legal.operations@enghouse.com",
                  "name":"email",
                  "mode":"manual"
               },
               {
                  "_id":"5c6e700404445e26d8dbeee7",
                  "dc_type":"phone",
                  "label":{
                     "it-it":"Numero di telefono",
                     "en-gb":"Phone number"
                  },
                  "isMandatory":false,
                  "isVisibleAgent":true,
                  "isVisibleCustomer":true,
                  "isEditable":true,
                  "custom_regexp":"[0-9]{10}$",
                  "customMandatoryErrorMessage":"",
                  "customValidationErrorMessage":{
                     "it-it":"Numero di telefono non valido",
                     "en-gb":"Invalid phone number"
                  },
                  "value":"",
                  "name":"phone_number",
                  "mode":"manual"
               },
               {
                  "_id":"5c6e700404445e26d8dbeee6",
                  "dc_type":"date",
                  "label":{
                     "it-it":"Data di nascita",
                     "en-gb":"Birthdate"
                  },
                  "isMandatory":false,
                  "isVisibleAgent":true,
                  "isVisibleCustomer":true,
                  "isEditable":true,
                  "custom_regexp":"",
                  "customMandatoryErrorMessage":"",
                  "customValidationErrorMessage":"",
                  "value":"",
                  "name":"birthdate",
                  "mode":"manual"
               }
            ],
            "__v":0
         },
         "f14cb974-eeb0-47e8-bd51-c3e32adb6a40":{
            "_id":"5e81aef78df3ba62c6480e6d",
            "id":"f14cb974-eeb0-47e8-bd51-c3e32adb6a40",
            "title":{
               "it-it":"Anagrafica #3",
               "en-gb":"Data Collection #3"
            },
            "dc_mode":"chat",
            "next":"",
            "datacollection":[
               {
                  "dc_type":"textarea",
                  "label":{
                     "it-it":"Suggerimenti",
                     "en-gb":"Tips"
                  },
                  "isMandatory":false,
                  "isVisibleAgent":true,
                  "isVisibleCustomer":true,
                  "isEditable":true,
                  "custom_regexp":"",
                  "customValidationErrorMessage":"",
                  "customMandatoryErrorMessage":{
                     "it-it":"Per favore, scrivi qualcosa",
                     "en-gb":"Please, write something"
                  },
                  "value":"",
                  "name":"customer_tips",
                  "mode":"manual"
               },
               {
                  "dc_type":"checkbox",
                  "label":{
                     "it-it":"Che veicolo possiedi?",
                     "en-gb":"What vehicle you own?"
                  },
                  "options":{
                     "bike":{
                        "it-it":"bicicletta",
                        "en-gb":"bicycle"
                     },
                     "motorbike":{
                        "it-it":"moto",
                        "en-gb":"motorcycle"
                     },
                     "car":{
                        "it-it":"auto",
                        "en-gb":"car"
                     },
                     "boat":{
                        "it-it":"barca",
                        "en-gb":"boat"
                     },
                     "scooter":{
                        "it-it":"monopattino",
                        "en-gb":"scooter"
                     }
                  },
                  "isMandatory":false,
                  "isVisibleAgent":true,
                  "isVisibleCustomer":true,
                  "isEditable":true,
                  "custom_regexp":"",
                  "customValidationErrorMessage":"",
                  "customMandatoryErrorMessage":"",
                  "value":"",
                  "name":"veichle",
                  "mode":"manual"
               },
               {
                  "dc_type":"radio",
                  "label":{
                     "it-it":"Frutto preferito?",
                     "en-gb":"What's your favourite fruit?"
                  },
                  "options":{
                     "b":{
                        "it-it":"banana",
                        "en-gb":"banana"
                     },
                     "a":{
                        "it-it":"mela",
                        "en-gb":"apple"
                     },
                     "w":{
                        "it-it":"anguria",
                        "en-gb":"watermelon"
                     }
                  },
                  "isMandatory":false,
                  "isVisibleAgent":true,
                  "isVisibleCustomer":true,
                  "isEditable":true,
                  "custom_regexp":"",
                  "customValidationErrorMessage":"",
                  "customMandatoryErrorMessage":{
                     "it-it":"Per favore, scegli un frutto",
                     "en-gb":"Please, choose a fruit"
                  },
                  "value":"",
                  "name":"fruit",
                  "mode":"manual"
               },
               {
                  "dc_type":"select",
                  "label":{
                     "it-it":"Scegli una macchina:",
                     "en-gb":"Choose a car:"
                  },
                  "options":{
                     "audi":"Audi",
                     "fiat":"Fiat",
                     "renault":"Renault"
                  },
                  "isMandatory":true,
                  "isVisibleAgent":true,
                  "isVisibleCustomer":true,
                  "isEditable":true,
                  "custom_regexp":"",
                  "customValidationErrorMessage":"",
                  "customMandatoryErrorMessage":{
                     "it-it":"Per favore, scegli una macchina",
                     "en-gb":"Please, choose a car"
                  },
                  "value":"audi",
                  "name":"manifacture",
                  "mode":"manual"
               }
            ],
            "__v":0
         },
         "12f2eebd-90a8-4549-ae8e-566685ce2604":{
            "id":"bc5be4fc-4a22-400c-99d7-9f1b4228b2f0",
            "title":"",
            "dc_mode":"chat",
            "next":"",
            "datacollection":[
               {
                  "dc_type":"text",
                  "label":"last agent ID",
                  "isMandatory":false,
                  "isVisibleAgent":true,
                  "isVisibleCustomer":false,
                  "isEditable":false,
                  "custom_regexp":"",
                  "customMandatoryErrorMessage":"",
                  "customValidationErrorMessage":"",
                  "value":"gverde1@acd.enghouse.com",
                  "name":"LastAgentID",
                  "mode":"auto"
               }
            ]
         }
      },
      "newContactRequested":true
   },
   "error":null
}
  • No labels