> For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt

# DialogflowInstance

## Constructor

```ts
new DialogflowInstance(id: string, parameters: Object)
```

**Parameters**

```ts
new DialogflowInstance(id: string, parameters: Object)
```

**Parameters**

## Methods

### addEventListener

Adds a handler for the specified [AI.Events](/api-reference/voxengine/ai/events). Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.

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

**Parameters**

### 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.

```ts
addMarker(offset: number): void
```

**Parameters**

### id

Returns the dialogflow instance's id.

```ts
id(): string
```

### removeEventListener

Removes a handler for the specified [AI.Events](/api-reference/voxengine/ai/events) event.

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

**Parameters**

### sendMediaTo

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

```ts
sendMediaTo(mediaUnit: VoxMediaUnit, parameters?: SendMediaParameters): void
```

**Parameters**

### 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.

```ts
sendQuery(dialogflowQuery: DialogflowQueryInput): void
```

**Parameters**

### setOutputAudioConfig

Update the audio output configuration.

```ts
setOutputAudioConfig(outputAudioConfig: DialogflowOutputAudioConfig): void
```

**Parameters**

### setPhraseHints

Set a collection of phrase hints for the intents.

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

**Parameters**

### setQueryParameters

Set parameters for the intents.

```ts
setQueryParameters(queryParameters: DialogflowQueryParameters): void
```

**Parameters**

### stop

Stop and destroy the current Dialogflow instance.

```ts
stop(): void
```

### stopMediaTo

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

```ts
stopMediaTo(mediaUnit: VoxMediaUnit): void
```

**Parameters**