> KASClient > App

Module: App

Index

Functions


Functions

cancelAttachmentDownloadAsync

cancelAttachmentDownloadAsync(attachment: KASAttachment, callback: function): void

Cancel a download operation queued for an attachment

Sample Usage

 var attachmentsList = JSON.parse(form.properties[0].value);
 for (var i = 0; i < attachmentsList.length; i++)
 {
      var attachmentItem = attachmentsList[i];
      var attachment = KASClient.KASAttachment.fromJSON(attachmentItem);
      KASClient.App.cancelAttachmentDownloadAsync(attachment);
 }

Parameters:

Name Type Description
attachment KASAttachment -
callback function with error param - error string in case of error; null otherwise

Returns: void


deleteActionLocalCacheAsync

deleteActionLocalCacheAsync(actionLocalCacheProps: KASActionLocalCacheProp, callback: function): void

Delete the given key form the local data cache

Parameters:

Name Type Description
actionLocalCacheProps KASActionLocalCacheProp property of data to be deleted from cache
callback function callback with below parameters: ** @param {boolean} success indicates if the update is successful or not ** @param {string} error json string for the KASError object containing error code and/or description.

Returns: void


deleteDataFromTmpDirAsync

deleteDataFromTmpDirAsync(filePath: string, callback: function): void

Deletes file from temporary cache storage. Used in conjunction with API saveDataInTmpDirAsync for the files stored using this API.

Sample Usage

KASClient.App.deleteDataFromTmpDirAsync(filePath, function (success, error) {
    if (error == null && success) {
       // Action's code in success case
     }
});

Parameters:

Name Type Description
filePath string filepath which should be read
callback function with below parameters:

Returns: void


dismissCurrentScreen

dismissCurrentScreen(): void

Dismiss the current opened Action's screen (Creation, Response, or Summary)

Returns: void


downloadAttachmentAsync

downloadAttachmentAsync(attachment: KASAttachment, callback: function): void

Download the attachment specified

Sample Usage

var imageAttachment =  new KASClient.KASAttachment();
imageAttachment.type = KASClient.KASAttachmentType.Image;
imageAttachment.serverPath = "<server path>";
imageAttachment.fileName = "<file name>";
KASClient.App.downloadAttachmentAsync(imageAttachment, function(downloadedAttachment, error){
     if (!error) {
        console.log(downloadedAttachment); //KASAttachment
     }
});

Parameters:

Name Type Description
attachment KASAttachment attachment with a valid server path to download
callback function callback on download completion with below params

* @param {KASAttachment} downloadedAttachment the attachment that got downloaded

* @param {string} error message in case of error, null otherwise

Returns: void


fetchTenantUserAttributeDetailsAsync

fetchTenantUserAttributeDetailsAsync(callback: function): void

Fetches the tenant attribute details. Tenant of the conversation in context will be used for this.

Note

The Action should belong to the same tenant of the conversation and the user needs to be logged into that tenant for this api to work

Sample Usage

KASClient.App.fetchTenantUserAttributeDetailsAsync(function(tenantAttributes, error) {
    if (error == null && tenantAttributes.length > 0) {
        var tenantAttribute = tenantAttributes[0]; // TenantAttribute
        console.log(tenantAttribute.id + " : " + tenantAttribute.name);
    }
});

Parameters:

Name Type Description
callback function with below parameters:

* @param {TenantAttribute[]} tenantAttributes array of tenant attributes

* @param {string} error message in case of error, null otherwise

Returns: void


fetchTenantUserProfilesAsync

fetchTenantUserProfilesAsync(userIds: string[], callback: function): void

Fetches the tenant attributes of the given users. Tenant of the conversation in context will be used for this.

Note

The Action should belong to the same tenant of the conversation and the user needs to be logged into that tenant for this api to work

Sample Usage

