Virtual Assistant bots in Microsoft Flow using with escalation to CaféX Live Assist for Dynamics 365 #nocode

Getting Started – Step by Step

Creating intelligent “bots” that provide conversational UI is super easy using However, when the bot runs out of answers, it is essential to be able to hand over the conversation to a customer service advisor that can pick up where the bot left off. This is where Café X Live Assist 365, with its integration into Microsoft Dynamics 365 enables a seamless experience for both your users and customers.

The SAAS platform uses the Microsoft language understanding (LUIS) service and the Microsoft Flow no-code platform to intelligently route and manage a chat based conversation with a customer.

CaféX Live Assist 365 for Dynamics 365 provides advanced web chat capabilities that can be handled by bot or a human agent advisor.

The advantage of this approach over typical development approaches is that the solution can be created with no code, significantly reducing development time, whilst improving time to value, and enabling business users to manage and update the conversational model in Microsoft Flow. This is a big leap forward, as up until now development of intelligent bots has required experienced code development.

In this article I will quickly outline the configuration steps. To get started you will need a few things:

  1. A Dynamics 365 for Customer Service environment. Try now
  2. A Microsoft Azure subscription. Try now
  3. A Café X Live Assist subscription or trial connected to your Dynamics 365 instance. This is requested from Settings-> Microsoft AppSource->Search for “Live Assist for Dynamics 365 Powered by CaféX” -> Try now.
  4. An Enterprise Trial. Try now signing up using the same credentials as you use to manage Dynamics 365.

Configuring the Virtual Assistant bot using QnA Maker, and Café X

The customer conversation can be supported by Virtual Assistant bot a simple Question and Answer (QnA) knowledge base, to provide straightforward answers to frequently asked questions (FAQ) using Microsoft QnA Maker.

You need to first prepare a simple QnA document or FAQ which has the best answer to common questions. This can be in the form of a Word Document, Spreadsheet, or even an existing Web Site that has a structured FAQ page.

Go to Follow these steps to Create a Knowledge Base. This will create a QnA Service in your Microsoft Azure subscription.

Step 1 – Setting up the QnA Maker Service

Log on to using the same account as you use for you Microsoft Azure subscription, and Create a knowledge base

Follow the steps to create the knowledge base

Create the QnA Service in Azure

Return to QnA Maker, in Step 2, click “Refresh this page” and select your newly created Azure QnA Service from your subscription:

Give your KB a name, and using the Add URL or Add File, upload your prepared FAQ or document. Select whether you want to provide your bot with one of the pre-defined “chit-chat” personalities. In this case I have chosen The Professional. Click Create you KB. This screenshot includes a sample of a document that is suitable for uploading – it is simply a table of Question/Answer pairs.

Clean up the knowledge base to remove duplicate answers, improve formatting, reduce ambiguity and provide alternative phrasing for questions that should return the same answer.




Test the bot to check that the responses are appropriate for the questions. If you need to update any questions or answer pairs, Save and train the bot again, re-test before clicking Publish

Publish the QnA Maker service and note the IDs and endpoints:

2 KB Host
3 Subscription Key

Step 2 – Connecting the QnA Maker Service to AtBot

Return to your Azure admin and select the Resource Group that you created earlier. You will see a number of services have been deployed.

Using the Add button, create a Bot Channels Registration, specifying the Messaging Endpoint (Host) from the QnA Maker service deployment.

Once the resource has been created, click Go to Resources, and select Settings within the Bot Channels Registration

Update the bot profile, adding an icon, description as required. Within Settings, select the Manage link next to the Microsoft App ID

Make sure you log on using the same account as your Microsoft Azure account. Within the Application Registration, create a new application secret by clicking on Generate New Password

Take a note of the generated password, and application ID, cut/paste into your notepad or sticky notes, scroll to the bottom of the screen and click Save.

4 Bot Web App Secret
5 Bot Web Application ID

Return to the Azure Admin for the Bot Channels Registration. Select Channels. You will see the Web chat channel. Add the Direct Line Channel.

Within the Direct Line configuration, copy the Secret Key, click Done

6 Bot Direct Line Key

Log on to the Admin portal using your Dynamics 365 credentials, at and create a new Web/SMS Bot

Paste in the Web Bot App ID, App Secret, and Direct Line Key that you configured earlier.

7 AtBot Messaging Endpoint

Select the QnA Maker tab and paste in the details from the QnA Maker steps earlier. Click Save Bot, and verify a success message is displayed.

In the Azure Admin portal, select the resource group created earlier, select the Bot Channels Registration you created earlier, and select Settings. In the settings, change the Messaging Endpoint from the original QnA Maker one to the AtBot Messaging Endpoint.

Click Test in Web Chat to verify that the bot is working

Return to the Admin portal, and select Test & Embed to test the bot.

Step 3 – Connecting the Bot to Café X LiveAssist365

In your Dynamics 365 Instance, select the Café X Live Assist Administration Tile: select Account Administration, Add a Bot User, and paste in the Direct Line Channel key, Click Save

Under Get Started, Select Chat, Copy the Web Site snippet

