How to handle Dialogflow list response - dialogflow-es

I am developing an app for Google Assistant using Dialogflow (using Dialogflow online interface, without any external server).
I have a list of products. Each product has an intent which is trained with its product name.
For example if I say "Product 1" the assistant will show me some information about "Product 1".
I also made an intent which lists all the products you can browse. As a response it shows a Google Assistant "List" which displays the names of all the items.
But when I click one of the items, it will type its name("Product 1") but the item name is not recognized and I got the fallback intent.
I though lists could work like suggestion chips but it looks like answers are interpreted differently.
By looking for examples I could only find examples using Dialogflow API from code (https://actions-on-google.github.io/actions-on-google-nodejs/classes/conversation_helper.list.html), and it seems that list answers are handled with a special type of intent.
Is there a way to handle list response directly from Dialogflow online interface ?

It does not handle the List or Carousel interfaces the same way it handles the suggestion chips. As you note - they trigger a special Event, which you're expected to create an Intent for.
There are a number of reasons for this, but one good one is that these tend to be fairly dynamic (they're meant to represent things like search results), so having to manage these with a Session Entity might be more difficult.
You can use the Dialogflow Inline Editor to handle them. This is essentially the same as using a fulfillment server - however Dialogflow handles most of the server management for you.

Related

Dialogflow query working in console but not when you use embedded url

I have made a query flow in dialogflow and it has four intent and in the last intent it uses a webhook to get data from server side and displays the result. It is trained automatically and works perfectly in dialogflow console returning response and query answer. The issue is it does not work when I use embedded url. It fails to recognize the name intent and asks (Can you repeat again or fallback intent). I've removed all intents and made query again, there is no similar name intents. Yet it works well in console and not in embedded url.
For the webhook part I've used node.js service.
Please help in this issue.
By 'embedded url' if you mean Dialogflow Web Demo (DWD), you should keep in mind that DWD can be used only for simple text messages. It does not support messages from webhook or even rich responses. However, if you steel need a web widget to embed your bot to your webpage you either create your own or you should use third party solutions (like Kommunicate). Here's the link regarding the limitations of DWD.

Dialogflow Integration into Custom CRM

I am trying to wrap my head around using Dialogflow for developing and integrating an SMS chatbot with our custom CRM. The creation of an Intent is pretty powerful and straight forward. However, I am trying to understand best practices for something. If I have an intent used to return the price of a service at a certain location, I can model that very easily within dialog flow. However, when an SMS message comes in, it will be from a new customer or a known existing customer for a certain location. For existing customers, we already know the location and therefore don't want them to have to specify the location value in the intent. Prior to sending the inbound SMS message to the client API to match the intent, how can I pre-set the "location" parameter value in the intent so it does exists even if that inbound SMS message did not include it? For example a known customer in Dallas would just have to say "how much is a xxx" instead of "how much is a xxx in Dallas".
Can you use the API to set a parameter value prior to calling the API to try and match the intent? If so, how do you get do that without a session ID? The reason the "location" is needed is because when we get to the fulfillment, the prices for the same service are different based on the location so I will need to be known but we don't want to make existing customers say the location.
Maybe another option is to have a Location intent with an event that we can trigger through the API. this would have an output context on it called location and fulfillment that sets the parameter value. But even then I struggle with understanding how to pass in values like location, phone number, etc into dialogflow from the calling application so dialogflow has those parameter values to use in fulfillment.
Reading documentation, watching videos and starting to test client API v2
This is certainly possible. What you would want to do is use the Dialogflow API for this. Here you can find the languages for which Google has created client libraries: https://cloud.google.com/dialogflow/docs/reference/libraries/overview
As soon as you have any 'if' in your code you should use the fulfillment: https://dialogflow.com/docs/fulfillment
How I would handle this:
Client sends SMS
You check in your back-end if this user is known. If known -> don't ask location, else you ask the location
Match the user query against the Dialogflow client library
Dialogflow will return the intent if (any) is matched
You should define and implement any logic before calling the Dialogflow library.

How to use custom payload in dialogflow to create quick replies on web integration

I am currently trying to add functionality to my chatbot by allowing it to have quick replies (buttons for the user to click on) when certain questions are raised by the user. However, the implementation on web is not as straightforward as FB messenger/telegram where quick replies can just be keyed in.
After some research it seems like using the custom payload option when selecting a response on dialogflow seems to be the only viable option but I have no idea on the type of code/ format that should be input.

Dialogflow: reference to output context in intent (ie what's this NodeJS Client Library for?)

In my NodeJS Dialogflow fulfillment, I want to reference an output context parameter from an intent from 2 requests ago within the session.
The queryResult of the latest request doesn't have that data. And the samples only seem to process WebhookRequest and WebhookResponse (
reference: https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/WebhookResponse )
If I can access https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/projects.agent.sessions.contexts/get I may be able to do it. But I don't quite understand if that implies mixing https://github.com/dialogflow/fulfillment-webhook-nodejs/blob/master/functions/index.js with this Client Library:
https://github.com/googleapis/nodejs-language .
In other words, it's not clear to me what the purpose of https://github.com/googleapis/nodejs-language is. Is nodejs-language intended to substitute actions-on-google fulfillments (in the format of https://github.com/dialogflow/fulfillment-webhook-nodejs/blob/master/functions/index.js ) ?
There is a lot going on here, and it isn't quite clear why you think things fit together the way you do.
The nodejs-language library is used to access Google's Natural Language API that runs as part of the Google Cloud Machine Learning API family. This is a completely separate product from the Google Assistant, Actions on Google, and Dialogflow systems. It is meant as an API for people who are looking for a pre-trained AI that can do things like sentiment and syntax analysis. It is not meant as a substitute for any part of the AoG or Dialogflow platform.
As long as the context set two requests ago was set with a lifetime more than 2, and wasn't cleared in between, then it still should be valid and sent to your fulfillment webhook. Since it sounds like you're using Dialogflow V2, you should be able to get all the currently valid contexts as part of the request that is sent to your fulfillment webhook by looking at the queryResult.contexts object in the request body.
If you're using the fulfillment-webhook-nodejs library that you referenced in your post, this should be available to you in the inputContexts variable.

How to ensure my Google Home Assistant application is not rejected?

During our testing, we were unable to complete at least one of the behaviors or actions advertised by your app. Please make sure that a user can complete all core conversational flows listed in your registration information or recommended by your app.
Thank you for submitting your assistant app for review!
During testing, your app was unable to complete a function detailed in the app’s description. The reviewer interacted with the app by saying: “how many iphones were sold in the UK?” and app replied “I didn't get that. Can you try with other question?" and left conversation.
How can I resolve the above point to approve my Google Assistant action skills?
Without seeing the code in question or the intent you think should be handling this in Dialogflow, it is pretty difficult - but we can generalize.
It sounds like you have two issues:
Your fallback intent that generated the "I didn't get that" message is closing the conversation. This means that either the "close conversation" checkbox is checked in Dialogflow, you're using the app.tell() method when you should be using app.ask() instead, or the JSON you're sending back has close conversation set to true.
You don't have an intent to handle the question about how many iPhones were sold in the UK. This could be because you just don't list anything like that as a sample phrase, or the two parameters (the one for object type and the one for location) aren't using entity types that would match.
It means that somewhere, either in your app description or in a Dialogflow intent(they have full access to see what's in your intents) you hinted that “how many iphones were sold in the UK?” would be a valid question. Try changing the description/intents to properly match the restrictions of your app.

Resources