0

I just started exploring developing an action using google actions few days back. Right now I am facing a problem.

What actually I want is that I want to save the information (in the session as attributes) from what user speaks/utters and use that attributes anytime the skill is active.

I came to know about the contexts but the problem with contexts is that it has a lifespan while what I want is to hold the information throughout the session (when the action is started till the action is ended.)

Any help? Thanks-in-advance.

AvidDev
  • 31
  • 1
  • 6

1 Answers1

0

First - contexts are a perfectly good solution to this problem. You can set the context to have a long lifespan (say, 99) and it will be valid for 99 exchanges between your agent and the user.

You can also set an attribute in the data object if you're using the Actions-on-Google library. (Google just turns this into a context with a long lifespan and manages it for you.)

See https://stackoverflow.com/a/47538390/1405634 for more details on both of these.

Prisoner
  • 49,922
  • 7
  • 53
  • 105