Null response for name and email entities

前端 未结 4 1588
名媛妹妹
名媛妹妹 2021-01-06 06:05

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 inb

4条回答
  •  醉话见心
    2021-01-06 06:38

    I am able to make it work after a long time. We have to enable the webhook first and we can see how to enable the webhook in the dialog flow fulfillment docs If we are going to use Google Assistant, then we have to enable the Google Assistant Integration in the integrations first. Then follow the steps mentioned below for the Account Linking in actions on google:-

    1. Go to google cloud console -> APIsand Services -> Credentials -> OAuth 2.0 client IDs -> Web client -> Note the client ID, client secret from there -> Download JSON - from json note down the project id, auth_uri, token_uri -> Authorised Redirect URIs -> White list our app's URL -> in this URL fixed part is https://oauth-redirect.googleusercontent.com/r/ and append the project id in the URL -> Save the changes

    2. Actions on Google -> Account linking setup 1. Grant type = Authorisation code 2. Client info 1. Fill up client id,client secrtet, auth_uri, token_uri 2. Enter the auth uri as https://www.googleapis.com/auth and token_uri as https://www.googleapis.com/token 3. Save and run 4. It will show an error while running on the google assistant, but dont worry 5. Come back to the account linking section in the assistant settings and enter auth_uri as https://accounts.google.com/o/oauth2/auth and token_uri as https://accounts.google.com/o/oauth2/token 6. Put the scopes as https://www.googleapis.com/auth/userinfo.profile and https://www.googleapis.com/auth/userinfo.email and weare good to go. 7. Save the changes.

    3. In the hosting server logs, we can see the access token value and through access token, we can get the details regarding the email address.

    4. Append the access token to this link "https://www.googleapis.com/oauth2/v1/userinfo?access_token=" and we can get the required details in the resulting json page.
    5. accessToken = req.get("originalRequest").get("data").get("user").get("accessToken")
      r = requests.get(link) print("Email Id= " + r.json()["email"]) print("Name= " + r.json()["name"])

提交回复
热议问题