【问题标题】:How to replace default response in account linking on Google Assistant如何在 Google Assistant 上的帐户链接中替换默认响应
【发布时间】:2019-02-25 14:54:40
【问题描述】:

作为配置为使用以下拓扑链接帐户的操作的一部分:

Actions-on-Google->Dialogflow->Webhook,

我看到 Google 助理在完成帐户关联流程之前注入了自己的消息,如下所示:

"I need to link your <action-name> to Google. Is that ok?"

链接流程由 webhook 中的以下内容触发:

 public ActionResponse launchRequestHandler(ActionRequest request) throws Exception {
    ResponseBuilder responseBuilder = getResponseBuilder(request);
    responseBuilder.add(new SignIn());
}

我希望能够用自定义消息替换上述库存消息,但是当使用我们自己的消息将上下文附加到登录卡时,如下所示:

String speech = "Hi, I see that your account isn't connected. "
                    + "I've sent a link to your Google Assistant app that will get you started and set up in just several simple steps. "
                    + "Don't worry, I'll be here waiting, just call me when you're ready.";

responseBuilder.add(
                    new SignIn()
                        .setContext(speech));

我仍然看到最后添加的默认消息:

    "Hi, I see that your account isn't connected. 
    I've sent a link to your Google Assistant app that will get you started and set up in just several simple steps.  
Don't worry, I'll be here waiting, just call me when you're ready.,
 I need to link your <action-name> to Google.  Is that ok? "

我如何替换用我自己的 Google 默认消息?

【问题讨论】:

    标签: dialogflow-es actions-on-google google-assistant-sdk account-linking


    【解决方案1】:

    为确保为用户提供一致的体验,您不能 替换默认消息。您只能设置上下文,这样您就可以在一般问题之前为用户提供自定义信息。

    上下文是可能与您的操作更相关的附加信息。假设它连接到您的 example.com 帐户。您可以将上下文添加为字符串:

    app.intent('Login', conv => {
      conv.ask(new SignIn('To provide you with personalized info from example.com'))
    })
    

    用户将听到此消息,并附加一般提示:

    为了向您提供来自 example.com 的个性化信息,我需要将您的示例操作链接到 Google。可以吗?

    然后您可以说是或否,然后通过 OAuth 流程/Google 登录流程。

    【讨论】:

    • 在这种情况下,假设通用I need to link your &lt;action-name&gt; to Google. Is that ok? 总是出现在设备上是否安全?谷歌可能会引入该消息的任何变体以使对话看起来更自发吗?您能否详细说明上下文是什么,并附上一些代码示例(如果不是该消息的变体),好吗?
    • 是的,这个通用提示会一直出现。此提示没有变体。我已经用代码示例更新了我的答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多