问题
I am trying to figure out how I can embed Google Actions responses, such as the carousel, in a webhook response for DialogFlow.
As epxlained in Is there a way to simply follow a URL in the Caroussel Selector?, the carousel selector can be used to present the user certain options. When the user clicks, the selected item will be sent back to the backend server. As said, I am using Dialogflow, so the fulfillment server will send the carousel list to the Assistant.
It is not clear to me on which REST endpoint the information about the selected item will be provided. Will this be on the Dialogflow webhook endpoint? Or do I have to provision a Google Actions webhook for this (with gactions
CLI tool)?
In case of the latter, how can we prevent that this configuration will not clash with the Dialogflow configuration? As I am not using Google Actions for actual conversation flow, should I have a custom actions.json
which does not listen to any welcome phrases?
回答1:
For starters - rest assured. You need only one webhook and that is the one that you're already using to work with Dialogflow. Responses will go through Dialogflow, but you need to make sure you've added an Intent to handle it.
The intent needs to be set to use an Event of actions_intent_OPTION
. You should not give it any training phrases, but do make sure you set the Action and turn on the fulfillment selector.
When you handle this in your webhook, if you're using the Node.js API, the key of the option will be in a context named actions_intent_option
. You can access it with something like this:
const param = app.getContextArgument('actions_intent_option', 'OPTION').value;
If you prefer to use JSON, you can find the information under
originalRequest.data.inputs[0].arguments[0].textValue
来源:https://stackoverflow.com/questions/49118042/where-will-the-reply-of-a-carousel-selector-be-sent-when-using-dialogflow-fulfil