Reputation: 83
I am trying to get a time value from an intent as both $time and $time.original. I need the $time value to do some processing on it and I need the $time.original to show the output back to user.
For example, if user says, 'are you open tomorrow?', I want to respond 'Yes, we are open tomorrow?' but on the back end, I need the value of date 'tomorrow' to do the processing.
Any help would be appreciated.
Upvotes: 1
Views: 1098
Reputation: 6800
First, you would need @sys.date
entity if you want to catch value of entities like tomorrow
instead of @sys.time
Now coming to the question, directly extracting the parameter value will only give us parsed date value, not the original value.
But if we set an output context, then from that context we can extract both parsed value and the original value as intended.
Here is a request that we get on webhook we can get date and date.original by parsing the output-context that we set in the intent:
{"responseId":"###","queryResult":{"queryText":"are you open tomorrow","parameters":{"date":"2018-12-28T12:00:00+05:30"},"allRequiredParamsPresent":true,"fulfillmentText":"","fulfillmentMessages":[{"text":{"text":[""]}}],"outputContexts":[{"name":"projects/###/agent/sessions/###/contexts/time","lifespanCount":5,"parameters":{"date":"2018-12-28T12:00:00+05:30","date.original":"tomorrow"}}],"intent":{"name":"projects/###/agent/intents/###","displayName":"time-intent"},"intentDetectionConfidence":1,"languageCode":"en"}}
Upvotes: 3
Reputation: 543
I have not also tried with it yet but I Guess you would be able to parse it with it system entity Dialogflow system Entities as they're shown @sys.date and example matches with what you need. I guess it will be processing it into date
Upvotes: 0