【问题标题】:Custom Payload with dialogflow on google plateform谷歌平台上带有对话流的自定义有效负载
【发布时间】:2020-04-24 07:16:40
【问题描述】:

我正在尝试在 dialogflot 意图中发送自定义有效负载。当我选择谷歌助手下可用的自定义有效负载选项时,它会提供以下预定义的 json 格式:-

{
  "google": {

   }
}

现在我不知道我需要放什么才能从这里得到响应。任何指南都会有所帮助

【问题讨论】:

  • 您说您想使用自定义有效负载,但您不清楚要在其中包含哪些与您可以直接通过 Dialogflow 执行的已定义有效负载类型不同的内容。你能用你想要完成的事情来更新你的问题吗?如果您已经尝试将东西放入有效载荷中,您能否展示您已完成但没有工作的内容?

标签: dialogflow-es chatbot dialogflow-es-fulfillment


【解决方案1】:

在富响应 JSON 中需要添加一些强制键。 您必须有 Suggestion Chips 和一个 Simple Response 来维持您的 Action 的跟进。 AoG 拒绝任何缺少建议筹码或后续响应的行动。

请参阅此 JSON 了解基本卡响应:

{
  "payload": {
    "google": {
      "expectUserResponse": true,
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "Here's an example of a basic card."
            }
          },
          {
            "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\n    most other unicode characters including emojis.  Basic cards also support\n    some markdown formatting like *emphasis* or _italics_, **strong** or\n    __bold__, and ***bold itallic*** or ___strong emphasis___ as well as other\n    things like line  \nbreaks",
              "image": {
                "url": "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png",
                "accessibilityText": "Image alternate text"
              },
              "buttons": [
                {
                  "title": "This is a button",
                  "openUrlAction": {
                    "url": "https://assistant.google.com/"
                  }
                }
              ],
              "imageDisplayOptions": "CROPPED"
            }
          },
          {
            "simpleResponse": {
              "textToSpeech": "Which response would you like to see next?"
            }
          }
        ]
      }
    }
  }
}

您可以在以下文档中为您的操作参考特定的富响应 JSON: https://developers.google.com/assistant/conversational/rich-responses#df-json-basic-card

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-31
    • 2012-10-26
    相关资源
    最近更新 更多