Rate this page:

DialogflowInstance

This class represents an instance of the Dialogflow instance. Add the following line to your scenario code to use the class:

require(Modules.AI);

Methods

addEventListener

Copy URL
addEventListener(event: 

Events

,
callback:

Function

):

void

Add a handler for specific event generated by the specified Dialogflow instance. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler will be called.

Parameters

  • event:

    Events

  • callback:

    Function

    Handler function

Returns

  • type:

    void

addMarker

Copy URL
addMarker(offset: 

number

):

void

Add Dialogflow speech synthesis playback marker. The AI.Events.DialogflowPlaybackMarkerReached event will be triggered when the marker is reached.

Parameters

  • offset:

    number

    Positive/negative offset (ms) from the start/end of media.

Returns

  • type:

    void

removeEventListener

Copy URL
removeEventListener(event: 

Events

,
callback:

Function

):

void

Remove the event handler for specific event generated by the specified Dialogflow instance.

Parameters

  • event:

    Events

    The AI.DialogflowError, AI.DialogflowQueryResult or AI.DialogflowRecognitionResult event.

  • callback:

    Function

    Optional

    Handler function. If not specified, all event listeners are removed

Returns

  • type:

    void

sendMediaTo

Copy URL
sendMediaTo(targetMediaUnit: 

VoxMediaUnit

,
optional:

sendMediaOptions

):

void

Parameters

Returns

  • type:

    void

sendQuery

Copy URL
sendQuery(dialogflowQuery: 

DialogflowQueryInput

):

void

Send a query to the DialogFlow instance. You can send either text string up to 256 characters or the event object with the event name and the additional data.

Parameters

Returns

  • type:

    void

setOutputAudioConfig

Copy URL
setOutputAudioConfig(outputAudioConfig: 

DialogflowOutputAudioConfig

):

void

Update audio output parameter

Parameters

Returns

  • type:

    void

setPhraseHints

Copy URL
setPhraseHints(phraseHints: 

{[id: string]: string}

):

void

Set the collection of phrase hints for the intents.

Parameters

  • phraseHints:

    {[id: string]: string}

    The collection of phrase hints which are used to boost accuracy of speech recognition.

Returns

  • type:

    void

setQueryParameters

Copy URL
setQueryParameters(queryParameters: 

DialogflowQueryParameters

):

void

Set the parameters for the intents.

Parameters

Returns

  • type:

    void

stop

Copy URL
stop(): 

void

Stop and destroy current Dialogflow instance

Returns

  • type:

    void

stopMediaTo

Copy URL
stopMediaTo(targetMediaUnit: 

VoxMediaUnit

):

void

Parameters

Returns

  • type:

    void