When you present a Google Actions carousel/list on Assistant, you get a list of items. For example:
- Soccer
- Basketball
- Rugby
Next, the user can say Soccer, Basketball or Rugby but not Tennis, Cycling, ... This means that the matching happens in the current context, as created by the carousel or list. This is powerful, as the backend service will only be called upon expected inputs.
I would like to have this behavior in a general conversion; that is, outside the carousel or list functionality. In my application, the user asks for a list of sports. The fulfillment service returns a list of suggested sports. Now the user can repeat a certain sport, to retrieve more information about that sport. If he mentions a sport which was not recently enumerated, an error message could be read out.
I know this could be implemented by keeping the list of mentioned sports in the context and checking against that context in the fulfillment backend service when the user ask for a specific sport. But as said, I noticed that the carousel or list already somehow provide such functionality, which does not rely on the backend service, so I was wondering if there was a better way to implement this behavior?
One way could be bookkeeping user entities during the conversation? That is, we could create a user entity user sport
which only holds the sports as previously mentioned. This way, if the user asks for a sport not in that list, there will be a matching error. I am not sure if this is a good application of user entities, though.
Are there better ways?