// Fetch current user's tenant profile
KASClient.App.fetchTenantUserProfilesAsync(null, function(tenantUserProfiles, error) {
    if (error == null && tenantUserProfiles.length > 0) {
        var userProfile = tenantUserProfiles[0]; // TenantUserProfile
        var tenantAttributeData = userProfile.tenantAttributeDataList[0]; // TenantAttributeData
        console.log(tenantAttributeData.attributeId + " : " + tenantAttributeData.attributeValue);
    }
});

Parameters:

Name Type Description
userIds string[] array of user ids; if it's null or empty, current user's tenant profile will be fetched
callback function with below parameters:

* @param {TenantUserProfile[]} tenantUserProfiles array of users' tenant profiles (attribute id-value pairs)

* @param {string} error message in case of error, null otherwise

Returns: void


generateBase64ThumbnailAsync

generateBase64ThumbnailAsync(localPath: string, callback: function): void

Generates Base64 thumbnail for an image whose localPath is given

Sample Usage

KASClient.App.generateBase64ThumbnailAsync(localPath, function (thumbnail, error) {
    if (error == null && thumbnail != null) {
       //use the thumbnail data and update required dom
     }
});

Parameters:

Name Type Description
localPath string localPath for the imageAttachment whose thumbnail needs to be generated
callback function with below parameters:

* @param {string} thumbnail the base64 value

* @param {string} error message in case of error, null otherwise

Returns: void


generateUUIDAsync

generateUUIDAsync(callback: function): void

Gets the new UUID

Sample Usage

 KASClient.App.generateUUIDAsync(function (uuid, error) {
    console.log("generatedUUIDAsync", uuid);
    ...
 });

Parameters:

Name Type Description
callback function with below parameters:

* @param {string} uuid newly generated uuid

* @param {string} error message in case of error, null otherwise

Returns: void


getActionLocalCacheAsync

getActionLocalCacheAsync(actionLocalCacheProps: KASActionLocalCacheProp, callback: function): void

Retrieves the given key to the local data cache Value is saved at the level mentioned in KASActionLocalCacheProp accordingly

Parameters:

Name Type Description
actionLocalCacheProps KASActionLocalCacheProp property of data to be retrieved from cache
callback function callback with below parameters: ** @param {KASActionLocalCacheProp} actionLocalCacheProps indicates if the update is successful or not ** @param {string} error json string for the KASError object containing error code and/or description.

Returns: void


getAppLocaleAsync

getAppLocaleAsync(callback: function): void

Gets the current app locale, the language in which the app is rendered, useful for localizing MiniApp's strings

Parameters:

Name Type Description
callback function with below parameters:

* @param {string} locale can be null in case of error

* @param {string} error message in case of error, null otherwise

Returns: void


getCalendarNameAsync

getCalendarNameAsync(callback: function): void

Gets the current system calendar setting. This is mainly for iOS to identify the calendar name set in phone setting like Gregorian or Japanese or Buddhists.

Parameters:

Name Type Description
callback function with below parameters:

* @param {string} calendarName can be null in case of error

* @param {string} error message in case of error, null otherwise

Returns: void


getConversationDetailsAsync

getConversationDetailsAsync(callback: function): void

Gets conversation related properties

Parameters:

Name Type Description
callback function with below parameters:

* @param {KASConversationDetails} result conversation properties

* @param {string} error json string for the KASError object containing error code and/or description.

Returns: void


getCurrentDeviceLocationAsync

getCurrentDeviceLocationAsync(callback: function, canUseCachedLocation?: boolean): void

Gets the current device location

Sample Usage

 KASClient.App.getCurrentDeviceLocationAsync(function (location, error){
     if(error != null) {
          return;
     }
     //use location(KASLocation) as the device location
 }, false);

Parameters:

Name Type Default value Description
callback function - with below parameters:

* @param {string} location can be null in case of error

* @param {string} error message in case of error, null otherwise
Default value canUseCachedLocation boolean false (optional, default if false) if this flag is true, platform may choose to return a cached location of upto 30min old in case there's an error while fetching current location

Returns: void


