Table of Contents

Dialogflow: Managing Intents

Susan Swier Updated by Susan Swier

What is an Intent?

Dialogflow's definition of Intent:

An intent categorizes an end-user's intention for one conversation turn. For each agent, you define many intents, where your combined intents can handle a complete conversation. When an end-user writes or says something, referred to as an end-user expression, Dialogflow matches the end-user expression to the best intent in your agent. Matching an intent is also known as intent classification.

A basic intent contains the following :

  • Training phrases - These are example phrases for what end-users might say. When an end-user expression resembles one of these phrases, Dialogflow matches the intent.
The template phrases will be deprecated and ignored during training. Learn more here.
  • Action - You can define an action for each intent. When an intent is matched, Dialogflow provides the action to your system, and you can use the action to trigger certain actions defined in your system.
  • Parameters - When an intent is matched at runtime, Dialogflow provides the extracted values from the end-user expression as parameters. Each parameter has a type, called the entity type, which dictates exactly how the data is extracted.
  • Responses - You define text, speech, or visual responses to return to the end-user. These may provide the end-user with answers, ask the end-user for more information, or terminate the conversation.

A more complex intent may also contain the following:

  • Contexts: Dialogflow contexts are similar to natural language context. If a person says to you "they are orange", you need context in order to understand what the person is referring to. Similarly, for Dialogflow to handle an end-user expression like that, it needs to be provided with context in order to correctly match an intent.
  • Events: With events, you can invoke an intent-based on something that has happened, instead of what an end-user communicates.
The intents can be triggered based on your contacts' Country and Language. If your contact has a country or language value present in their contact details, the intents can be triggered based on the different values of country and language.

Viewing Intents

Step 1: Login to Dialogflow

Navigate to the Dialogflow console and login with your user credentials.

Step 2: Navigate to Intents

Select the agent you would like to configure and select Intents from the side navigation menu

All the default intents and created intents will be listed in this view.
screenshot of the dialogflow intents page

Default Intents

When you create an agent, two default intents will be created for you by Dialogflow.

  • Default Welcome Intent: This intent is matched when the contact begins a conversation with the platform. This intent should return a response that lets the end-user know what your agent does or what they can say to begin a conversation.
  • Default Fallback Intent: This intent is matched when the agent cannot match the end-user expression to any other intent.

Default Welcome Intent

As you can see, the Default Welcome Intent has a pre-requisite of Welcome event and greetings phrases. When a contact messages you for the first time, this intent will be matched according to what was specified.

screenshot showing dialogflow default welcome intent

Refer to the following example:

gif showing a default welcome generated by dialogflow in a respond.io webchat
Suggestion: To manage Contact's expectations, we suggest including responses that inform the contact that they are interacting with a chatbot.

Default Fallback Intent

Tip: Learn more about Dialogflow's definition of Default Fallback Intent.

When the incoming message or event does not match any of the existing intents, a fallback intent will be matched instead.

dialogflow's default fallback intent

Refer to the following example :

gif showing dialogflow fallback intent in a respond.io webchat box
Suggestion: If the Agent cannot understand the message, the Agent should offer to hand off the conversation to a live agent to help with the contact's issue.

Creating an Intent

You can create new intents if you would like to create automated processes for specific use cases. With Parameters and Events, intents can be created to suit multiple use cases.

In order to help you better understand, the following guide will be based on a specific use case as described below:

Company XYZ often receives queries on order status from the website's webchat. As they were going through the conversations, they detected a common pattern where their agents would ask for the customer's customer ID to further check the issue or resolve the enquiry. Once they obtained the customer ID from the customer, they would update the custom field and add it as a tag.

Based on the scenario above, the process of obtaining the customer ID can be done by the chatbot. Once the customer ID is obtained, the contact will be handoff to a human agent for further assistance.

Let's break it down into simpler steps:

  1. Create an intent to prompt for customer ID.
  2. Create an intent to obtain the customer ID.
  3. Save the customer ID as a custom field on respond.io.
  4. Add a tag.
  5. Hand off the conversation to a human agent.
  6. Notify the human agent.
  7. Disable the bot.

Expected Outcome

gif showing expected outcome of dialogflow workflow in respond.io

Creating a Basic Intent

Step 1: Create Intent

Navigate to the Dialogflow console and press Intents from the side navigation menu. Press the ➕

or CREATE INTENT from the top of the module.

Step 2: Name your Intent

Enter a name for your intent. Your intent name should represent the end-user expressions it recognizes.

For this scenario, we'll name it order_status_enquiry.

screenshot showing how to create an intent in dialogflow

Step 3: Include Training Phrases

