我尝试在基本卡中实现按钮,但出现错误
API版本2:无法解析带有'INVALID_ARGUMENT'错误的JSON响应字符串:“(expected_inputs [0] .input_prompt.rich_initial_prompt.items [1] .basic_card.buttons [0] .open_url_action)版本:找不到字段。” HTTP状态码:200。
conv.ask(new BasicCard({
text: `This is a basic card. Text in a basic card can include "quotes" and`,
subtitle: 'This is a subtitle',
buttons: [
{
"title": "Call",
"openUrlAction": {
"url": "tel:+91123456789",
"androidApp": {
"packageName": "com.android.phone"
},
"versions": []
}
},
],
"formattedText": "Some text",
image: new Image({
url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png',
alt: 'Image alternate text',
}),
"title": "Card Title"
}));
并且我尝试了所有方法在按钮数组中添加另一个空对象,也出现相同的错误:
buttons: [
{
"title": "Call",
"openUrlAction": {
"url": "tel:+91123456789",
"androidApp": {
"packageName": "com.android.phone"
},
"versions": []
}
},
{}
],
以下尝试的代码出现错误:
expected_inputs [0] .input_prompt.rich_initial_prompt.items [1] .basic_card.buttons [0] .open_url_action:协议必须为http或https。
buttons: new Button({
"title": "button text",
'url': "tel:+91123456789",
"androidApp": {
"packageName": "com.android.phone"
}
})
在动作控制台模拟器中获得响应:
"buttons": [
{
"title": "button text",
"openUrlAction": {
"url": "tel:+919177723773"
}
}
]
协议必须为http或https。