getCurrentLocale

getCurrentLocale(): string

Returns: string


getDeviceIdAsync

getDeviceIdAsync(callback: function): void

Gets deviceId

Parameters:

Name Type Description
callback function with below parameters:

* @param {string} deviceId got from integeration service

* @param {string} error message in case of error, null otherwise

Returns: void


getDeviceLocationAsync

getDeviceLocationAsync(callback: function): void

Gets the previously stored device location

Parameters:

Name Type Description
callback function with below parameters:

* @param {string} location can be null in case of error

* @param {string} error message in case of error, null otherwise

Returns: void


getFontSizeMultiplierAsync

getFontSizeMultiplierAsync(callback: function): void

Gets the font size multiplier for large text. Current only required by iOS.

Parameters:

Name Type Description
callback function with below params

* @param {string} multiplier

* @param {string} error message in case of error, null otherwise

Returns: void


getForwardContextAsync

getForwardContextAsync(callback: function): void

Gets Forward Context details such as : Card Creation is in forwarded mode

Parameters:

Name Type Description
callback function with below parameters:

* @param {Json} returns the Context Details in Json structure

Returns: void


getIsAppTimeFormat24HoursAsync

getIsAppTimeFormat24HoursAsync(callback: function): void

Gets the current app time format is 24hours or not, the time format selected by user, useful for formatting date time strings properly

Parameters:

Name Type Description
callback function with below parameters:

* @param {string} isAppTimeFormat24Hours can be null in case of error

* @param {string} error message in case of error, null otherwise

Returns: void


getLocalizedStringsAsync

getLocalizedStringsAsync(callback: function): void

Gets the localized strings' dictionary based on current app locale. Strings must be provided inside the package with names like: strings_en.json, strings_hi.json, etc.

Sample Usage

KASClient.App.getLocalizedStringsAsync(function (strings, error) {
    if (error != null) {
        return;
    }
    //use the localized strings array
});

Parameters:

Name Type Description
callback function with below parameters:

* @param {JSON} strings can be null in case of error

* @param {string} error message in case of error, null otherwise

Returns: void


getLocationAddressAsync

getLocationAddressAsync(params: KASLocationAddressParams, callback: function): void

Get address string for specified coordinates

Sample Usage

var params = new KASClient.KASLocationAddressParams();
params.latitude =  <latitude value>;
params.longitude =  <longitude value>;
KASClient.App.getLocationAddressAsync(params,
    function (address, error) {
        if (!error) {
           // do something with address - a JSON returned by google structure can be found at https://developers.google.com/maps/documentation/geocoding/intro#GeocodingResponses
        }
    }
});

Parameters:

Name Type Description
params KASLocationAddressParams KASLocationAddressParams
callback function callback on address fetch with below params

* @param {JSON} location a json containing latitute longitude and other informaion

* @param {string} error message in case of error, null otherwise

Returns: void


getMapImageAsBase64Async

getMapImageAsBase64Async(params: KASLocationStaticMapImageParams, callback: function): void

Download the base 64 image of map for the coordinates specified

Sample Usage

KASClient.App.getMapImageAsBase64Async(params, function (attachmentString, error) {
        if (!error) {
            blobString = "data:image/jpeg;base64," + attachmentString;
            //use blobString as base64 data
        }
 });

Parameters:

Name Type Description
params KASLocationStaticMapImageParams KASLocationStaticMapImageParams
callback function on download completion with below params

* @param {string} attachmentString base64 value of the attachment

* @param {string} error message in case of error, null otherwise

Returns: void


getO365UserDetailsAsync

getO365UserDetailsAsync(callback: function): void

Gets details of current logged-in O365 user

Parameters:

Name Type Description
callback function with below parameters:

* @param {Json} returns the UserDetails in Json structure

Returns: void


getPackageCustomSettingsAsync

getPackageCustomSettingsAsync(callback: function): void

Gets all the customization settings for a package (Used in case of Type-4 packages and their base).

