DialogFlow conv.user.id Deprecated - any implications?

后端 未结 1 714
终归单人心
终归单人心 2021-01-15 17:11

Similar to DialogFlow V2 user id? I am using the user ID from conv.user.id (dialogflow v2) to (anonymously) determine the user in my Dialogflow app. However, I get the log m

相关标签:
1条回答
  • 2021-01-15 17:28

    The anonymous user identity has been deprecated and will be officially removed starting 1 June 2019 (a year from now). So your code snippet will start failing then.

    The fix depends on exactly how and why you're using the id, but for the most basic needs, you can do something like this:

    1. Check to see if you've stored an id in the userStore. If you have - use this id.

    2. If you haven't, generate an id (generating a UUID is a good method to do this), use this as your id, and store it in the userStore for future reference.

    Code to do this might look something like this:

    if ('userId' in conv.user.storage) {
      userId = conv.user.storage.userId;
    } else {
      // generateUUID is your function to generate ids.
      userId = generateUUID();
      conv.user.storage.userId = userId
    }
    

    Alternately, you may wish to just plan to use Google Sign-In for the Assistant which will get you the Google UserID.

    EDIT: userId in condition should be quoted.

    0 讨论(0)
提交回复
热议问题