GX Technology : Chatbot - Using Dialogflow: Chatbot Agent


NOTE:

If you are looking for Continuous Improvement roles, process or chatbot response best practice go to Chatbot continuous improvement: GX roles and process

If you are looking for Chatbot Agent project requests for onboarding new products, please go to Chatbot - Product - On-boarding, New Dialogflow Projects and Permission request

DF Agent build and deploy

Click here for steps on how to build and deploy Dialogflow agents from Jenkins


Handy Links

Chatbot 1.0 Agent URL - used for testing **the environments are selected in the lower left corner

Chatbot 2.0 Agent URL - must be on VPN to access

Dialogflow Basics

Current Dialogflow Agents

Using Dialogflow for Continuous Improvement

The sections that aid in review of conversations for improvement are History and Training. Note: We are using Google’s PII API to redact guest information, so if a guest types something like an address, email, full name etc. into the chatbot, it is not viewable in Dialogflow.

    • History shows as a line item per session. These are expandable to show the full conversation. The number indicated the number of interactions between a guest and the chatbot. Sessions that triggered the default fallback are flagged.
    • Training helps flag phrases that are used that don’t trigger a matched intent. 
    • Note: updates are not possible in the Live environment as it is read-only access. These phrases go through a review process prior to being added to the Dev environment for additional testing.

      The sections that aid in review of conversations for improvement are History and Training. Note: We are using Google’s PII API to redact guest information, so if a guest types something like an address, email, full name etc. into the chatbot, it is not viewable in Dialogflow.

      • History shows as a line item per session. These are expandable to show the full conversation. The number indicated the number of interactions between a guest and the chatbot. Sessions that triggered the default fallback are flagged.
      • Training helps flag phrases that are used that don’t trigger a matched intent. 
        • Note: updates are not possible in the Live environment as it is read-only access. These phrases go through a review process prior to being added to the Dev environment for additional testing.



  1. Select a time range to review

Add training phrases/guest responses to the CI improvement google doc for that Product and continue with steps in the section Continuous Improvement Process and Worksheets 



FeatureWhat is it?How are we using it?ExampleNotes/Resources
Agent

Each Product has its own Agent per Environment type. There are 4 environments per Product:

    • Non-Prod 1 - Dev - this is the development environment and where the conversations (intents) are initially built and then updated **Non-Prod 1 is the only Agent that can be edited
    • Non-Prod 2 - QA - once the dev environment is ready to be published, the first step is to move it to QA for testing
    • Preview - once the CI stakeholders are happy with the updates, the next step is to promote the Agent to Preview. Here we can do more testing to make sure all the new features and conversations are working as expected
    • Live - this is the Production (Prod) environment, this is what the guests interact with

Many people that use DialogFlow only use one Agent per product, Disney has 4 Agents per product to be able to test the impact of changes before they are guest facing.

The impact of working in multiple environments is that we are not as easily able to use some of the features of DialogFlow, like in the training section, to update the Agent. Guest conversations are in the Live Agent history, while updates need to be done in the Non-Prod 1 Agent.

ABC Freeform's Agents:

    • GXChatbot-freeform-nonprod1
    • GXChatbot-freeform-nonprod2
    • GXChatbot-freeform-Preview
    • GXChatbot-freeform-Live

**currently we are using the GXChatbot Agent environments for Freeform until the pipeline updates are complete


Intents









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

Once we have gathered the topics that the Agent should be able to answer and the list of training phrases that we want to lead to a specific response, we are ready to build intents!

Below are listed the components of an intent, not all components are required for an intent.

ABC FF - Check nonstop points

This intent is specifically giving steps on how a guest can see accumulated

There are a few ways to find out how many points you currently have when you’re logged into your Freeform account on an eligible platform running Nonstop:<br/><br/><ul><li>During playback, when you pull up the play / pause controls your current point total will appear on the top of the screen</li><li>In our iOS mobile app, open the menu (☰) to see your current point total</li><li>On the web and our iOS mobile app, if you go to the Nonstop home (link) you can see your current total and visit your History tab (link) to see how you’ve earned and spent your points so far</li></ul>

Each intent needs to have a distinct purpose/answer.

While intents can be very similar, their list of training phrases should be unique.


ContextDialogflow contexts are similar to natural language context. Using contexts, you can control the flow of a conversation. You can configure contexts for an intent by setting input and output contexts, which are identified by string names. When an intent is matched, any configured output contexts for that intent become active. While any contexts are active, Dialogflow will only match intents that are configured with input contexts that match the currently active contexts.


Context - inputInput contexts will be the intents that are prioritized for previously triggered intents with a matching output context.


