Thumbnail
Tutorials | Setting Up the Dialogflow Application

This tutorial explains how to use the Dialogflow application and how to create and personalize an Intelligent Agent.

If you create all the content from the following examples, you can use it later for creating the chatbot example.

Prerequisites

Dialogflow is a Google Cloud application and does not require any installation.

Important! You can only use Dialogflow if you have a Google Account. To create a Google Account, go to https://accounts.google.com/signup/

Create a Dialogflow Account

To create personalized agents, you need to create a free Dialogflow account. Go to https://dialogflow.cloud.google.com and sign in with your Google account. For more information, see Dialogflow.

Create and Personalize an Agent

After you have created a Dialogflow Account, create a unique Agent that covers your project’s needs.

Follow these steps

  • In Dialogflow, select Create Agent
  • Add the name of the Agent

Tip: Pick a name that describes what your Agent covers (for example, Fashion).

  • Select your preferred default language and the default time zone
  • Select Create
  • A new page appears

You created an Agent.

Create an Entity

Personalize the Agent by creating an entity.

Follow these steps

  1. Select Entities from the hamburger menu on the top left
  2. Select Create Entity or Create the first one
    A new page appears
  3. Add an entity name (for example, popular_category), and then select Save
  4. Select the checkbox Define synonyms
  5. Select Click here to edit entry, and then add value and synonyms

    Important! The first synonym is added automatically and it is the same as the value. Do not delete the first synonym.
     
  6. (Optional) Select the checkboxes Regexp entity, Allow automated expansion, or Fuzzy matching
    For more information, see the context help next to each checkbox name
  7. Repeat step 5 to create more values and synonyms
  8. Repeat steps 1 to 3 to create more Entities

Examples of Entities popular_category, product and product_size, and their values and synonyms:

Create an Intent

1. To create an intent, select Intents from the hamburger menu on the top left
2. Create an intent
3. Add an intent name, and then select Save
4. (Optional) Add Contexts and Events
5. Select Training phrases, and then add expressions that will trigger the intent

An example of Training phrases

6. Add Action and parameters (for example, fashion.trends)
7. Select the checkbox Required
8. Select the entity you created
9. Add the name of the parameter

Tip: Type “@”, and then type the first letter of your entity name. A drop-down list appears. Select the correct parameter from the drop-down list.

If you add a parameter name before selecting an entity, the following error message appears: Entity is required for required params: <name>

10. Add a value
Note: There will be $Category in later examples.

11. (Optional) Select the checkbox IS List
12. Select Prompts from the Action and parameters table, and then add questions that the agent will ask the user

 

An example of Action and parameters

An example of Prompts

13. Select Responses, and then add text responses that the Agent will deliver to users.

 

Congratulations. You created an intent.

Create an Intent for Checking the Product Availability

Create a new Intent and name it Product Availability. To make the Agent answer product availability related questions, personalize Product Availability Intent.

Follow these steps

1. Create Entities and Intents from examples in the previous section
2. Select Contexts and add selected_product to Add input context table
3. Add selected_product to Add output context table

4. Add the following Action and parameters, and then, select the Required checkboxes: 

  • product
  • color
  • popular_category
  • size

Note: The sys.color is a system entity and it is present in Dialogflow by default.

5. Add the following Training phrases

  • Do you have a red shirt?
  • Is the straw hat available in blue?
  • I would like to buy large black sports shoes
  • Medium black cowboy hat

 

Note: The phrases change background colors based on the Entities.

Tip: Try more phrases - use the words from Entities’ values and synonyms.

 

6. Add the following responses to the Text Response table

  • $size
  • $color
  • $product is
  • $availability
  • $popular_category

You created a personalized Product Availability intent. Try talking to the bot.

Create a Price Check Intent

Create a new intent and name it Price Checks. To make an Agent answer product prices related questions, personalize the Price Checks intent.
 

Follow these steps

1. Add the following Training phrases:

  • How much is the cowboy hat?
  • What is the price of sports shoes?
  • How much the plaid shirt costs?
  • How much?
  • How much is it?

 

2. Select Action and parameters, and then add product.price as the action’s name
3. Add a product parameter, a @product entity and a $product value to the Action and parameters table
4. Select the checkbox Required

 

5. Select Responses, and then add the following text response:

The price of the $product is $price Euro
 

Congratulations. You created a Price Check Intent.

To check if the settings are correct, select Try it now in the right top corner. Add one of the training phrases, and then press Enter on your keyboard. The default response is the response you added in step 3. If some information in the question is missing (for example, a specified product), the bot asks you for the missing information.