Client SDK

Handlers

// Examples are provided for the Web platform Handle commands sent from the dialog script to the client app

onCommand: function (commandData) { action }

Handle Alan button state changes

onButtonState: function (e) { action }

Handle connection status to the virtual assistant project in the Alan Cloud

onConnectionStatus: function (e) { action }

Handle events received from Alan

onEvent: function (e) { action }

Client API methods (continued)

Activate the Alan button programmatically

activate()

Deactivate the Alan button programmatically

deactivate()

Check the Alan button state

isActive()

Remove the Alan button from the parent element, page (supported on Web, Ionic)

remove()

Check the state of the wake word (supported on iOS, Android)

getWakewordEnabled()

Set the state of the wake word (supported on iOS, Android)

setWakewordEnabled(enabled:boolean)

Client API methods

Send information about the visual state from the client app to the dialog script

setVisualState(visualStateData:object)

Send data or perform actions without a voice command

projectAPI.method = function(p, param, callback) {
 p.userData.data = param.data;
 callback();
};
callProjectApi(method:string, data:object, callback:function)

Play a text message in the client app

playText(text:string)

Send a text message to Alan as the user’s input

sendText(text:string)

Execute a command in the client app

playCommand(command:object)
Comments