Virtual Agent - Starting conversations in a custom... - ServiceNow Community
Mark Roethof
Tera Patron
Tera Patron

Hi there,

Fancy the Virtual Agent, though not satisfied enough with how the conversations are starting? Maybe this can give you some food for thought!

find_real_file.png

Currently, we are working on the implementation of Virtual Agent into our production environment, though facing some issues, having limited branding options, several bugs, the conversation start which is not mature enough, etc..

About the branding, I wrote an article before (Virtual Agent - Changing the bot appearance). This time, starting conversations in a custom way.

The issues we are facing with the regular starting of conversations with the Virtual Agent:
- Users start typing pretty quickly. The Top selection message (default: "You can type your request below, or use the button to see everything that I can help with.") is barely being read. This causes users to not getting the result they are expecting, and even quitting to use the Virtual Agent.
- The Welcome message (default: "How can I help you?") can't be personalized. The welcome message is a string, and does not accept scripting like gs.getUser().getFirstName() or vaInputs.user.first_name
- Default the history of previous chats (up to 30-days) is shown.
- The topic order when selecting "Show Me Everything" can't be changed
- The text input bar displaying "Please type your request" can't be made (conditionally) read-only.

Chat history

Opening the Virtual Agent with/without the chat history is possible. Just by adding "sysparm_skip_load_history=true" to the URL, the history will not be loaded. You can add this to the options of the widget, directly in the server script of a (cloned) widget, or if you calling the virtual agent separately through URL.

https://<your-instance>.service-now.com/$sn-va-web-client-app.do?sysparm_nostack=true&sysparm_stack=no&sysparm_skip_load_history=true

Topic order

We dropped the topic order issue. Reason being the feedback we received from Hi:
"The development team has confirmed that PRB1331125 is fixed in New York release and the topics will be sorted alphabetically."

If you do want to have an alternative for this, have a look at an article Simon H wrote recently:
Virtual Agent - How to switch Topics

Top selection message

No matter what you type in the top selection message, users barely read the message, users start to type pretty quickly, users don't get the response they are expecting, and event drop the usage of the Virtual Agent.
Unfortunately, we can only change the top selection message text. It's just a string. We also looked at changing the "Show Me Everything" button, even though you can influence the text pretty easily with the Sys UI Messages, it's just a string. Disabling the text input bar is also no option, so users will keep typing. We can change the "Please type your request" message (again through Sys UI Messages), though also this does not limit users from typing.

Only if we could add some additional messages, an image, a custom start topic...

Welcome message

We would like to start the conversation with a personalized sentence. For example, "Hi Mark, ...". We can achieve this easily within topics, by using vaInputs.user.first_name. Though this is not possible with the welcome message system property, this is just a string.

Only if we could add some scripting somewhere, a custom step, a custom start topic...

Custom start topic

Starting with a different topic is a possibility. The bot can be started with several additional parameters. Parameters like "sysparm_debug=true", "sysparm_skip_load_history=true", "sysparm_topic=<sys_id>". Starting a custom topic is nice, but then you only have that topic available and nothing else. Or you would have to let the topic end, and it will start in the normal way like we are used to.

Only if we could tie topics to each other, if we could have something like a sub-topic, switching between topics...

Switching topics

Eureka! Credits to Simon H for this one. Simon responded to one of my other Virtual Agent articles, that he found a way to switch topics. Shortly after he wrote a nice article about this:
Virtual Agent - How to switch Topics

Our custom Start Conversation

1) How it looks like:
find_real_file.png
find_real_file.png

2) And after finishing a topic:
find_real_file.png

The technical bits and pieces

3) Because we are not using the Welcome message and Top selection message, we cleared these properties.
find_real_file.png

4) Setting up a custom topic.
find_real_file.png

Condition:

(function execute() {
    
    return '';

})()

(This way, the Start conversation will not be shown in the list of available topics.)

Topic Flow:

find_real_file.png

Bot Response Text, Response message:

