# DialogFlow

DialogFlow is a Natural Processing Language (NLP) engine that makes it easy to design and integrate a conversational user interface into your mobile application, web application, device, bot, interactive voice response system, & so on.&#x20;

### Use-case scenario:&#x20;

DialogFlow can be used by you when;&#x20;

* You want to connect your DialogFlow agent to Support Hunt
* You want a smart bot to parse the input of the visitor
* You want to create AI based bots&#x20;

### How do I integrate Support Hunt with DialogFlow?&#x20;

Setting up the integration between Support Hunt and DialogFlow is two step process;&#x20;

1. Getting the JSON key for the agent that you want to connect it to Support Hunt
2. Configuring the JSON key on DialogFlow action block

{% hint style="info" %}
To generate the JSON key for the agent that you want to connect to Support Hunt, [here](https://www.loom.com/share/d1d5b0f1849a4afca5aa8ef8775cc796) is the video tutorial to guide you through the same.&#x20;
{% endhint %}

### How do I set it up?&#x20;

In-order setup the DialogFlow action block in the bot flow, you can follow the following steps;&#x20;

* Add an action block on canvas by clicking on '+'\
  &#x20;
* Choose 'DialogFlow' <br>
* Double click on 'DialogFlow' to configure it on the right panel<br>
  1. Map the Variable: \
     \
     Select the variables in which the visitor's inputs are stored. Just like to answer a question, you need a question; similarly, to parse inout to DialogFlow, we send a sentence to them & DialogFlow in return reads the question & sends the matching answer to Support Hunt<br>
  2. Upload JSON file: \
     \
     Upload the JSON key that you have downloaded in the earlier steps. If you haven't download it yet, refer to this [video tutorial](https://www.loom.com/share/d1d5b0f1849a4afca5aa8ef8775cc796)<br>
* Define actions:\
  \
  Define the actions to be performed for the Success & Failure scenarios. You will see two ports '+' for Success condition and '+' for Failure condition. \
  \
  On Success, meaning when an intent is matched on DialogFlow and a success response is received, we have the option to self loop the block or move on to the next step in the flow<br>

  On Failure, you can define what should be the next step in the conversation flow, by adding an action block. Obviously, DialogFlow will not always give you expected response & so whenever it fails, you may try to request the input again and loop it back to the flow

{% hint style="info" %}
We at Support Hunt recommend you to have the 'Collect Input' action block placed ahead of the 'DialogFlow' action block & store the response from the visitor in the variable.&#x20;
{% endhint %}
