Live Assist – Pre-Chat Surveys

Within Live Assist for CaféX we can create pre-chat surveys. But how can we use this information in Unified Service Desk to better serve the customer?

I will show you a simple example in this blog post, in which I will display a message to the operator if the customer selects a particular pre-chat survey answer. This is a simple example! I hope you will see that once we can return the results of pre-chat survey questions in USD we could drive other automation. Such as automatically creating a case for support requests or creating an opportunity for sales queries.

Live Assist Pre-Chat Survey

Before I show you my USD configuration, a quick description of pre-chat surveys in CaféX might be appropriate. Below you can see I have started to customize my chat engagement window. And the dropdown on the views field shows that I have pre-chat survey enabled.

Clicking on pre-chat survey will allow me to create as many questions as required. Initially these will include name, email and phone number. But these fields can be changed. You can see I have added a pick list that says “How can we help you today?”.

In this simple / silly example my options were “Sales query”, “New / Existing support request?” or “STOP YOU GOING GREEN!!”. Later I will want to alert the operators if the customer selects this option!

After publishing my campaign in Live Assist I ended up with a pre-chat survey looking like this.

Unified Service Desk Changes

Now I have a pre-chat survey I want to look at the detail of my changes in Unified Service Desk. In USD we can open the chat context and see various things, including the pre-chat survey questions. That is great but what if we don’t want the operator to have to review these? Maybe it would be better to build automation around them???

The first thing that helps us in this quest is that all of the chat context details are available in Unified Service Desk as replacement parameters. Below you can see a snip from my debugger in USD that shows the ChatContext replacement parameters. Highlighted is the pre-chat survey. Each survey is going to be different, including different questions and obviously different answers. To cope with this, what we get in USD is a string in JSON format.

So far so good, but how can we use this JSON information in USD?

In my simple / silly example I wanted to know if the customer entered “STOP YOU GOING GREEN!!” to the question “How can we help you today?”. To find this out I created a simple scriptlet. My scriptlet is shown below…..

My code is shown below.


function returnAnswer() {
  var questionarray = [[ChatContext.ChatPrechatSurvey]+];
  var arrayLength = questionarray.length;
  var question;
  var answer;
  var returnValue = "None";
  for (var i =0; i < arrayLength; i++) {
    question = questionarray[i].question;
    answer = questionarray[i].answer;
    if(question=="How can we help you today?") {
      returnValue = answer;
    } // End if
  } // End for
  return returnValue;
} // End function
returnAnswer();

I hope you can see that this code loops round all of the questions looking for “How can we help you today?”. When if finds this question the answer entered will be returned. (Or if the customer didn’t enter anything, “None” would be returned.)

Now I have the results from the pre-chat survey being returned in my scriptlet, how can I use this to automate “stuff” in USD? I decided to display a message when the session starts. But I could have equally decided to create a case or something. To do this I next created an action.

Notice that the condition on my action uses the scriptlet I created. Basically this action will only fire it the scriptlet says the customer entered “STOP YOU GOING GREEN!!”

“[[$Scriptlet.CafeXWarning]+]”==”STOP YOU GOING GREEN!!”

The final part of my puzzle was when to trigger this action. When Live Assist is deployed into USD we get a hosted control called “Chat Control”. This control has an event called ChatSessionCreated. I simply added my action to the end of that event.

Now when an agent grabs a chat they might get a warning that this customer is at risk of going green. I did say it was a silly example. But hopefully you can see that this concept could be expanded to do more useful automation tasks. The result of my changes is shown below;

Hopefully this post will have provided some insight into the chat context in Live Assist and shown one “silly” way that we might use this information within Unified Service Desk.

One thought on “Live Assist – Pre-Chat Surveys

  1. Pingback: USD – The Book | Microsoft Dynamics 365 and Unified Service Desk

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s