使用自定义负载的 DialogFlow Messenger 格式化文本

DialogFlow Messenger Formatted Text using Custom Payload

我们如何使用自定义负载将斜体文本等格式化文本发送到 Dialog Flow Messenger

当我们尝试以下自定义负载时,它没有正确格式化文本,

{
  "richContent": [
    [
      {
        "type": "description",
        "title": "Description title",
        "text": [
          "This is text line 1.",
          "<I>This is text line 2.</I>"
        ]
      }
    ]
  ]
}

提前致谢!

它的格式可能不正确,因为您对自定义负载使用了不同的 JSON 格式,您的 JSON 格式应如下所示:

{
  "facebook": {
    "attachment": {
      "type": "",
      "payload": {}
    }
  },
  "slack": {
    "text": "",
    "attachments": []
  }
}

您可以在 Google 提供的 documentation 中阅读更多关于富响应和自定义负载的信息。

编辑:要使文本变为斜体,请在单词或短语前后添加一个星号或下划线

{
  "richContent": [
    [
      {
        "type": "description",
        "title": "Description title",
        "text": [
          "This is text line 1.",
          "_This is text line 2._"
        ]
      }
    ]
  ]
}