Context - outputIf the intent has an output context, during the next interaction the Agent will search for intents that have a matching input contextWe also have a customized output that puts a "thumbs up/thumbs down" rating option on an intent using "ratable" and changing the lifespan to "1"
Note there is a lifespan associated wth each output context. This is for you to define how many interactions that you want that context to remain valid.
EventsEvents allow you to invoke intents based on something that has happened instead of what a user communicates. Dialogflow supports events from several platforms (like Google Assistant, Slack, and more) based on actions users take on those platforms. You can also create your own custom events that can be triggered via fulfillment or the detectIntent API.


Training PhrasesThese are example phrases for what end-users might say. When an end-user expression resembles one of these phrases, Dialogflow matches the intent. You don't have to define every possible example, because Dialogflow's built-in machine learning expands on your list with other, similar phrases.

This is one of the key components of an intent and is possibly the most important factor in creating a successful Chatbot! If the training phrases are vague, or if there are phrases that are used in multiple intents, the Agent will be confused as to what the right intent is.


Remember that the Chatbot cannot make the assumptions that a live agent can... when considering a training phrase think "is this intent response the only answer to what this guest is asking?"

Some phrases are specific:

A training phrase for the intent ABC FF - 400-1

I'm getting error 400-1

Sometimes the phrase is vague, we don't want to assume what the issue is; instead we can train an intent that asks for more information:

A training phrase for ABC FF - Feedback

I have ideas

The response in this case is:

Do you have Programming Feedback or possible Site/Player issues?

*this response also has quick replies to make the choice for next steps easy


It is ok to have a more general intent that can direct the guest to be more specific! When creating a general intent, it is a good practice to use some common issues as quick replies to help guide guests to solutions.
Action and Parameters

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. Unlike raw end-user input, parameters are structured data that can easily be used to perform some logic or generate responses.

Action:

The Chatbot team can create actions that impact that Intent

Parameters:

There are system entities already built into DialogFlow that can be used, or we can define custom ones

Action example:

    • Escalate - this will transfer the chat into live chat


Parameter examples:

    • Freeform shows
    • Devices

Responses

Text 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.

As a general rule, your intent responses should prompt the end-user to provide an expression that will match another intent. Your responses should also guide the end-user to provide specific data. For example, a question like "What city were you born in?" is better than a more open-ended question like "Where were you born?".


Make sure to be familiar with the Product voice for their Chatbot, responses should be friendly but efficient.

You can provide a number of complete responses and the Agent will cycle through them. This is useful for Intents that are often triggered so the answers, while the same information, are provided in a variety of ways to appear less repetitive.

In V 1.1 you will be able break up a response into segments if lengthy, for example troubleshooting steps. See the section under Added responses for more details on this.


Add Responses:DialogFlow has 2 options to customize the response, by adding another text response or adding a Custom Payload


Custom PayloadWe use the custom payload to add in quick reply options to a response

Custom payload example on the intent ABC FF - Log out of account:

The response includes two options that guests can use as quick replies to get to the next intent:

Please choose which account you are trying to log out of:

      • Sign out of TV provider
      • Freeform account log out

Quick replies are handy for next steps and to be a visual indicator to the guest that there are more topics that are related.

The can also be used for topics that guests often confuse, for example an activation code intent may also have a quick reply that would lead to a non-stop code intent.

Note that the text in the quick reply isn't able to be formatted.

Textin V 1.1 adding another text box will show to the guest as a separate text box. This can be used to split up a large response into a more natural texting like experience


Follow-up intents

You can use follow-up intents to automatically set contexts for pairs of intents. A follow-up intent is a child of its associated parent intent. When you create a follow-up intent, an output context is automatically added to the parent intent and an input context of the same name is added to the follow-up intent. A follow-up intent is only matched when the parent intent is matched in the previous conversational turn. You can also create multiple levels of nested follow-up intents.

Dialogflow provides many predefined follow-up intents for common end-user replies like "yes", "no", or "cancel". You can also create your own follow-up intents to handle custom replies.




Fallback intents

You can use follow-up intents to automatically set contexts for pairs of intents. A follow-up intent is a child of its associated parent intent. When you create a follow-up intent, an output context is automatically added to the parent intent and an input context of the same name is added to the follow-up intent. A follow-up intent is only matched when the parent intent is matched in the previous conversational turn. You can also create multiple levels of nested follow-up intents.

Dialogflow provides many predefined follow-up intents for common end-user replies like "yes", "no", or "cancel". You can also create your own follow-up intents to handle custom replies.



Note: Follow up intents will only be triggered once the parent intent was the previous chatbot response. No other intent will allow that follow up intent response to be triggered.
Entities

Each intent parameter has a type, called the entity type, which dictates exactly how data from an end-user expression is extracted.