Based on the scenario above, we should include training phrases that asked for order status specifically. Start by typing in the placeholders in Training Phrases section. You can include multiple phrases to cater for different type of phrases.

For example:

where is my order
could you help me check my order please
what is the status of my order

Step 4: Build Intent Response

For this intent, the response should prompt the Contact for their customer ID to be used for the following intent.

screenshot of adding intent training phrases in dialogflow

Scroll down to the Responses section and type in the response. You can either add a Text Response or Custom Payload. For this scenario, Text Response will serve the purpose.

Tips:
You can send multiple responses at one time for better readability.
You may add a few variants of the response and they will be randomized when sent to Contacts.

The response we will build for this intent is:

I apologize in advance if your order is taking too long.
Can I have your customer ID please?

Tip: Learn more about response templates here.

Creating an Entity

Before we can save the value as a custom field, we will need to create an entity to detect the value from incoming messages.

Based on the scenario above, we will name this entity as customerId and it will be used to store the customer ID for a customer.

screenshot of dialogflow settings for adding intent responses

Step 1: Create an Entity

Navigate to the Entities module. Press on the ➕ or CREATE ENTITY.

screenshot showing how to create a dialogflow entity

Step 2: Name the Entity

For this example, we will name it customer_id.

Step 3: Enter the possible values

The entity should accept a string with 5 integers in length. Regular expression will be applied to validate the value.

For this example, the value will be (\d){5} that accepts any string with 5 digits.

Tip: Learn more about regular expressions here.
screenshot showing how to add customer id as an entity in dialogflow
Tip: Learn more about entities here.

Creating an Intent with Parameters

Step 1: Create Follow Up Intent

Navigate to the Dialogflow console and press Intents from the side navigation menu. Locate the previous intent created and press Add follow-up intent.

A follow-up intent is used instead because this intent will need to be triggered after the specified intent.

By default, the context and action will be populated by default so that the intent will work in sequence.

how to add a follow up intent in dialogflow

Step 2: Include Training Phrases

The phrases to include in this intent will most likely be phrases that contain the customer ID. We can input a phrase and highlight the text that is likely to be the customer ID. Select the entity created earlier and annotate the text with it.

adding training phrases to a follow up intent

By default, a parameter will be created when you annotate a text with an entity so store the values.

Tip: Learn more about annotating training phrases here.

Step 3: Build Intent Response

For this intent, the response should inform the contact that the customer ID has been received and a human agent will take over the conversation and resolve the issue.

Scroll down to the Responses section and type in the response. Add a Text Response.

The response we will build for this intent is :

Thanks for providing your customer ID. Your issue is being assigned to our human agents.

screenshot of dialogflow default text response

Saving a Value as a Custom Field

When the contact responds with their customer ID, the value can be saved as a custom field in respond.io platform.

In order to save the value to a custom field, please ensure the custom field is created on the respond.io platform.

To save the value, add a parameter RB_FIELD_{custom field's name}. In this case, the parameter will be RB_FIELD_customerid and set the entity $customer_id as the value.

screenshot showing how to save a custom field in dialogflow

Adding a Tag

Add a parameter RB_ADDTAGS and set the entity $customer_id as the value

screenshot showing how to add tags in dialogflow

Handing Off the Conversation

Now, we want to hand off the conversation to a human agent. This can be achieved with another parameter, RB_USER_ASSIGN and set the user's email as the value

screenshot of how to add a parameter to assign to a user in dialogflow

Disabling the bot

The parameters will be executed in sequence. Lastly, we will disable the bot response for this contact because we do not want any intent to be triggered when the contact is handled by a human agent.

To do so, we will add another parameter, RB_BOTSTATUS and set FALSE as value.

screenshot of how to disable a dialogflow bot after the conversation is handed off
When a bot is disabled, contacts can no longer receive messages from the bot until the bot status is enabled. The bot status can be enabled manually through the messaging console or via automation.

Location Handling

When a location is received from a contact, an event of type LOCATION will be sent to Dialogflow. You may add LOCATION to the events to trigger the respective triggers.

screenshot of adding location to dialogflow intent

Check out the other parameters available to use in Dialogflow:

Testing an Intent

If you need to test the intent, use the Testing panel located at the right side of Dialogflow console.

dialogflow option to test an intent

Deleting an Intent

From the intent list, hover over the intent you wish to delete. Press the trash icon of the intent.

gif showing how to delete an intent in dialogflow

Feeling stuck? Do not fear.

Need assistance? Contact us for support. Help is here!

Dialogflow: Creating a Chatbot

Dialogflow: Parameters

Can't find what you're looking for?

Talk to an expert here!

Contact Us
Powered by HelpDocs (opens in a new tab)

Powered by HelpDocs (opens in a new tab)