Sample Usage

KASClient.App.getPackageCustomSettingsAsync(function (settings, error) {
      if (error != null) {
          return;
      }
     //settings contains the settings json defined at the package level
});

Parameters:

Name Type Description
callback function with below parameters:

* @param {JSON} settings can be null in case of error

* @param {string} error message in case of error, null otherwise

Returns: void


getUsersDetailsAsync

getUsersDetailsAsync(userIds: string[], callback: function): void

Gets users' details (name, pic, phone number, etc.) against their ids

Sample Usage

var userIds = ["<uid1>", "<uid2>",...];
KASClient.App.getUsersDetailsAsync(userIds, function (users, error) {
      if (error != null) {
          return;
      }
      var userInfo1 = users[<uid1>];
      var userInfo2 = users[<uid2>];
      ...
  });

Parameters:

Name Type Description
userIds string[] array of user ids
callback function with below parameters:

* @param {Dictionary<UserId: string, UserInfo: KASUser>} userIdToInfoMap (users' details against their ids) can be null in case of error

* @param {string} error message in case of error, null otherwise

Returns: void


hideProgressBar

hideProgressBar(): void

Hides the current progress bar, if any

Returns: void


isAttachmentDownloadingAsync

isAttachmentDownloadingAsync(attachment: KASAttachment, callback: function): void

Download the attachment specified

Sample Usage

var attachmentJson = {
  ty: 3,
  afn: "131490_Desert (1) (4).pdf",
  lpu: "",
  spu: '<server path>',
  asb: 846941,
  id:''
};
var attachment = KASClient.KASAttachment.fromJSON(attachmentJson);
KASClient.App.isAttachmentDownloadingAsync(attachment, function(isAttachmentDownloadingOrDownLoaded, error){
     if (!error) {
        console.log(isAttachmentDownloadingOrDownLoaded); //boolean
     }
});

Parameters:

Name Type Description
attachment KASAttachment attachment with a valid server path to download
callback function callback on download completion with below params

* @param {boolean} isAttachmentDownloadingOrDownLoaded flag representing if attachment is downloading/downloaded

* @param {string} error message in case of error, null otherwise

Returns: void


isAuthenticationTyepSupportedAsync

isAuthenticationTyepSupportedAsync(authenticationType?: KASAuthenticationType, callback: function): void

Checks if authentication of type is possible or not.

Parameters:

Name Type Default value Description
Default value authenticationType KASAuthenticationType KASAuthenticationType.None type of authentication.
callback function - with below parameters:

* @param {boolean} isSuccessful true if finger printing is possible

* @param {string} reasonCode reason code why finger print is not possible

Returns: void


isTalkBackEnabledAsync

isTalkBackEnabledAsync(callback: function): void

Gets whether talkback is enabled or not

Parameters:

Name Type Description
callback function with below parameters:

* @param {boolean} talkBackEnabled true if talkback is enabled

Returns: void


logToReport

logToReport(data: string): void

Logs data for "Send report"

Parameters:

Name Type Description
data string string

Returns: void


openAttachmentImmersiveView

openAttachmentImmersiveView(attachmentObj: KASAttachment): void

Open attachment in Immersive view.

Parameters:

Name Type Description
attachmentObj KASAttachment

Returns: void


openImmersiveViewForAttachmentList

openImmersiveViewForAttachmentList(attachmentList: KASAttachment[], atIndex?: number): void

Open attachment in Immersive view.

Parameters:

Name Type Default value
attachmentList KASAttachment[] -
Default value atIndex number 0

Returns: void


performAuthenticationAsync

performAuthenticationAsync(authenticationType?: KASAuthenticationType, callback: function): void

If authentication type is allowed, this API performs the authentication and returns success/false status else it returns an error string with reason why authentication is not possible.

Sample Usage

KASClient.App.performAuthenticationAsync(KASAuthenticationType.Password, function (isSuccessful, reasonCode) {
      if (!isSuccessful) {
          console.log(resonCode);
      }
});

Parameters:

Name Type Default value Description
Default value authenticationType KASAuthenticationType KASAuthenticationType.None type of authentication.
callback function - with below parameters:

* @param {boolean} isSuccessful true if the form is not yet expired

* @param {string} reasonCode reason code in case of error, null otherwise

Returns: void


performHTTPRequest

performHTTPRequest(url: string, parametersJSON: string, callback: function): void

performs an http request and returns the response as specified below:

Sample Usage

var url = "<url>";
var parametersJson = JSON.stringify({ "method" : "GET" });
KASClient.App.performHTTPRequest(url, parametersJson, function (response, error) {
      if (!error) {
          //use the response
      }
});

Parameters:

Name Type Description
url string base url to open
parametersJSON string jsonstring containing parameters can be given as null.

If given as null a request to the url provided above will be made. Parameters include request header,query parameters(default blank), request method(default GET) and request body(The body to be posted if request method is POST. default blank.) The keys for parameters are:

a.) "method" : request method. example: "POST". defaults to "GET".

