【问题标题】:Dialogflow Messenger V1 not rendering rich response messagesDialogflow Messenger V1 未呈现丰富的响应消息
【发布时间】:2020-07-03 12:23:02
【问题描述】:

如何让 Dialogflow Messenger v1 显示 moch 响应消息,特别是 Quick Replies(单击时发送文本的按钮)?

当提供以下WebhookResponse (v2) 时,Dialogflow 控制台调试器正确显示 text_1、quick_reply_1、quick_reply_2、text_2

但是,Dialogflow Messenger 仅显示纯文本,即“text_1 text_2”

See screenshot

{
  "responseId": "XXX",
  "queryResult": {
    "queryText": "cancel",
    "parameters": {},
    "allRequiredParamsPresent": true,
    "fulfillmentText": "XXX",
    "fulfillmentMessages": [
      {
        "text": {
          "text": [
            "text_1"
          ]
        }
      },
      {
        "quickReplies": {
          "title": "quick reply title",
          "quickReplies": [
            "quick_reply_1",
            "quick_reply_2"
          ]
        }
      },
      {
        "text": {
          "text": [
            "text_2"
          ]
        }
      }
    ],
    "intent": {
      "name": "XXX",
      "displayName": "XXX"
    },
    "intentDetectionConfidence": 1,
    "diagnosticInfo": {
      "webhook_latency_ms": 1692
    },
    "languageCode": "en"
  },
  "webhookStatus": {
    "message": "Webhook execution successful"
  }
}

【问题讨论】:

    标签: dialogflow-es dialogflow-es-fulfillment


    【解决方案1】:

    对我来说,这很简单,因为我使用的是 dailogflow 自定义负载。步骤如下:

    1. 打开你的意图
    2. 向下滚动并转到响应。
    3. 单击“添加响应按钮”,然后选择“自定义负载”选项。在下方,它将启用代码区域。
    4. 在该区域中,添加您的 JSON 代码。类似:
    {
      "richContent": [
        [
          {
            "type": "info",
            "title": "Info item title",
            "subtitle": "Info item subtitle",
            "image": {
              "src": {
                "rawUrl": "https://example.com/images/logo.png"
              }
            },
            "actionLink": "https://example.com"
          }
        ]
    ]
    }
    

    想要更丰富的回复,可以参考这里的代码:https://cloud.google.com/dialogflow/docs/integrations/dialogflow-messenger#rich

    【讨论】:

    【解决方案2】:

    对于任何感兴趣的人,Dialogflow Messenger V1 似乎根本不支持 Dialogflow V2 API 的快速回复消息类型。作为一种解决方法,我使用 Kommunicate.io 和自定义有效负载来实现快速回复

    【讨论】:

      猜你喜欢
      • 2021-05-19
      • 2021-10-08
      • 1970-01-01
      • 2020-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-14
      • 1970-01-01
      相关资源
      最近更新 更多