Search code examples
dialogflow-esactions-on-googlegoogle-home

Accountlinking on implicit invocation intent


Is it possible to trigger the accountlinking on an implicit invocated intent? (One which isnt the first intent that is triggered).

publish settings

When i publish my agent to actions on google with the above settings, i don't get a request to link my account if i trigger the selected intents. If i change the sign in required to the default welcome intent i do get the request.

Is accountlinking on intents other than the main intent possible or do i need specific changes for this?

Thanks in advance!


Solution

  • We fixed it by implementing our own sign-in using actions on google in the register intenthandler. Like such:

    CheckAccountLinking: async function(conv, input) {  
            if (!hasAccountLinked(conv)) {
                conv.ask(new actionsOnGoogle.SignIn());
                return;
            }
    
            conv.ask(`Continue message`);
        }
    
        const hasAccountLinked = function(conv)
        {
            console.log(`checking if account is linked`);
            console.log("Payload user:", conv.body.originalDetectIntentRequest.payload.user);
            const isLinked = conv.body.originalDetectIntentRequest.payload.user !== undefined && conv.body.originalDetectIntentRequest.payload.user.accessToken !== undefined;
    
            console.log("Has account linked", isLinked);
            return isLinked;
        }