代码之家  ›  专栏  ›  技术社区  ›  Andrew Graham-Yooll

basiccard shared type返回open_url_action:在Google助手控制台中,协议必须是http或https

  •  0
  • Andrew Graham-Yooll  · 技术社区  · 7 年前

    当DialogFlowWebhook在对Google助手控制台的响应中返回basiccard时,我收到错误:

    异常响应 应输入\u inputs[0].输入\u prompt.rich \u initial \u prompt.items 1 .basic_card.buttons[0].打开_url_操作: 协议必须是HTTP或HTTPS。

    The docs say that this type should look like :

    "basicCard": {
        "buttons": [
            {
                "title": "button text",
                "openUriAction": {
                    'uri': "https://www.google.com"
                }
            }
        ],
        "formattedText": "Some text",
        "image": {
            "url": "https://www.gstatic.com/webp/gallery3/1.png",
            "accessibilityText": "Accessibility text describing the image"
        },
        "title": "Card Title"
    }
    
    1 回复  |  直到 7 年前
        1
  •  0
  •   Andrew Graham-Yooll    7 年前

    对话框流文档中有错误。

    正确的Webhook响应应该是:

    "basicCard": {
        "buttons": [
            {
                "title": "button text",
                "openUrlAction": {  <--- URL, not URI
                    'url': "https://www.google.com" <-- URL, not URI
                }
            }
        ],
        "formattedText": "Some text",
        "image": {
            "url": "https://www.gstatic.com/webp/gallery3/1.png",
            "accessibilityText": "Accessibility text describing the image"
        },
        "title": "Card Title"
    }
    
    推荐文章