DialogflowInstance

Represents a Dialogflow instance. Add the following line to your scenario code to use the class: require(Modules.AI);

View as Markdown

Constructor

1new DialogflowInstance(id: string, parameters: Object)

Parameters

id
stringRequired
parameters
ObjectRequired
1new DialogflowInstance(id: string, parameters: Object)

Parameters

id
stringRequired
parameters
ObjectRequired

Methods

addEventListener

Adds a handler for the specified AI.Events. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.

1addEventListener(event: AI.Events | T, callback: (event: AI._Events[T]) => any): void

Parameters

event
AI.Events | TRequired
callback
(event: AI._Events[T]) => anyRequired

addMarker

Add a Dialogflow speech synthesis playback marker. The AI.Events.DialogflowPlaybackMarkerReached(/docs/references/voxengine/ai/events#dialogflowplaybackmarkerreached) event is triggered when the marker is reached.

1addMarker(offset: number): void

Parameters

offset
numberRequired

id

Returns the dialogflow instance’s id.

1id(): string

removeEventListener

Removes a handler for the specified AI.Events event.

1removeEventListener(event: AI.Events | T, callback?: (event: AI._Events[T]) => any): void

Parameters

event
AI.Events | TRequired
callback
(event: AI._Events[T]) => any

sendMediaTo

Starts sending media (voice) from a Dialogflow participant to the media unit.

1sendMediaTo(mediaUnit: VoxMediaUnit, parameters?: SendMediaParameters): void

Parameters

mediaUnit
VoxMediaUnitRequired
parameters
SendMediaParameters

sendQuery

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

1sendQuery(dialogflowQuery: DialogflowQueryInput): void

Parameters

dialogflowQuery
DialogflowQueryInputRequired

setOutputAudioConfig

Update the audio output configuration.

1setOutputAudioConfig(outputAudioConfig: DialogflowOutputAudioConfig): void

Parameters

outputAudioConfig
DialogflowOutputAudioConfigRequired

setPhraseHints

Set a collection of phrase hints for the intents.

1setPhraseHints(phraseHints: { [id: string]: string }): void

Parameters

phraseHints
{ [id: string]: string }Required

setQueryParameters

Set parameters for the intents.

1setQueryParameters(queryParameters: DialogflowQueryParameters): void

Parameters

queryParameters
DialogflowQueryParametersRequired

stop

Stop and destroy the current Dialogflow instance.

1stop(): void

stopMediaTo

Stops sending media (voice) from a Dialogflow participant to the media unit.

1stopMediaTo(mediaUnit: VoxMediaUnit): void

Parameters

mediaUnit
VoxMediaUnitRequired