(function execute() {
   
   return gs.getMessage('G\'day {0}, my name is Quinn, your Virtual Agent.', [vaInputs.user.first_name]);

})()

Utilities Script Action, Action Expression:

(function execute() {
    
    // Define variable(s)
    var languageStr = 'en';

    // Query record(s)
    var grUserPreference = new GlideRecord('sys_user_preference');
    grUserPreference.addQuery('user', vaInputs.user);
    grUserPreference.addQuery('name', 'user.language');
    grUserPreference.addQuery('value', '!=', 'en');
    grUserPreference._query();

    if(grUserPreference._next()) {
    	languageStr = grUserPreference.value;
    }

    // Define variable(s)
    vaVars.imageStr = gs.getProperty('glide.servlet.uri') + '/qt-va-core-welcome-' + languageStr + '.jpg';

})()

(Some extra coding has been added because we are displaying an Image with text. Though our instance is using English and Dutch. This script decides the language of the user, and which Image to display. The images are just added to the images table, Image: English, Image: Dutch.)

Bot Response Image Output, Image URL Link:

(function execute() {
    
    return vaVars.imageStr;

})()

If in a multi-language instance, create a Sys UI Message record with key:

G'day {0}, my name is Quinn, your Virtual Agent.

5) Switching to the start conversation topic, after ending a topic

Topic Flow:

find_real_file.png

Utilities Script Action, Action Expression:

(function execute() {

    var topicStr = 'Start conversation';

    vaSystem.switchTopic(topicStr)

})()

6) Opening the start conversation
Copy the sys_id of the Start conversation, and add it to the sysparm_topic.
find_real_file.png

Test this thru:
https://<your-instance>.service-now.com/$sn-va-web-client-app.do?sysparm_nostack=true&sysparm_stack=no&sysparm_skip_load_history=true&sysparm_topic=<sys_id>

Summary

A custom way to start your Virtual Agent conversations. It's a bit of work, and still not perfect. Hopefully, New York, Orlando, Paris will upgrade the Virtual Agent immensely. Though, until then, this custom way of starting your Virtual Agent conversations might help the user acceptance and user experience while working with the Virtual Agent.

---

👍
If this post helped you in any way, I would appreciate it if you hit bookmark or mark it as helpful.

Interested in more articles, blogs, videos, and Share projects on Virtual Agent I published?
Virtual Agent


Kind regards,
Mark

---

LinkedIn

Comments
Camille5
Kilo Contributor

Hi there, thanks for that - very helpful. How did you change the 'See all topics' to 'say 'Show me everything? Did you update the sys_ui_message table?

Mark Roethof
Tera Patron
Tera Patron

Hi there,

I believe this changed from London to Madrid. Though, if you wish to overwrite this text, indeed just add a sys_ui_message with language English.

Kind regards,
Mark

---

LinkedIn

Abhay Somani
Mega Expert

Hi Mark,


Thanks for composing this article. By using this article, I have developed a complex solution for my client.
Keep sharing the good stuff.


Regards
Abhay

 

Nikita35
Kilo Guru

Hi Mark

Can you help on this query?

https://community.servicenow.com/community?id=community_question&sys_id=180dd437dbf4c0d023f4a345ca9619a8

Regards

kgupta
Tera Contributor

Very Promising!!

kgupta
Tera Contributor

Hi Mark,

I am facing issues with the image. its not showing up. any idea where i am messing.

find_real_file.png

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Hard to say, what did you setup? How are you using the Bot Response Image Output? You could also open a new topic on the community for this: Virtual Agent and Natural Language Understanding (NLU).
If I have time I will spot it, else lots of other willing to help community members 🙂

Kind regards,
Mark

---

LinkedIn
Community article list

kjay
Giga Contributor

update the label in this sys property to change "Show me everything"

com.glide.cs.topic_picker_button_label

Mark Roethof
Tera Patron
Tera Patron

Don't understand your question. Please clarify.

Kind regards,
Mark

Version history
Last update:
‎05-19-2019 05:21 AM
Updated by: