# Dialogflow

![Figure 1: The Dialogflow module in use.](https://820663326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M40QJ5NXmtM4utV6bD_%2Fuploads%2Fjp1m7wNzdPqtXRT4E4jW%2Fdialogflow-intro.png?alt=media\&token=b6de0405-d7cc-4f07-8ac8-38a50e66b44b)

{% hint style="warning" %}
**IMPORTANT:** This is an advanced module. Some setup is required before use.
{% endhint %}

## Function

This module uses the supported third-party service Google Dialogflow. The module allows you to integrate a Dialogflow voice agent into your application to interact with callers.

You can select and use any Dialogflow integration that has been added to your Fuse account.

{% hint style="info" %}
**NOTE:** Integrations are shared with all users in a Fuse account. You can always check existing integrations by going to the **My Account** page and viewing the **Integrations** tab.
{% endhint %}

## Prerequisites

To use this module, you must have access to Google Dialogflow. You must also have a working Dialogflow voice agent added as an integration to your Fuse account.

Complete the following in order:

#### In Google Dialogflow:

1. Get access to Google Dialogflow. ([Dialogflow website](https://cloud.google.com/dialogflow))
2. Build your own working, custom voice agent. ([Google Documentation](https://cloud.google.com/dialogflow/docs))\
   (Optional) You may also use a prebuilt voice agent instead. ([Google Documentation](https://cloud.google.com/dialogflow/es/docs/agents-prebuilt))
3. Set up a service account and service account key for your agent. ([Guide](https://docs.plumvoice.com/fuse/setting-up-authentication#google-dialogflow))

#### In Fuse:

1. **Admin-only task:** [Add your voice agent as an integration in the My Account page](https://docs.plumvoice.com/fuse/my-account/admin-options#add-an-integration-admin).

Once finished, the <img src="https://820663326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M40QJ5NXmtM4utV6bD_%2Fuploads%2FKHwxH1lkqNZet8yJko4I%2FUI-Module-icons_iconDialogflow.svg?alt=media&#x26;token=919b3751-e539-4277-ba62-8bb9e82aa37b" alt="" data-size="line"> Dialogflow module can be used successfully.

## Input Fields

As shown in Figure 2, the following fields are available:

1. **Select Integration**: Select one of your Dialogflow integrations.
2. **Select Environment**: Select a Dialogflow environment. List options are retrieved from Google Dialogflow based on the selected integration.
3. **Prompt field**: Enter a message that you want your voice agent to read when it starts. This field accepts strings and/or variables.

![Figure 2: Dialogflow module fields.](https://820663326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M40QJ5NXmtM4utV6bD_%2Fuploads%2FCB7rshU2vxOlZo57bbVi%2Fdialogflow-base-fields.png?alt=media\&token=8a7c7639-034d-4fc4-ad32-d52e4404497a)

### Shadow Variables (Dialogflow only)

The Dialogflow module also supports the following shadow variables:

<table><thead><tr><th width="184.61275999215036">Shadow variable</th><th width="401.3933379130153">Returns</th><th data-hidden></th></tr></thead><tbody><tr><td><code>name$.query</code></td><td><code>string</code><br>End-user input received by Dialogflow.</td><td></td></tr><tr><td><code>name$.intent</code></td><td><code>string</code><br>Intent matched to the received end-user input.</td><td></td></tr><tr><td><code>name$.message</code></td><td><code>string</code><br>Text of the response spoken or displayed to the end-user based on the matched intent.</td><td></td></tr><tr><td><code>name$.entities</code></td><td><code>object</code><br>Entity types associated with the matched intent.</td><td></td></tr><tr><td><code>name$.confidence</code></td><td><code>integer</code><br>Confidence level for the name field.</td><td></td></tr><tr><td><code>name$.allRequiredParamsPresent</code></td><td><p><code>boolean</code><br>Returns <code>true</code> when:</p><ul><li>All required parameter values have been collected</li></ul><p>      OR</p><ul><li>The matched intent contains no required parameters.</li></ul><p></p><p>Returns <code>false</code> when:</p><ul><li>The matched intent has required parameters</li></ul><p>      AND</p><ul><li>One or more required parameter values have not been collected.</li></ul></td><td></td></tr></tbody></table>

See [Shadow Variables](https://docs.plumvoice.com/fuse/variables/shadow-variables) for more information on this variable type in general.

## Module Settings

![Figure 3: Module settings for Dialogflow.](https://820663326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M40QJ5NXmtM4utV6bD_%2Fuploads%2FCB7rshU2vxOlZo57bbVi%2Fdialogflow-base-fields.png?alt=media\&token=8a7c7639-034d-4fc4-ad32-d52e4404497a)

### [Hold Music](https://docs.plumvoice.com/fuse/module-settings#hold-music)

| ![](https://820663326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M40QJ5NXmtM4utV6bD_%2Fuploads%2FA3dIvYB3p2kNOEOrewsb%2Fsettings-holdmusic.png?alt=media\&token=f733651d-091f-4b33-95c7-4249fe1d5e51) | <p>Enable this setting to play audio while an end-user is on hold.<br>To upload a file for hold music, go to <em>Application Settings > Connection Settings ></em> <a href="../../application-editor/application-settings/connection-settings#webservices"><em>Webservices</em></a> <em>> Webservice fetch audio</em>.</p> |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

### [Timeout Length](https://docs.plumvoice.com/fuse/module-settings#timeout-length)

| ![](https://820663326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M40QJ5NXmtM4utV6bD_%2Fuploads%2F7gVet57unbzETQdRMzND%2Fsettings-timeout.png?alt=media\&token=d274b681-a86b-4acf-88f0-7c55f6fb661f) | <p>This allows users to set the maximum time, in seconds, that elapse before returning a timeout error. This applies to modules that fetch outside scripts, like the SOAP, REST, or subdialog modules.<br><br>The default value for Timeout Length is 30 seconds.<br>Acceptable number values range from 1 to 120.</p> |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

### [Private](https://docs.plumvoice.com/fuse/module-settings#private)

| ![](https://820663326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M40QJ5NXmtM4utV6bD_%2Fuploads%2FJ6cqYVh0apcAxdczuWce%2Fsettings-private.png?alt=media\&token=27562cc5-789b-497c-b4a8-155ae9e50403) | <p>This setting controls the logging function of a module.<br>Enabling the 'Private' setting instructs the module to not record, report, or retain the information input to that module for reporting or any other purposes. When enabled any information entered into a module during a call will be lost immediately when the call terminates.<br>The 'Private' setting is critical for businesses that need to maintain PCI-DSS or HIPAA compliance.<br><br>The module icon, in the upper left-hand corner, becomes grayed-out when this setting is enabled. See more details <a href="../../application-editor/modules#visual-indicators">here</a>.</p> |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

### [Barge-in](https://docs.plumvoice.com/fuse/module-settings#barge-in)

| ![](https://820663326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M40QJ5NXmtM4utV6bD_%2Fuploads%2FJihoTztPSsB6RhOYBfOr%2Fsettings-bargein.png?alt=media\&token=e119818b-3b44-4fa5-8327-8ef5689d3d9d) | <p>This setting allows callers to interrupt a prompt before it finishes playing.<br>When enabled, DTMF input interrupts the prompt and progresses the call forward in the call-flow. If speech recognition is enabled on the ensuing module in the call-flow, then end-users can also interrupt the prompt with a spoken utterance, too. Disabling barge-in forces callers to listen to the entire prompt.<br><br>A barge-in enabled module will have a dashed line on top of the text box. See example <a href="../../application-editor/modules#visual-indicators">here</a>.</p> |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

### [Show Custom Errors](https://docs.plumvoice.com/fuse/module-settings#show-custom-errors)

| ![](https://820663326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M40QJ5NXmtM4utV6bD_%2Fuploads%2FKOSvJRlsO7QweIFW6f6L%2Fsettings-showcustomerror.png?alt=media\&token=d12a905e-1893-491f-8ebe-d666c676698c) | <p>Enabling this setting overrides the default, global error options set in the <em>Application Settings</em> > <a href="../application-editor/application-settings/user-input-settings"><em>User Input Settings</em></a>.<br>This allows users to establish custom error handling in order to act on errors in a specific way in that module.<br>Instead of progressing to the next module in the call-flow, custom error handling allows users to re-prompt the same module, to provide a custom error message, to re-direct the call based on the error, or any other desired behavior.<br><br><img src="https://820663326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M40QJ5NXmtM4utV6bD_%2Fuploads%2FxyZYnQH9bo2T9mzIrgLP%2Fsettings-customerror.png?alt=media&#x26;token=83e070b6-ae3e-445e-8e2a-6ae20b066193" alt=""><br><br>Adding multiple errors (<img src="https://820663326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M40QJ5NXmtM4utV6bD_%2Fuploads%2FGiBgHWlGXSI22fL1t8cS%2Fadd-remove_action_icons.svg?alt=media&#x26;token=1088f02f-42ad-402f-9857-d986df9f144b" alt="" data-size="line">) to a module functions behave the same way as a counter.<br>The first error follows the path for the first error listed, if a second error occurs in the same module it follows the second listed error, and so on until all errors are exhausted or an error directs the end-user away from that module.<br><br><img src="https://820663326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M40QJ5NXmtM4utV6bD_%2Fuploads%2F4XebiKilBv88FA31GFYP%2Fsettings-customerror-noinput.png?alt=media&#x26;token=bfabd930-3a39-454a-8939-b81523f81235" alt="" data-size="line"> No Input occurs when the caller does not provide an input based on the timeout settings.<br>This is based on the “<em>Initial input timeout</em>” in <a href="../application-editor/application-settings/user-input-settings">User Input Settings</a>.<br><br><img src="https://820663326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M40QJ5NXmtM4utV6bD_%2Fuploads%2Feuluar4zKkk9X4JJrmfG%2Fsettings-customerror-nomatch.png?alt=media&#x26;token=d443d20f-0ec7-4b74-b9f6-51d8f0705c00" alt="" data-size="line"> No Match occurs when the caller input does not match the module's criteria for the input module.</p> |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
