You can implement account linking with Google Actions in order to link a contact's Google account to their Contact Profile.

1 Activating Account Linking in the Actions Console

The first thing you have to do is to activate Account Linking for your Action in the Actions Console. In the console, you can navigate to Advanced Options > Account Linking in the side menu. Here you have to select Yes, allow users to sign up for new accounts via voice in the Account creation tab, and Google Sign In in the Linking type tab.

b662e26-Screenshot_from_2019-01-16_15-17-05.png
Figure: Activating Account Linking in the Google Actions Console

2 Prompting the user to accept Account Linking

When Account Linking is activated, you can send a message in your Flow that tells Google to start the Account Linking process. When this process starts, Google will prompt the user to accept linking their account, and when they accept, you will get their profile information in the Flow.

You need to copy the following JSON into the Google tab in a Say Node in your Flow. When you hit this node in your Flow, then Account Linking will start:

{
  "expectUserResponse": true,
  "expectedInputs": [
    {
      "inputPrompt": {
        "richInitialPrompt": {
          "items": [
            {
              "simpleResponse": {
                "textToSpeech": "PLACEHOLDER"
              }
            }
          ]
        }
      },
      "possibleIntents": [
        {
          "intent": "actions.intent.SIGN_IN",
          "inputValueData": {
            "@type": "type.googleapis.com/google.actions.v2.SignInValueSpec"
          }
        }
      ]
    }
  ],
  "conversationToken": "{\"data\":{}}",
  "userStorage": "{\"data\":{}}"
}

Dont miss the text-message

You currently also need to specify some text within the SSML editor in order so Account Linking can work. If you are missing some text int he SSML editor, the message will get rejected from Google.

f0a8de9-actions-account-linking.png
Figure: Say Node with Account Linking JSON

Infinite Account Linking Loop

Make sure that you only hit the Say Node containing the Account Linking message if the user is not logged in. Otherwise, you will end up in a loop. This can be achieved with the following CognigyScript in an If Node: !ci.data.accountLinkedUser. You then put the Say Node on the Then Node on the If Node.

3 Accessing the Account Linked User in your Flow

When the Account Linking process is finished, then you can access ci.data.accountLinkedUser, which will be an object containing the profile information of the user.


Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.