1

I just started using Dialogflow and I'd like to create an Dialog where I can ask "What time do I have to go to University today" and depending on what day of the week it will give me a different answer. I know I can get the date via @sys.date, but is there something similiar to get the day of the week?

Thanks!

Basti
  • 517
  • 4
  • 19

1 Answers1

2

Dialogflow doesn't have a lot of built-in conditional processing. So while you can use @sys.date to turn "today" into the date, you can't then use the date to figure out some other value.

You can, however, use the Fulfillment section to turn a date passed as a parameter into whatever you want using whatever logic is available. For a simple task like this, you can use the built-in Fulfillment Inline Editor. If you enable it, you'll be presented with some sample code, including an illustration how to access the parameters from the request.

Once you have deployed it, you'll also need to turn on Fulfillment for the specific Intent that is doing the processing. (See the second image below.)

(Update: It does have some conditional processing, since it can choose different Intents based on the Contexts that are set and specific utterances. However, there is no Context that is set for the current day of the week. While you can set one yourself, this would be done through Fulfillment, so it is probably just as simple as actually processing the parameter. It might be useful for a more extensive conversation, but not for a short question-answer.)

Inline Editing with Fulfillment

Enabling fulfillment in an Intent

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • Thank you very much! But there's a thing I don't understand: I would guess that when an Intent is called, the "ActionHandler" is being called. The Response for the Welcome-Action is "Hello, Welcome to my Dialogflow agent!". But on the Welcome-Intent itsself there are the Responses "Hi", "Hello", ... And when trying my Action it always gives back the answers from the Intent-Page and not from the code. How does this work? – Basti Oct 30 '17 at 12:30
  • The most likely cause of this is that you didn't turn fulfillment on for the Intent itself. I mentioned this in my original answer, but I've updated it to include a picture of where this needs to be enabled. – Prisoner Oct 30 '17 at 13:43
  • Thank you very much, it works now! You helped me a lot! – Basti Oct 30 '17 at 14:26