Different answers at different times

I noticed that the basic dialogue function of the bot gives different answers on different times of the day. For example, in the morning it says “good morning” in the evening it says “good afternoon”. I would like to incorporate such functionality to my own bot as well and was wondering if it was possible to condition different output variants not only on the time of the day, but say, on a certain date period? Is this a complicated thing to do in Teneo?

1 Like

Good morning, Amber! you hit upon an excellent use case. Especially for limited marketing actions or when certain programs expire. You can have a set of flows or answers that switch during the right period, and “vanish” after expiration.

The flow you mention is called “Greeting message” (in the folder “Greeting”) uses this idea to give time-appropriate greetings. You may have noticed the on top flow script which sets up the hour into a flow variable which is then queried in the various transitions:

On top script:

TimeZone timeZone = TimeZone.getTimeZone(Lib_sUserTimeZone);
iHour = Integer.parseInt(String.format(‘%tH’, new GregorianCalendar(timeZone)));

In the transitions you can then query for the various cases, for example which is morning:

({iHour >=6 & iHour <=11})

Please take a closer look at the transition "Seasonal Greeting message (this is for Christmas) and you’ll see this condition as well as a comment on how to do this yourself:

{Lib_iMonth==12} &{Lib_iDay>23}

==Other answers can be created following the same pattern and using the variables Lib_iDay, Lib_iMonth and Lib_iYear==

The Dialogue Resource includes the three integer variables noted above and sets them in the global script “Begin Dialog” - so that every session has access to them, filled with the correct values.

We’ve had customers who implemented considerable “timed content” in this way. They actually built language objects containing the query for the date range they wanted, with a condition for the day, month and year. You could also implement this as a scripted context: Context restrictions | Teneo Developers

I hope I’ve answered your question!
Kind regards, Fred

2 Likes