Webhook response with “suggestion chips”

独自空忆成欢 提交于 2019-12-12 05:19:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!