【发布时间】:2018-08-23 13:29:23
【问题描述】:
我想通过 python 中的实现通过 JSON 响应向用户发送三张基本卡片作为响应。那么有什么办法可以做到吗?
附言
基本上,我想向用户显示call、mail 和call on office 的三个按钮,但由于基本卡仅显示一个链接,我认为可以显示多个包含按钮的卡!
这是我要发送的回复。
{
"payload": {
"google": {
"expectUserResponse": "true",
"richResponse": {
"items": [{
"simpleResponse": {
"textToSpeech": "Here is the information of " + user_name
}
},
{
"basicCard": {
"title": name,
"subtitle": subtitle,
"image": {
"url": picture_url,
"accessibilityText": "Picture of " + name
},
"formattedText": msg,
"buttons": [{
"title": "Call " + user_name,
"openUrlAction": {
"url": "tel:+" + contact
if contact is not None
else "",
"androidApp": {
"packageName": "com.android.phone"
},
"versions": []
}
}
if contact is not None
else {
"title": "Send Mail to " + user_name,
"openUrlAction": {
"url": "mailto:" + email,
"androidApp": {
"packageName": "android.intent.extra.EMAIL"
},
"versions": []
}
},
{
"title": "Call on extention",
"openUrlAction": {
"url": "tel:+" + extension
if extension is not None
else "",
"androidApp": {
"packageName": "com.android.phone"
},
"versions": []
}
}
],
"imageDisplayOptions": "WHITE"
}
}
],
"suggestions": [{
"title": "Info of " + manager
if manager is not None
else ""
},
{
"title": "Info of " + hr_manager
if hr_manager is not None
else ""
}
]
}
}
}
}
【问题讨论】:
-
据此github.com/dialogflow/dialogflow-fulfillment-nodejs/issues/34 不支持超过一个按钮。但是,当我查看dialogflow.com/docs/reference/message-objects#basic_card 此处的文档时,我们看到一张表卡只能有 1 个按钮,但它没有为基本卡指定 - 按钮是数组类型(外部链接列表)。
-
是的,你有什么建议?
标签: dialogflow-es actions-on-google fulfillment