There are times that you may not want the entity to apply to that training phrase. For example, while iPhone, Samsung and Chromecast are all included in a custom "device" entity, you do not want DialogFlow to apply this parameter when there is an intent specifically giving device specific basic troubleshooting steps.

You can remove the device entity parameter by expanding the training phrase and removing the parameter


CustomYou can create your own developer entities for matching custom data. For example, you could define a vegetable entity that can match the types of vegetables available for purchase with a grocery store agent.



PrebuiltDialogflow provides predefined system entities that can match many common types of data. For example, there are system entities for matching dates, times, colors, email addresses, and so on.



Fulfillment

If an intent requires some action by your system or a dynamic response, you should enable fulfillment for the intent. If an intent without fulfillment enabled is matched, Dialogflow uses the static response you defined for the intent.

When an intent with fulfillment enabled is matched, Dialogflow sends a request to your webhook service with information about the matched intent. Your system can perform any required actions and respond to Dialogflow with information for how to proceed. 

We are not currently using fulfillment/webhooks as the initial Products that are being onboarded do not have requirements for this.

Examples of systems we are look at integrating with are:

    • OneID for ABC account management
    • Movies Anywhere - Title Search


Training
The Training page shows a list of conversations. Logs for your agent's conversations automatically appear in the conversation list as customers chat with your agent. 


History
The History page shows a simplified version of the conversations your agent has engaged in. These logs are chronological and intended to be an overview of how users interact with your agent.


DocsResources for DialogFlow


https://cloud.google.com/dialogflow/docs/

Before starting to build intents, you need:

    • a Google Doc list of topics, training phrases and responses
    • a Non-Prod 1 agent ready to go

Step 1 in a New Agent:

    • There are 2 default intents already there: a Welcome and a Default Fallback intent that both need to be customized to suit the Product

Creating new intents:

Once these are updated, you are ready to start adding in new intents! There are two places you can add a new intent to the Agent:

  1. Intent name - Required
    1. Does your intent name follow the naming convention?
  2. Training phrases - Required
    1. Best Practice - Do you have at least 10 training phrases?
  3. Context - Optional
    1. Does this intent require any input/output context? Does the intent need the 'ratable' output added?
  4. Actions - Optional
    1. Are there required actions (does this intent need to trigger something like a transfer to live chat?)
  5. Entities - Optional
    1. Are there parameters/entities that need to be applied/removed?
  6. Response - Required
    1. Is the response product approved?
    2. Is it user friendly/easy to read?
    3. Do you need alternative responses (a variety)
    4. Does the response need to be split across multiple text boxes? (add text)
    5. Does the response need to have Quick Replies?
    6. EXCEPTION: if the Intent triggers an action like escalation, there does not need to be a response - there is a custom page with text that shows to the guest while the live chat pre form is loading
  7. Fulfillment/Webhooks
    1. Not applicable until Movies Anywhere Title API solution


Looks likeBest Practice/Notes
Line Break<br/>nothing.. it's like hitting the 'enter' key in moving to the next line
Paragraph<p> text </p>creates a paragraph
Bold<b>text</b>text
Italicize<i>text</i>text
Bold AND Italicize!<b><i>text</i></b>text
Unordered List (bullet points)<ul><li>line item</li><li>another line item</li><li>last line item</li></ul>
  • line item
  • another line item
  • last line item

Ordered list<ol><li>line item</li><li>another line item</li><li>last line item</li></ol>
  1. line item
  2. another line item
  3. last line item

URL Hyperlink

In response

<a href="https://urlgoeshere.com/feedback" target="_blank">vanityurl.com</a>

vanityurl.com

(this is the text the Guest will see that will go to the target. You could replace this with text instead... example many sites use "Click here" and that text will go to the target URL

If using a Help Site ULR, leave out the article title.

eg: https://support.abc.com/hc/en-us/articles/3000000000002





Phone number link in a response<a href="tel:+8005551212"> (800) 555-1212</a>(800) 555-1212
Phone number link in a quick reply<a href=\"tel:8334668438\"> Call 833-466-8438</a>

email in a response<a href="mailto:help@moviesanywhere.com">Email help@moviesanywhere.com</a>

email in a Quick reply

<a href=\"mailto:help@moviesanywhere.com\">Email help@moviesanywhere.com</a>





Dialogflow Agent Permissions

Send access requests to Katie Ross/Jesse Choi 

AgentAccess typeUsersAccess date
di-gxfreeform-nonprod-1Read/Writeongoing
di-gxfreeform-us-prod-1
Read onlyRequested Sept 29, 2020
di-abc-nonprod-1Read/Writeongoing
 di-gxabc-us-prod-1
Read onlyRequested Sept 29, 2020

di-gxmoviesaw-nonprod-1

Read/Writeongoing
di-gxmoviesaw-us-prod-1Read onlynot active atm