DialogflowInstance
Represents a Dialogflow instance.
Add the following line to your scenario code to use the class:
require(Modules.AI);
Constructors
constructor
Parameters
id:
string
parameters:
Object
Dialogflow parameters
Methods
addEventListener
addEventListener(event: , callback: Function
): void
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.
Parameters
event:
Event class (i.e., AI.Events.DialogflowResponse)
callback:
Function
Handler function. A single parameter is passed: object with event information
Returns
type:
void
addMarker
addMarker(offset: number
): void
Add a Dialogflow speech synthesis playback marker. The AI.Events.DialogflowPlaybackMarkerReached event is triggered when the marker is reached.
Parameters
offset:
number
Positive/negative offset in milliseconds from the start/end of media
Returns
type:
void
id
id(): string
Returns the dialogflow instance's id.
Returns
type:
string
removeEventListener
removeEventListener(event: , callback: Function
): void
Removes a handler for the specified AI.Events event.
Parameters
event:
Event class (i.e., AI.Events.DialogflowResponse)
callback:
Function
OptionalOptional. Handler function. If not specified, all handler functions are removed
Returns
type:
void
sendMediaTo
sendMediaTo(mediaUnit: , parameters: ): void
Starts sending media (voice) from a Dialogflow participant to the media unit.
Parameters
mediaUnit:
Media unit that receives media
parameters:
OptionalOptional. WebSocket interaction only parameters
Returns
type:
void
sendQuery
sendQuery(dialogflowQuery: ): void
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.
Parameters
dialogflowQuery:
Text string (up to 256 characters) or an event object
Returns
type:
void
setOutputAudioConfig
setOutputAudioConfig(outputAudioConfig: ): void
Update the audio output configuration.
Parameters
outputAudioConfig:
Config of the audio output
Returns
type:
void
setPhraseHints
setPhraseHints(phraseHints: {[id: string]: string}
): void
Set a collection of phrase hints for the intents.
Parameters
phraseHints:
{[id: string]: string}
The collection of phrase hints to boost the speech recognition accuracy
Returns
type:
void
setQueryParameters
setQueryParameters(queryParameters: ): void
Set parameters for the intents.
Parameters
queryParameters:
Query parameters
Returns
type:
void
stop
stop(): void
Stop and destroy the current Dialogflow instance.
Returns
type:
void
stopMediaTo
stopMediaTo(mediaUnit: ): void
Stops sending media (voice) from a Dialogflow participant to the media unit.
Parameters
mediaUnit:
Returns
type:
void