• Release Notes
  • User
  • Admin
  • Developers
  • Integrations

›JS API

General

  • Overview
  • LiveView / CoBrowsing / Session Recordings

JS API

  • Overview
  • CoBrowsing
  • LiveView / Session Recordings
  • WebChat
  • Web Calling
  • Video Conference
  • Logging
  • User
  • Team
  • API
  • Supported Browsers
  • Supported Technologies

Android

  • Overview
  • Installation
  • Usage
  • Reference
  • Licenses

iOS

  • Overview
  • Installation
  • Usage
  • Reference
  • Licenses

React Native

  • Overview
  • Installation
  • Usage
  • Reference

Cordova

  • Overview
  • Installation
  • Usage

Xamarin

  • Overview
  • Installation
  • Usage
  • Reference

Flutter

  • Overview
  • Installation
  • Usage
  • Reference

Capacitor

  • Overview
  • Installation
  • Usage
  • Reference

JavaScript API - User

The JavaScript user API can be used to tag a user for instance with data from an existing application that requires authentication and to find the status of a user using the API.

User tagging

Users can be tagged using as in the following example:

CV.user.tag({
    "id": "john.doe",
    "email": "john.doe@chatvisor.com",
    "firstname": "John",
    "lastname": "Doe",
    "gender": "male",
    "assignedUser": "mary.doe@company.com",
    "labels": [
        "nice", "handsome"
    ],
    "additionalTaggingData": {
        "title": "Dr.",
        "occupation": "Marketing Director"
    }
    "externalToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMiJ9.QOIr8fJb3DwDNjREBvm8oxdojUuBKbPLgtv1pBs-yIw"
})
ParameterType
valueActiveUser

All fields are optional and can be set according to the information available in the customer application.

ActiveUser object

PropertyTypeDescription
idstringExternal Id for matching (e.g. username)
emailstringE-Mail address of the user
firstnamestringFirst name of the user
lastnamestringLast name of the user
genderstringGender of the user. Possible values are "male", "female", "other" or "none"
labelsstring[]Tags associated with the user (e.g. user group, user id)
assignedUserstringThe agent this user will be automatically assigned to
additionalTaggingDataobjectA key value object of additional information that will be sent to external sources (like Parloa). Property names of the ActiveUser object like f.e. email or gender are not allowed as keys and will be ignored. To delete a field again you can set it to null.
externalTokenstringA token that might verify the user by external sources (like Parloa)

List of active users

This method requires an user token

To get the list of active users with tags that are currently available inside the application the CV.user.list method can be used. A callback function need to be supplied to this method. If the client is authenticated using a user token only assigned users are returned.

CV.user.list(callbackFn)
ParameterType
callbackFn(ActiveUserResult[]) => void

The callback function is then called with the result array as the first argument. The objects inside the array are of the following format:

{
    "id": "john.doe",
    "email": "john.doe@chatvisor.com",
    "firstname": "John",
    "lastname": "Doe"
    "labels": [
        "nice", "handsome"
    ],
    "visitorId": "C0487B22C1967D21D25A8465D27999D5F262951B"
}

ActiveUserResult object

The ActiveUserResult object extends the ActiveUser object with the following properties:

PropertyTypeDescription
visitorIdstringUnique visitor id of this user (i.e. to start a screensharing call)

Status of single user

This method requires an user token

To request the status of an single user that may or may not is available inside the application the CV.user.status method can be called. As the first argument the value of any field in the tag object can be supplied. As the second argument a callback function needs to be provided that will be called with a single result object (same as in the result of CV.user.list) or null if no matching user is found.

In the following example we search for a user by an e-mail address:

CV.user.status("john.doe@chatvisor.com", callbackFn)
ParameterType
searchStringstring
callbackFn(ActiveUserResult) => void

Reset visitor

In the case that a user signs in during a single browser session, the user would be overwritten when CV.user.tag is called for the second time after login. This can be prevented by calling CV.user.reset. This assigns a new visitor id to the browser session and a new user will be created when calling the tag method.

CV.user.reset()
← LoggingTeam →
  • User tagging
    • ActiveUser object
  • List of active users
    • ActiveUserResult object
  • Status of single user
  • Reset visitor
MANUALS
User Manual: Sales Suite
Admin Manual: Sales Suite
User Manual: Support Suite
Admin Manual: Support Suite
DEVELOPERS
Integrations
REST API
SDK API
LEGAL
Privacy Policy
Terms and Conditions
Imprint
Engage
Copyright © 2023 Chatvisor GmbH