问题
I would like to guide users based on webhook response with suggestions chips. From webhook sample, I see below structure:
"fulfillment": {
"speech": "Today in Boston: Fair, the temperature is 37 F",
"source": "apiai-weather-webhook-sample",
"displayText": "Today in Boston: Fair, the temperature is 37 F"
}
But, if I want to suggest users what next you can request to continue the conversation, then how do I pass suggestions chips in webhook response?
回答1:
The response you displayed is the basic API.AI response format. However, Actions on Google expands on this and mainly uses the data.google field as presented below:
{
"speech":"This is a simple response with suggestion chips",
"data": {
"google":
{
"expectUserResponse":true,
"richResponse":
{
"items":
[
{
"simpleResponse":
{
"textToSpeech":"This is a simple response for with suggestion chips"
}
}
],
"suggestions":
[
{
"title":"Option 1"
},
{
"title":"Option 2"
}
]
}
}
}
}
It is important to note, that this only displays suggestions for an actions-on-google application, it won't do anything for stuff like Facebook etc.
来源:https://stackoverflow.com/questions/44380416/webhook-response-with-suggestion-chips