Webhook 响应 "suggestion chips"

Webhook response with "suggestion chips"

我想根据带有建议芯片的 webhook 响应来指导用户。从 webhook 示例中,我看到以下结构:

"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"
}

但是,如果我想建议用户下一步可以请求继续对话,那么我该如何在 webhook 响应中传递建议信息片?

您显示的回复是基本的 API.AI 回复格式。但是,Google 上的操作对此进行了扩展,主要使用 data.google 字段,如下所示:

{
  "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"
          }
        ]
      }
    }
  }
}

重要的是要注意,这只会显示对 google 应用程序的操作建议,它不会对 Facebook 等内容做任何事情