b.) "requestBody": body of request in case of "POST". defaults to blank.

c.) "requestHeaders": headers to be sent with request. should be a json with
key as request header and value as the desired value. defaults to blank.

d.) "queryParameters": query parameters. will be encoded in url. should be a json with
key as parameter name and value as its value. defaults to blank.

e.) "requestResourcePath": will be appended to base url. default is blank.
callback function callback with below parameters:

* @param {string} response response body returned

This could have two possible config:

If request was a success it returns jsonstring with following keys:

a.) "HttpResponseCode" : The response code of request.

b.) "HttpResponseHeader": The response HTTP headers

c.) "HttpResponseBody": The response body returned for request.

If there was a Network error then it returns:

a.) "HttpErrorCode": The error code

b.) "HttpErrorMessage": The error message eg. Malformed URL, Cannot connect to host etc.

* @param {string} error error if any : This includes the standard error code defined in KASClient documentation.

Returns: void


printf

printf(main: string, ...args: any[]): string

Returns a string.

Parameters:

Name Type Description
main string
Rest args any[] array of arguments.

Returns: string


readDataFromTmpDirAsync

readDataFromTmpDirAsync(filePath: string, callback: function): void

Reads file content as base64 from temporary cache storage. Used in conjunction with API saveDataInAppCacheAsync for the files stored using this API.

Sample Usage

KASClient.App.readDataFromTmpDirAsync(filePath, function (base64Data, error) {
    if (error == null) {
       // Action's code in success case
     }
});

Parameters:

Name Type Description
filePath string filepath which should be read
callback function with below parameters:

Returns: void


readTalkBackMessage

readTalkBackMessage(talkBackMessage: string): void

Reads the text if TalkBack/VoiceOver enabled

Parameters:

Name Type
talkBackMessage string

Returns: void


registerHardwareBackPressCallback

registerHardwareBackPressCallback(callback?: function): void

Registers a callback to be executed on hardware back button press (for Android)

Parameters:

Name Type Default value Description
Default value callback function null method to be executed

Returns: void


saveDataInTmpDirAsync

saveDataInTmpDirAsync(base64Data: string, fileName: string, callback: function): void

Saves base64 data on device with given filename. Actions can use this API to store data temporarily on device storage which can be referred in form/response/properties update payloads in that session. Note that this data is stored on local temp cache directory and can be deleted by device OS without warning in low storage scenarios. The maximum lifetime for this storage is within one session of the action. Once the screen dismisses, this data is cleared off. Typically, action can use this storage to save base64 image/ audio data on storage and refer that path in survey json/ response and client will make sure that it gets uploaded to service in message sending flow.

Sample Usage

KASClient.App.saveDataInTmpDirAsync(base64Data, fileName, function (filePath, error) {
    if (error == null) {
       // Action's code in success case
     }
});

Parameters:

