Avatar
Voximplant Avatar class (machine learning powered bot engine which allows your system to handle natural conversations with customers).
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 is designed to react to the VoximplantAvatar.Events.Reply event: often, after the avatar replies to a user, the dialogue is moved to the next state.
Parameters
stateName:
string
Name of the next state
Returns
type:
Promise<void>
handleTimeout
handleTimeout(): Promise<void>
Triggers the AvatarState.onTimeout callback function in the avatar scenario.
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
OptionalOptional. Handler function. If not specified, all handler functions are removed
Returns
type:
void
start
start(): void
Transfers control to the avatar, so it starts a conversation. Should be called only after the VoximplantAvatar.Events.Loaded event is triggered.
Returns
type:
void