Rate this page:

Avatar

Voximplant Avatar class (machine learning powered bot engine which allows your system to handle natural conversations with customers).

Constructors

constructor

Copy URL

Parameters

Methods

addEventListener

Copy URL
addEventListener(event: 

Events

,
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

Returns

  • type:

    void

goToState

Copy URL
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

Copy URL
handleTimeout(): 

Promise<void>

Triggers the AvatarState.onTimeout callback function in the avatar scenario.

Returns

  • type:

    Promise<void>

handleUtterance

Copy URL
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

Copy URL
removeEventListener(event: 

Events

,
callback:

Function

):

void

Removes a handler for the specified VoximplantAvatar.Events event.

Parameters

Returns

  • type:

    void

start

Copy URL
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