Name Type Description
base64Data string base64 data to be stored.
fileName string fileName including relevant extension which should be used to store the data. File name maximum length allowed is 15 and it can only contain alphanumeric characters, underscores, hifen and dots i.e. "a-zA-Z0-9_.-". For example, file1.mp3
callback function with below parameters:

Returns: void


setNativeToolbarProperties

setNativeToolbarProperties(properties: KASNativeToolbarProperties): void

Sets few properties when using native toolbar

Sample Usage

var nativeToolbarProps = new KASClient.KASNativeToolbarProperties();
nativeToolbarProps.icon = "<image>"
nativeToolbarProps.title = "<title>";
nativeToolbarProps.subtitle = "<subtitle>";
KASClient.App.setNativeToolbarProperties(nativeToolbarProps);

Parameters:

Name Type Description
properties KASNativeToolbarProperties

Returns: void


setUserStrings

setUserStrings(strings?: JSON): void

Parameters:

Name Type Default value
Default value strings JSON null

Returns: void


showAttachmentPickerAsync

showAttachmentPickerAsync(supportedTypes: KASAttachmentType[], props: JSON, callback: function): void

Displays an attachment picker in the native layer

Sample Usage

var attachmentsTypesToShow = [];
attachmentsTypesToShow.push(KASClient.KASAttachmentType.Image);
attachmentsTypesToShow.push(KASClient.KASAttachmentType.Document);
attachmentsTypesToShow.push(KASClient.KASAttachmentType.Audio);
KASClient.App.showAttachmentPickerAsync(attachmentsTypesToShow, null, function (selectedAttachments, error) {
      if (error != null) {
                      return;
      }
      if (selectedAttachments && selectedAttachments.length > 0) {
          for (var i = 0; i < selectedAttachments.length; i++) {
              if (selectedAttachments[i].type == KASClient.KASAttachmentType.Image) {
                    this.imageAttachmentList.push(selectedAttachments[i]);
              }
              ...
           }...
      }
});

Parameters:

Name Type Description
supportedTypes KASAttachmentType[] array of supported attachment types for the picker.
props JSON additional props to configure the picker
callback function with below parameters

* @param {KASAttachment[]} selectedAttachments string of selected attachments

* @param {string} error message in case of error, null otherwise

Returns: void


showBarcodeScannerAsync

showBarcodeScannerAsync(callback: function): void

Launches the barcode scanner and returns the scanned object

Parameters:

Name Type Description
callback function with below parameters:

* @param {string} barcodeInfo can be null in case of error

* @param {string} error message in case of error, null otherwise

Returns: void


showContactPickerAsync

showContactPickerAsync(title: string, selectedMutableUser: string[], selectedImmutableUser: string[], isSingleSelection: boolean, callback: function): void

Shows a native contact picker, and returns an array of all the selected users' details

Parameters:

Name Type Description
title string of Contact Picker
selectedMutableUser string[] array of selected userIds
selectedImmutableUser string[] array of fixed selected userIds
isSingleSelection boolean single selection in Contact Picker
callback function with below parameters:

* @param {KASUser[]} selectedUsers (array of user details) can be null in case of error

* @param {string} error message in case of error, null otherwise

Returns: void Array of all the selected users' details (Array of JSON)

Sample Usage

var alreadySelectedUserIds = [];
KASClient.App.showContactPickerAsync("<picker title>", alreadySelectedUserIds, [], true, function (selectedUsers, error) {
    if (error == null && selectedUsers != null && selectedUsers.length > 0) {
        var selectedUser = selectedUsers[0]; //KASUser
        console.log(selectedUser.id);
    }
});

showDurationPickerAsync

showDurationPickerAsync(defaultDurationInMinutes: number, callback: function): void

Shows a native duration picker with day/hour/minute

Parameters:

Name Type Description
defaultDurationInMinutes number the default duration to be shown on picker
callback function with below parameters:

* @param {number} durationInMinutes selected duration in minutes

* @param {string} error message in case of error, null otherwise

