Dialogflow Messenger V1 not rendering rich response messages

放肆的年华 提交于 2020-06-29 05:05:16

问题


How can I get Dialogflow Messenger v1 to display moch response messages, specifically Quick Replies (a button that sends text when clicked)?

When provided with the below WebhookResponse (v2), the Dialogflow Console debugger correctly displays text_1, quick_reply_1, quick_reply_2, text_2

However, Dialogflow Messenger only displays the plain text, i.e. '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"
  }
}

回答1:


For me, it was simple as I was using dailogflow custom payload. here are the steps:

  1. Open you intent
  2. Scroll down & go-to response.
  3. Click on "Add response button" then choose "custom payload" option. At below, it will enable the area for code.
  4. In that area, add your JSON code. something like:
{
  "richContent": [
    [
      {
        "type": "info",
        "title": "Info item title",
        "subtitle": "Info item subtitle",
        "image": {
          "src": {
            "rawUrl": "https://example.com/images/logo.png"
          }
        },
        "actionLink": "https://example.com"
      }
    ]
]
}

For more rich reply, you can refer code from here: https://cloud.google.com/dialogflow/docs/integrations/dialogflow-messenger#rich




回答2:


For anyone interested, it appears Dialogflow Messenger V1 simply doesn't support the Dialogflow V2 API's Quick Replies Message type. As a workaround, I used Kommunicate.io & custom payloads to implement Quick Replies



来源:https://stackoverflow.com/questions/61619835/dialogflow-messenger-v1-not-rendering-rich-response-messages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!