dialogflow-esdialogflow-es-fulfillment

Saving data into user storage from dialogflow fulfillment webhook


I am exploring ways of saving data across conversation in dialogflow from the client library. What I come up with so far are:

  1. Context - you can save the variable in the output context and give it a long lifetime like conv.context.set.
  2. Storing it into an external database like RDIS using the session as a key.
  3. I also found another way using userStorage https://developers.google.com/assistant/df-asdk/save-data#asdk_node_conv_data.

In the case of user storage, is there some gotha I shouid be worry about?


Solution

  • There's no reason to be worried about using userStorage, some of the advantages of using it are:

    1. When the Assistant can match an identity to the user, the contents of userStorage never expire, and only the user or the Action itself can clear it.
    2. You can clear the content of the userStorage field of your Action by setting the resetUserStorage field of your AppResponse to true.
    3. The userStorage field of your AppResponse object is a string that contains an opaque token supplied by the Action that is saved across conversations for a particular user.

    Important: Obtain user consent prior to using user storage. Some countries have regulations that require developers to obtain consent from the user before they can access or save certain information (like personal information) in user storage.

    Since you will be entering the user personal storage you'll want to ask permission to the users first.