Returns: void


showImageImmersiveView

showImageImmersiveView(urls?: string[], currentImageIndex?: number): void

Shows Image in Immersive view.

Sample Usage

var urlArray = ["path1", "path2"];
KASClient.App.showImageImmersiveView(urlArray);

Parameters:

Name Type Default value Description
Default value urls string[] [] Array of images url:
Default value currentImageIndex number 0

Returns: void


showImagePickerAsync

showImagePickerAsync(callback: function): void

Shows a native image picker, and returns the selected image path

Parameters:

Name Type Description
callback function with below parameters:

* @param {string} selectedImagePath can be null in case of error

* @param {string} error message in case of error, null otherwise

Returns: void Selected image location


showLocationOnMap

showLocationOnMap(location: KASLocation): void

shows a particular location as mentioned in KASLocation

Parameters:

Name Type Description
location KASLocation

Returns: void


showNativeErrorMessage

showNativeErrorMessage(message: string): void

Shows a native alert (for iOS) or a toast (for Android) with the message

Parameters:

Name Type Description
message string

Returns: void


showPlacePickerAsync

showPlacePickerAsync(callback: function): void

Shows a native place picker, and returns the selected place (lt, lg, n)

Parameters:

Name Type Description
callback function with below parameters:

* @param {KASLocation} selectedLocation can be null in case of error

* @param {string} error message in case of error, null otherwise

Returns: void


showProgressBar

showProgressBar(text: string): void

Shows a native full sreen progress bar with the given text

Parameters:

Name Type Description
text string

Returns: void


showQRcodeScannerAsync

showQRcodeScannerAsync(callback: function): void

Launches the QR code scanner and returns the scanned object

Parameters:

Name Type Description
callback function with below parameters:

* @param {string} qrCodeInfo can be null in case of error

* @param {string} error message in case of error, null otherwise

Returns: void


showUserProfileAsync

showUserProfileAsync(userId: string, isMiniProfile: boolean, callback: function): void

Shows profile page/details of a user

Parameters:

Name Type Description
userId string of the user whose profile is to be shown
isMiniProfile boolean whether to show mini-profile first
callback function with below parameters:

* @param {boolean} success true if successful, false otherwise

* @param {string} error message in case of error, null otherwise

Returns: void


startChatAsync

startChatAsync(userId: string, callback: function): void

Starts chat with a user

Parameters:

Name Type Description
userId string of the user
callback function with below parameters:

* @param {boolean} success

* @param {string} error

Returns: void


updateActionLocalCacheAsync

updateActionLocalCacheAsync(actionLocalCacheProps: KASActionLocalCacheProp, callback: function): void

Updates/saves the given value against key to the local data cache

Parameters:

Name Type Description
actionLocalCacheProps KASActionLocalCacheProp property of data to be saved in cache
callback function callback with below parameters: ** @param {boolean} success indicates if the update is successful or not ** @param {string} error json string for the KASError object containing error code and/or description.

Returns: void


updateTenantUserProfileAsync

updateTenantUserProfileAsync(attributeDataList: TenantAttributeData[], callback: function): void

Updates the tenant attributes of the current user. Tenant of the conversation in context will be used for this.

Note

The Action should belong to the same tenant of the conversation and the user needs to be logged into that tenant for this api to work

Sample Usage

var tenantAttributeDataList = [
    new KASClient.TenantAttributeData("attribute_id_1", "AttributeValue1"),
    new KASClient.TenantAttributeData("attribute_id_2", "AttributeValue2")
];
KASClient.App.updateTenantUserProfileAsync(tenantAttributeDataList, function(success, error) {
    if (error == null && success) {
        console.log("SUCCESS");
    }
});

Parameters:

Name Type Description
attributeDataList TenantAttributeData[] tenant attribute id-value pairs
callback function with below parameters:

* @param {boolean} success true if successful, false otherwise

* @param {string} error message in case of error, null otherwise

Returns: void