Virtual agent message during lunch time

Pooja P
Tera Contributor

Hi team,

 

We have a requirement to display message during lunch time only in Virtual agent. Can someone suggest on condition based message display in VA.

 

Thanks in Advance!

Pooja

1 ACCEPTED SOLUTION

SANDEEP28
Mega Sage

@Pooja P Follow below steps

 

1) Go to "Designer" under Virtual agent. Search for "Greetings." setup topic

SANDEEP28_0-1752757733733.png

 

2) Duplicate this setup topics and save it as "Custom Greeting". 

SANDEEP28_1-1752757825380.png

 

3) In custom greeting record, click on "Show Greeting Message" record & open the scripted response message as show below

 

SANDEEP28_2-1752757956133.png

 

4) Replace code in response message with below code

 

(function execute() {
 var message = '';
 var localDateTime = new GlideDateTime().getDisplayValue();
 var getTime = localDateTime.toString().split(' ')[1];
 var getHour = parseInt(getTime.toString().split(':')[0]);
  
 if (getHour >= 13 && getHour <= 14) 
   message = "Hi there! I'm your Virtual Agent. It’s lunchtime, go ahead and treat yourself to a delicious break! If you’ve already had your lunch, feel free to tell me how I can assist you next."
else 
   message = "Hi, I'm your Virtual Agent. Let me know how I can help you today."

    return message;
})()

 

5) Click on save & publish. While publishing it shows any error of NLU model mapping. Then remove NLU model and Associated intent value from properties section.

SANDEEP28_3-1752758099682.png

 

6) Go to "Settings" module under "Conversational Interfaces" application.  Select "virtual agent", then click on "view all" on "Custom greeting and setup" record. 

 

SANDEEP28_5-1752758571505.png

 

Open the "Default chat experience" record & go to "Setup Topics" section. Replace "Greeting." with "Custom Greeting " in setup topic column. Click on update

 

SANDEEP28_6-1752758715686.png

 

 

 

6) Check in VA if the new response message is showing or not using lunch time

 

SANDEEP28_4-1752758250812.png

 

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

 

 

 

View solution in original post

9 REPLIES 9

SumanthDosapati
Mega Sage
Mega Sage

@Pooja P 

What is your business requirement here?

What message do you want to display and what do you mean by condition based?

 

Regards,
Sumanth

Hi @SumanthDosapati 

 

Requirement is like example I want to display message like "This is lunch time " and it should display in VA Bot between current time 1 PM to 2PM

GlideFather
Tera Patron

Hi @Pooja P,

 

I believe that you must go to "Presence states":

KamilT_0-1752578014873.png

 

And create there a new state that meets your requirements:

KamilT_1-1752578045870.png

 

 

Something as seen below, just Available to receive work item: false

KamilT_2-1752578119093.png

 

 

Let me know how did you managed this.

 

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


@Pooja P the above will add new state here:

KamilT_3-1752578270385.png

 

 

If you want to add a message in Virtual agent, you need to create a new topic with the corresponding logics - condition on time and return the sentence.

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */