Add authenticated chat on Dynamics 365 Portals using Live Assist the right way

Live Assist for Dynamics 365

Live Assist is a software service offered by Café X to create omnichannel customer experiences on Microsoft Dynamics 365 with personalized in-app support via chat, co-browse and document share and more.

Once you configure the Live Assist to provide the chat capability for your portal customers, you will notice the agent will just see “Visitor” chat window popup when the customer initiates a chat. The agent will not see the customer contact record pop up automatically by the CRM even though CRM has the contact record.


Authenticated chats with Live Assist

With the Chat or Telephony integration, it is quite common to expect the contact record to pop on Agent’s screen to provide tailored assistance to the customer and this feature help check the box against all the call center metrics like better better agent utilization, average speed of answer, cost per inbound contact etc.,

So, how can it be done with the Live Assist?

Fortunately, Live Assist provides an easy configurable way to set this up, so when the portal customer clicks on the “Live Chat” floating button, the customer will be forced to login and Live Assist will do its magic to pop open the contact record on the agent’s screen)


That’s great!

But if you keenly notice, there is a small problem with this approach. You are now forcing all your portal customers to login/sign up for a portal account in order to initiate the chat, which may not be a desired feature. What if a customer has questions about how to sign up for an account on the portal? – Dead lock

So, you need a way that will pop the contact open in CRM for the agent if the customer is logged in – and just show “Visitor” on the agent screen if the customer is not logged in. The bottom line is not to force the portal customer to sign in just to initiate the chat, unless you want your customers to login to chat.

So, how do we do it?

Before we jump on to the configuration, it is beneficial to understand how the Live Assist Chat works underneath the hood.

Campaign and Engagements

The Campaign and Engagements serve as building blocks for the chat to function. When you create a Live Assist account and configure the chat, there is a campaign created out of the box with an engagement. You can think of campaign as a container through which you can manage all the aspects of your customer engagements.

You can set goals to achieve with your campaign – the visitors that you want to target, where and how do you want to interact with your visitors.

As part of the step to configure the authenticated chat, you have previously set the “Authentication” flag on the engagement (that was created for you out of the box) to “Yes” indicating that this customer engagement will work only if the portal customer is authenticated.

This is the reason it forces your customers to login before they can initiate the chat. If you turn it off, then all the customers are treated as anonymous users.

But, we want best of both the worlds. Here’s how to do it and you probably might have guessed it.

Create 2 engagements for the campaign that was created out of the box – “Authenticated Engagement” and “Unauthenticated Engagement”. So, you will end up with 2 Live Chat buttons on the portal.

If the customer clicks on the “Live Chat” widget button rendered because of “Authenticated Engagement”, then the contact pop happens on agent’s screen. If the customer clicks on the “Live Chat” button rendered because of “Unauthenticated Engagement” then the contact pop does not happen for the agent.

So, the trick is to show the Authenticated Engagement’s “Live Chat” button only for the authenticated customers and Unauthenticated Engagement’s “Live Chat” button only for the anonymous customers.

Let’s begin

To begin with, delete the engagement that was created out of the box.

Navigate to Service -> Live Assist Supervisor, which will open up the Supervisor Portal.
Click on Campaigns on the left top corner.


On the Campaign page, open up the campaign record and you will see the Engagement record (Sticky chat button) that was created out of the box.


Disable the Engagement by toggling off the button next to the Action dropdown. Or you can choose “Delete” from the “Action” dropdown.

  1. Click on “Add engagement” button.


Click “Web” button.


  1. Choose “Embedded” from the Format dropdown.


Choose any design from the following list. In my case, I am choosing the one below:


Click “Next” and you will see the Engagement Settings page.

  1. Ensure that the “Authentication” is turned on. Click “Next”.


  1. In the Engagement Studio page, type “authenticated” in the Engagement element ID. Click “Save” and “Next”.


Click “Done” in the Engagement Window Library, which will take you back to the Campaign page. Rename the Engagement 1 to “Authenticated Engagement”.


Ensure that the Engagement is enabled by toggling on the field next to the Action dropdown.

We have successfully created an Engagement to handle the contact pop for the authenticated users.

Now, we need to create another Engagement to handle the unauthenticated users.

Repeat the steps 1 and 2 above.

In the Engagement Settings page, ensure that “Authentication” is turned off and click “Next”.

In the Engagement Studio page, type “unauthenticated” in the Engagement element ID textbox.

Click Save and Done.

Rename the Engagement to “Unauthenticated Engagement” and ensure that the Engagement is enabled.

Now, in the Dynamics 365, navigate to Portals -> Webpages. Search for the page where you would like to embed the “Live Chat” widget.

In the page copy (html), add the below liquid code snippet.

{% if user %}</pre>
<div id="authenticated"></div>
<pre>{% else %}</pre>
<div id="unauthenticated"></div>
<pre>{% endif %}

This is equivalent to indicating that if the user is authenticated, inject the “authenticated” div element and if not, inject “unauthenticated” div element.

Now, if Live Assist finds the “authenticated” div on the page, the “Authenticated Engagement” that was created will be used to replace the div with the respective “Live Chat” widget. As we turned on the “Authentication” toggle and the user is already logged in, the live assist passes on the authenticated customer details and hence the Contact record is popped open for the CRM Agent.


And if the “unauthenticated” div is rendered (if the user is not logged in), the “Unathenticated Engagement” will be used. As we turned off the “Authentication” toggle, the live chat just works without forcing the user to login and hence the CRM agent will see “Visitor” chat popup.

As a result, if the user is logged in, then the contact record is automatically opened on agent’s screen and if the user is not logged in, the agent just gets “Visitor” on their Chat window to continue the conversation.

Hope this is useful. Enjoy!

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s