2

As part of an action configured for account linking with the following topology:

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

I'm seeing Google Assistant injecting its own message prior to going through the account linking flow, as follows:

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

The linking flow is triggered by the following in the webhook:

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

I'd like to be able to replace the above stock message with a custom one, however when attaching a context to a sign in card with our own message, like so:

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));

I'm still seeing the default message tacked at the end:

    "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? "

How can I replace the Google default message with my own?

Simeon Leyzerzon
  • 18,658
  • 9
  • 54
  • 82

1 Answers1

1

To ensure a consistent experience for users, you cannot replace the default message. You can only set the context, which lets you provide your custom information for the user ahead of the generic question.

The context is an additional piece of information which may be more relevant to your Action. Let's say it's connecting to your example.com account. You would add the context as a string:

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

The user would hear this message, with the generic prompt appended:

To provide you with personalized info from example.com, I need to link your Example Action to Google. Is that ok?

Then you can say yes or no, and go through the OAuth flow / Google Sign-In flow.

Simeon Leyzerzon
  • 18,658
  • 9
  • 54
  • 82
Nick Felker
  • 11,536
  • 1
  • 21
  • 35
  • In that case, would it be safe to assume that the generic `I need to link your to Google. Is that ok?` would ALWAYS appear on the device? Are there any variations to that message that Google may introduce to make the conversation look more spontaneous? Could you elaborate on what the context is, with some code examples of what would go in it (if not a variant of that message), please? – Simeon Leyzerzon Feb 25 '19 at 15:22
  • Yes, this generic prompt will always appear. There are no variations of this prompt. I've updated my answer with a code example. – Nick Felker Feb 25 '19 at 15:56