Search code examples
dialogflow-esactions-on-google

Null response for name and email entities


I tried inbuilt variable "user" methods, $user.name and $user.email in text response of API.AI, to greet user and show email-Id. Is there any inbuilt variable name user?

Example(User sign-up with Gmail),

Response-Code, I had tried in API.AI's text-response dialog box:
Hi, $user.firstname
This is your $user.email

Expected:
User: Hi!
My-Assistant-App: Hi, Varun.
User: Show my email-id
My-Assistant-App: This is your ******@gmail.com

Output, I am getting in the My-Assistant-App:
User: Hi!
My-Assistant-app: Hi, $user.firstname 
User: Show my email-id
My-Assistant-App: This is your $user.email

Solution

  • Since the original question was asked, there are now ways to get this information - with some caveats.

    You can now use Google Sign In for Assistant to get profile information such as their Google ID and Name. If they have permitted their email address in the profile, this is included as well.

    If you are using the actions-on-google library, this will be available in your Intent Handler in conv.user.profile.payload. If that isn't set, you can request it by using the Sign-In Helper to request it.

    If you are using multivocal, you can set User/IsAuthenticated as a requirement and the information will be available in the environment under User/Profile.

    In either case, the user will have to grant you permission to get the information the first time. After that, this information should be available for all subsequent requests.