Dialogflow


 

The way to connect Dialogflow has been updated

Please refer to these tutorials for how to connect UChat with Dialogflow, how to connect multiple Dialogflow agentsand how to use Dialogflow for slot filling in UChat.

 

With Dialogflow, you can pre-set some frequently asked questions, and your bot can deal with the simple queries on behalf of you and transfer the difficult. Besides, you can train your bot to understand more human language including greeting, gratitude, basic interaction, etc.

 

Setup Dialogflow

On your dialogflow dashboard, click on the gear icon and then click on your project URL,

Click on the top-left corner and open the options. Scroll down and click on “IAM & Admin” settings and then to “Service Accounts”

Click on “Create Service Account”. Follow the process below.

Afterwards, click on Manage Keys to create a key.

Click on “Add Key”

This will download a JSON file for you. You can then upload this directly on Uchat.

Click on Sync Agents once after the integration is completed.

TIP If there is a prompt saying that "Google hasn't verified this app", try click "Advanced" and then click "Go to UChat Website ". Don't worry, it's safe to do so.

 

Click the blue "Allow" button to allow UChat to get access to your Dialogflow account.

Visit Dialogflow Website, login to your Google account, then you will see your Dialogflow dashboard like this:

 

  1. Click "Create Agent" on the left sidebar

  2. name this agent

  3. pick a default language for the bot

  4. choose a default time zone

  5. once finish, click "CREATE"

 

"Google Cloud Platform service has been disabled"

If you fail to create an agent with an error saying "Google Cloud Platform service has been disabled. Please contact your administrator to restore service", it is possible that because the google account is from your organisation like YourName@YourCompany.com. You can solve this problem by either contacting the administrator in your company for Google cloud platform authorization or using your own Google account instead.

 

After creating a new agent, come back to UChat, click "Sync Agents" as below. All your agents will be listed here.

 

Use Dialogflow

Choose one of your flows that you would like your Dialogflow agent to manage.

 

In the workspace of the flow,

  1. click "Automation" on the left sidebar

  2. activate the "default Reply"

  3. select frequency, usually "Every Time".

  4. click "Choose Sub Flow"

 

Select your agent and you are then able to manage your FAQs. Enter FAQ interface by clicking the "Manage Faqs" button as below:

 

This is how the FAQ interface looks like:

 

The "Sync Product Entity" button is for Ecommerce usage. By synchronizing product information in your Ecommerce system with Dialogflow, you can then recognize and reply to related products when users ask about them. To quote a product name, type "{{"to see the picture below

 

Click "+ New Faq" to start building your smart dialog:

 

For each frequently asked question, put as many synonymous sentences as you can in the question area and Dialogflow will help with the rest.

You don't need to worry about too many details because Dialogflow is using fuzzy matching. For example, you have already put "When is your office hour?" and "When do you open?". The bot can recognize it is asking about opening hours whatever user send "office hour?", "when u open?", etc even there is any abbreviation or grammar mistake.

The answer area is telling the bot what to reply when a question matched. The bot will randomly pick one answer from the answer list to send.

In "Send sub flow" area, choose a sub flow if needed. The sub flow will be sent just after the answer.

Finally, click "Save" and here you go, 🎉 your first FAQ has done. The bot is now understanding more human language! Keep testing and improving it.

Improve Dialogflow

Back to Dialogflow Website, you will see UChat created many FAQ intents on behalf of you:

 

  1. choose your agent

  2. click "Intents"

  3. these are the intents synchronized from UChat

  4. Test your bot here, see whether it understand which FAQ you are asking about.

Check and adjust "Default Fallback Intent" or "Default Welcome Intent" if needed. "Default Fallback Intent" is matched when none of the FAQ is matched.

Select any intent, give it some more editing to help the bot understand more:

 

For example, in this case, double click to select "Melbourne", then enter the keyword "city", click on "@sys-geo-city". This is telling the bot that the word "Melbourne" is a city. So next time when users asking "Can you deliver to Sydney?" or other cities, the bot can file the question to this FAQ.

There are various practical built-in lexicon includes color, time, post-code, country, street name, language, etc. You can even create your own!

Dynamic Content Response

Response answer is not limited to just text. Try custom payload!

To begin with, create a FAQ in UChat with only questions, no answer or sub flow.

 

Wait a moment and refresh your Dialogflow intents until the new intent shows.

 

In the new intent, click area 4, "ADD RESPONSES", then "Custom Payload". Copy and paste any needed response format here, such as text/media/files, buttons, actions, quick replies and so on so forth.

 

In this case, a call button will be sent. So copy the following code to Dialogflow:

 

Adjust text, button title, number, etc as needed and click "Save":

 

Let's test it from the testing area on the right:

 

Well done! the bot recognizes that "can I call" is asking faq3.20.

 

The user side looks perfect as well. Feel free to explore other response types!