1

I have implemented userStorage as per this thread and now my code is working perfectly on AoG simulator but when running on dialogflow simulator, I am encountering the error as

Cannot read property 'userStorage' of undefined

Now how to make the code work on both the simulators as I want the web demo for the chatbot I am building and DialogFlow provides me the ability but the code is modified only for AoG Simulator. How to resolve this issue?

The gist of the code I want to change is here.

Thanks for the help.

Lakshay Nagpal
  • 305
  • 5
  • 10
  • Do you need the data to persist beyond a single conversation? There are ways to store session data, although Actions on Google has unique features like user storage. – Nick Felker Jul 06 '18 at 18:28

1 Answers1

2

The userStorage object is available for Actions on Google only.

If you want to do the same thing for the web-based client, you'll need to maintain this information yourself. Possibly storing it in a web cookie or browser LocalStorage instead and then sending it along with the request to Dialogflow, probably in a context.

If you need the user to be able to go between the two and have the same information in both, then you'll need to use something like Google Sign In and store the information in a data store (like Firebase) against the user id.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • Google SignIn is a good option when persisting data on cross platforms but haven't explored that option yet. Will be doing that in my upcoming projects. Thanks again :) – Lakshay Nagpal Jul 07 '18 at 16:25