Google智能助理使用API .AI进行高级回复

问题描述 投票:2回答:1

我已经有了一个webhook,我用它来改变助手的答案。但我无法弄清楚如何发送建议卡或链接,因为您可以从API.AI Web GUI(从添加内容按钮)发送它们。

我应该以JSON object名称发送它们作为data

API.AI webhook documentation

actions-on-google dialogflow google-assistant-sdk
1个回答
5
投票

响应API.AI实现webhook调用的JSON主体的一般形式,其中包括针对简单响应和卡的Google丰富响应操作,如下所示。如果你想使用列表或轮播,文档是here

{
  "speech": "This is a API.AI default speech response",
  "displayText": "This is a API.AI default display text response",
  "data": {
    "google": {
      "expectUserResponse": true,
      "isSsml": false,
      "noInputPrompts": [],
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "This is a simple speech response for Actions on Google.",
              "displayText": "This is a simple display text response for Action on Google."
            }
          },
          {
            "basicCard": {
              "title": "Title: this is a title",
              "subtitle": "This is a subtitle",
              "formattedText": "This is a basic card.  Text in a basic card can include \"quotes\" and most other unicode characters including emoji 📱.  Basic cards also support some markdown formatting like *emphasis* or _italics_, **strong** or __bold__, and ***bold itallic*** or ___strong emphasis___ as well as other things like line  \nbreaks",
              "image": {
                "url": "https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png",
                "accessibilityText": "Image alternate text"
              },
              "buttons": [
                {
                  "title": "This is a button",
                  "openUrlAction": {
                    "url": "https://assistant.google.com/"
                  }
                }
              ]
            }
          }
        ]
      }
    }
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.