首页 > 解决方案 > 具有帐户关联选项的 Google Home 应用

问题描述

我正在使用 DialogFlow 开发一个谷歌家庭扬声器应用程序。

我的场景是,如果用户登录,那么应用程序会显示用户的特定信息,或者如果用户未登录,它应该显示一般信息。

我填写了帐户链接部分(链接类型:OAuth)

(DialogFlow -> 集成 -> Google Assistant -> MANAGE ASSISTANT APP -> 帐户链接)

我还在 DialogFlow 的 Google 助手集成选项窗口中取消选中“需要登录”。

我的意图代码是使用 conv.ask(),而不是 conv.close()

但是当我在模拟器上运行测试时它显示它没有链接,您可以使用 Google Home 应用程序设置帐户,之后对话结束。

我想要做的是即使用户没有完成帐户链接,用户也可以使用该应用程序。(用户登录应该是可选的,不是强制性的)

有任何想法吗?

谢谢。

已编辑

我正在使用“默认欢迎意图”并选中“为此意图启用 webhook 调用”。

我的意图看起来像这样。在设置帐户链接之前效果很好。

app.intent('Default Welcome Intent', conv => {
  conv.ask('Welcome');
});

和我的截图。 Google 模拟器上的 Actions 截图 (抱歉截图中没有英文文本。它告诉它需要帐户链接并终止对话。)

这是 Google 模拟器调试选项卡上的操作中的日志消息。

{
  "request": {
    "response": "テスト用アプリ とリンクしていません。Google Home アプリからテスト用アプリ と Google アカウントをリンクできます。",
    "expectUserResponse": false,
    "conversationToken": "GidzaW11bG...",
    ...
    "debugInfo": {
      "sharedDebugInfoList": [
        {
          "name": "Account Linking Url",
          "debugInfo": "https://gala-demo.appspot.com/app?login_hint=..." // removed sensitive information from the string
          "subDebugEntryList": []
        }
      ]
    },
    "visualResponse": {
      "visualElementsList": [],
      "suggestionsList": [],
      "agentLogoUrl": ""
    },
    "clientError": 0,
    "is3pResponse": 1
  },
  "response": {
    "response": "テスト用アプリ とリンクしていません。Google Home アプリからテスト用アプリ と Google アカウントをリンクできます。",
    "expectUserResponse": false,
    "conversationToken": "GidzaW11bG...",
    "visualResponse": {
      "visualElementsList": [],
      "suggestionsList": [],
      "agentLogoUrl": ""
    },
    "clientError": 0,
    "is3pResponse": 1
  },
  "debug": {
    "sharedDebugInfoList": [
      {
        "name": "Account Linking Url",
        "debugInfo": "https://gala-demo.appspot.com/app?login_hint=...", // removed sensitive information from the string
        "subDebugEntryList": []
      }
    ]
  },
  "errors": []
}

标签: dialogflow-esactions-on-googlegoogle-home

解决方案


我发现当我从 DialogFlow 中的集成菜单运行模拟器时,模拟器以我设置的“需要登录”的旧版本启动。当我从 Actions on Google TEST 部分运行模拟器时,它会从当前设置开始(不需要登录)。

您可以从模拟器屏幕检查版本


推荐阅读