Avatar
Voximplant Avatar class (machine learning powered bot engine which allows your system to handle natural conversations with users).
Constructors
constructor
Parameters
config:
Methods
addEventListener
addEventListener(event: , callback: Function
): void
Adds a handler for the specified VoximplantAvatar.Events event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.
Parameters
event:
Event class (i.e., VoximplantAvatar.Events.Loaded)
callback:
Function
Handler function. A single parameter is passed - object with event information
Returns
type:
void
goToState
goToState(stateName: string
): Promise<void>
Changes the avatar state to the specified one. This method call is to react to the VoximplantAvatar.Events.Reply event: usually, after the avatar replies to a user, the dialog is moved to the next state.
Parameters
stateName:
string
Name of the next state
Returns
type:
Promise<void>
handleTimeout
handleTimeout(): Promise<void>
Signalizes avatar, that timeout occurred on waiting for user input.
Returns
type:
Promise<void>
handleUtterance
handleUtterance(text: string
): Promise<void>
Sends a user phase to the avatar. In response, the avatar triggers the VoximplantAvatar.Events.Reply event.
Parameters
text:
string
Utterance text
Returns
type:
Promise<void>
removeEventListener
removeEventListener(event: , callback: Function
): void
Removes a handler for the specified VoximplantAvatar.Events event.
Parameters
event:
Event class (i.e., VoximplantAvatar.Events.Loaded)
callback:
Function
OptionalHandler function
Returns
type:
void
start
start(): void
Transfers control to the avatar so that it starts a conversation. Should be called only after the VoximplantAvatar.Events.Loaded event is triggered.
Returns
type:
void