In the Café X Live Assist 365 Engagement Admin, select Users, Skills, create skills for “human” and “bot”

Under Users, assign the “human” skill to people, and the “bot” skill to your Virtual Assistant bot.

In the Café X Live Assist 365 Engagement Admin, select the Campaign for Live Chat on your Site, and Edit the properties of the Engagement.

Edit the Engagement so that by default new chats are routed to the “bot” skill, so the Virtual Assistant will pick it up.

Within Dynamics 365, select the Dynamics 365 Portals Admin App module, select Web Templates -> Header and paste the snippet into the top of the Header Web Template file:

Paste the snippet into the top of the header file, just below the first line.

Save the Header and refresh the Portal. Verify that the Live Assist widget is working on the Portal, and that the bot responds to questions from the QnA by default

Verify that responses from the FAQ and chit-chat are appearing correctly. If required, modify, train & test and republish these from the QnA Maker Portal. Remove the “chit-chat” responses for any positive or negative phrases such as “angry”, “useless” or “happy” so we can configure a Flow to handle these in the following steps.

Note that formatting in the Café X Live Assist chat widget uses HTML currently and does not support the same markdown capabilities of the Open Source Bot Framework web chat control. So to accommodate that, I have updated the responses from QnA Maker slightly to enable the web link URLs to work in the Café X widget. There is currently no common markdown that will work in both Café X and the standard web chat widget, and also there is no support for Adaptive cards or the carousels.

Step 4 – Managing conversations in Flow using AtBot, with Sentiment Analysis using the Text Analytics Service

Up to this point, the Virtual Assistant bot is defaulting to answering questions using the FAQ configured in QnA Maker, and there is no way for the Virtual Assistant to escalate to a Live Agent. We can configure atbot so that if no suitable intent or FAQ is found for the phrase entered by the user, we can define a Flow to enable escalation if the sentiment is negative. From, logged on using the same credentials as for Dynamics 365, go to the Flow icon, and select Create from blank to create a new flow.

In the new Flow, search for “atbot” and select the AtBot Admin connector “When the bot sends the default message to the user (preview)”. This Flow will be triggered if there was no suitable response found in the FAQ, or the keywords entered did not trigger a LUIS Intent. I will cover configuring LUIS intents in a future article.

In the Flow, select the Virtual Assistant bot that you created earlier from the list of available bots configured in your AtBot environment.

Return to your Azure Admin site, select the Resource Group created earlier, and add a Cognitive Services Text Analytics service:

Click Create

Give the service a name

When deployment has completed, go to the resource

Copy the key value, Key 1

8 Text Analytics Account Key

From the Text Analytics Service Overview, select the Endpoint and Subscription ID

9 Endpoint/Site URL

Return to the Flow configuration and add a Text Analytics Action, give it a name, and enter the Account Key and Site URL from above.

Pass the current Message Text to the Text Analytics step in the Flow. Save the Flow.

Add a condition, to determine the action based on sentiment score. I have set a threshold of 0.35. We can potentially handle “neutral” scores with a bit more dialogue.

Step 5 – Handling Escalation from AtBot to Café X using Custom Channel Data

In the “Yes” branch, add an AtBot Logic Send Reply Action which informs the user that they will be transferred to a human agent, and a second one which escalates to the “human” skill. Currently the second message is not displayed, so we will see the default messages from Café X to indicate the escalation taking place. In the second Send reply activity, expand the Advanced options and in the Custom Channel Data field, enter the JSON value below, which will signal the escalation to Café X. (TIP: Type this in rather than copy/paste, in case quote characters have been replaced).


In the “No” condition following the Detect Sentiment step, configure a suitable message for neutral and positive sentiment, and save the Flow.

Test the Virtual Assistant bot, and check that the Flow runs as expected. In Dynamics 365 ensure you are logged in as a Live Assist Agent in another browser window, so that the Agent can pick up the escalation.

Within LiveAssist 365 for Dynamics 365, the customer service agent can see the entire chat context with the Virtual Assistant, and details of the navigation history and browser details for the customer. This gives very useful insight and context to the advisor, so they can pick up where the Virtual Assistant bot has left off. Another advantage is that the entire Chat History can be linked to a Dynamics 365 Case for follow up, so enable the Customer Service experience delivered by both the Virtual Assistant bot and Customer Service personnel to be reviewed and improved over time.


In this article I have outlined the basic steps for configuring AtBot, Café X and Dynamics 365 along with Azure Services and QnA Maker to provide a no-code Virtual Agent bot that can handle basic interactions with a customer, escalating to a Customer Service Advisor team when the Virtual Assistant bot is unable to answer the questions.

This provides the foundation for much more complex Virtual Asistant bot interactions, and in a future post I will outline how you can define a LUIS model to pick up on customer Intent, and carry out a conversational flow with the customer. Within the Flow that is triggered based on the Intent, we can then call other services using the 235+ connectors available within the Microsoft Flow platform. An example may be to have an interaction with Dynamics 365 to create a case, or follow up on a previously recorded case for a customer.

I hope you find this approach useful, thank you for reading, any feedback is greatly appreciated.

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