问题
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:
- Open you intent
- Scroll down & go-to response.
- Click on "Add response button" then choose "custom payload" option. At below, it will enable the area for code.
- 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