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

Hi @GlideFather ,

 

Kindly help me to add the message in Virtual agent between lunch time period

 

@Pooja P and do you want to be there always or as response when somebody starts conversation?

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


Hi @GlideFather 

 

It would be helpful if we have for both the ways.

 

or more prominently if someone starts the conversation.

@Pooja P 

OK, it shall be doable. Not tested, by try to find the topic with your standard greeting and add there scripted condition for a decision - if it is within the lunch break period, it will return message1 and if it is outside of that time slot, it will return message2

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


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 !!