For Thought Leaders and Business Leaders - This article tries to provide a perspective on the disruptive potential and cautions of AI powered BOTS for Customer service transformation. For Consultants and Developers, it provides a step by step guide to build your first BOT using Microsoft Cloud (Azure Bot service, QnAMaker, Dynamics 365) and CafeX. The article highlights AI powered chatbot integration with Dynamics 365 via CafeX.
The Perspective
Ever thought why chat-based applications top the list of smart phone usage? 6 of the Top 10 smart phone apps by usage are messaging apps – and the reason is simple. Conversation is a natural interface and if the medium reaches people where they are – they adapt to it naturally, consuming, disseminating and conversing at a time of their convenience.
Quite obviously – Conversation as a platform has established itself as a credible medium of interacting with computers and is being weaved in the very fabric of everyday life – we see every day in Alexa, Cortana, Echo etc.
Extend this argument to Enterprises and it easily explains why Customer Service industry has been disrupted by ‘Conversation as a Canvas’ technologies like BOTS. Chatbots as a channel offer consumers the flexibility of time and access, and offer enterprises a way to deflect routine queries, promote self service and free up agents to focus on areas where they are most effective – a great use-case of Artificial Intelligence amplifying human ingenuity instead of replacing it.
Following statistics put this in perspective.
- Chatbots will be responsible for cost savings of over $8 billion annually by 2022, up from $20 million in 2017 (Juniper Research)
- Chatbots will power 85% of all customer service interactions by the year 2020 (Gartner)
- Half of all searches will be voice searches by 2020. The voice market will grow from $1.6 billion in 2015 to $15.8 billion in 2021 (iProspect)
WHY Chatbots ?
Why do enterprises trust AI technologies like Bots to be at the forefront of Customer Experience? From experience working with my customers I see 5 most compelling reasons.
Availability – Frontline support available 24/7
Connectivity – Being able to connect to various APIs, Business applications and escalate seamlessly to human agents can create great Customer Experience which evolves and learns with context.
Deflection – Deflect routine queries to a lower cost channel like chat
Dialog – Quicker response time, prompt buttons and other visual cues along with supporting textual conversations offer a richer, guided user interaction which works better at initial stages of conversation.
Intelligence – Ability to understand Voice, Language, Intent, Sentiment, Image.
Customer Story
Let’s think of a fictitious water utility company called Contoso.
Contoso struggles to onboard new customers because of a disconnected and static sign-up experience. They now have a BOT embedded across their website, Facebook page and Smartphone app.
The BOT could not just answer routine customer queries 24/7, it could also help the customers sign-up and renew their subscriptions, guiding them efficiently through the sign-up process.
By connecting to 3rd party APIs the BOT can dynamically determine the property details and tariffs and by connecting to back-end systems, the BOT is able to authenticate the customer and access their account. It could then use this information to have rich contextual dialogue with the customer and provide the most appropriate quote.
To top it all, it can identify if the user sentiment turns negative and seamlessly escalate to a human agent, who picks up the chat with all context within the CRM system – and is able to take the conversation forward.
Contoso was able to reduce their call volumes by 37%, increase their conversion rate by 15% and increase their Net Promotor Score (NPS) by 2 points. All the omnichannel touchpoints including BOTS now enrich the customer profile in their CRM/Customer Engagement system. Contoso is now able to intelligently segment their customers. Sales, Marketing and Service functions having access to a unified customer profile delivers unmatched ‘Cross-pollination’ business benefits.
Caution
Unfortunately, poorly built rigid chatbots are not uncommon in the customer service landscape. Customer service leaders and designers must consider the factors listed below. Please note that these should not present barriers to Pilot your bot project, but it is important to keep these principles in mind as you build a long-term Bot strategy for your enterprise.
AI Principles - Fairness, Accountability, Transparency and Ethics must be at the heart of your Bot design. Review the Microsoft AI Principles to understand more.
Scale - Do you need the Bot to support multi turn dialogs, how many intents can it support, how does it react to a new dialog.
Evolution - How does the Bot learn, use knowledge and evolve? Would you use a Dialog tree OR Deep Learning? Be aware that tree representations scale non-linearly.
Enterprise Grade – how do you control, curate, distribute and manage your Bots?
HOW
This section provides a step by step guide to build a simple Knowledge Bot, which can answer a set of questions sourced from 1 or more knowledge repositories/FAQs. The BOT can escalate the chat context to a Human agent using a CRM system and serves as a good starting point for your BOT Pilot.
I have used Microsoft BOT Framework, Azure Bot service and QnAMaker. The outcome should be a QnA Bot running, integrated with your CRM system (Dynamics 365) through the Chat provider (CafeX) escalation channel. The article incorporates recent updates in QnA maker, Azure Bot service and CafeX Live Assist.
Pre-requisites
1. A Dynamics 365 customer service instance running (V9.0 and above)
2. Latest version of CafeX Live Assist installed and running. (Follow the link, click sign-up for a free trial and use your Dynamics 365 credentials to install the solution from App-Source)
3. An Azure subscription
Step 1: Setup QnA Maker
- Sign-up at https://www.qnamaker.ai/ (Use the Dynamics 365 credentials preferably)
- Create a knowledgebase, connect it to one or more FAQ sources and/or add your own pair of questions and answers. Save and Train.
- Click the ‘Test’ button and observe how the QnA Bot can understand your intent, ignore your spelling errors and able to give the right answer – no matter how you frame the question. (Microsoft cognitive services at work in the background)
- Click Publish and Record the values highlighted in blue
Step 2: Create a Web-app Bot connected to QnA Maker.
- Login to your Azure subscription, ‘Create a Resource’, search for ‘Web App Bot’. Make sure that you change the Bot template from ‘Basic (C#)’ to ‘Question and Answer C#’.
- Once the Bot is provisioned in Azure, open the Bot resource. Navigate to Application settings and update QnAAuthKey, QnAEndpointHostName and QnAKnowledgebaseId. These were recorded from QnA maker in the previous step and can be accessed from QnAMaker.AI Knowledge base Settings > Deployment details
POST /knowledgebases/QnAKnowledgebaseId/generateAnswer Host: QnAEndpointHostName Authorization: EndpointKey QnAAuthKey Content-Type: application/json {"question":"<Your question>"}
|
You can now click the ‘Test’ button and ensure that your Azure bot is connected to QnA service and able to answer all your queries.
Step 3: Update the Bot code to enable CafeX escalation
Open BasicQnAMaker.cs
Navigate to the ‘Build’ Tab within the Azure Bot resource and open online code editor. Navigate to BasicQnAMakerDialog.cs
Make code updates
1. Include another package (add this line after the existing Using statements)
using Newtonsoft.Json;
2. Define a static string within the class:
static string TRANSFER_MESSAGE = "transfer to ";
3. Handle bot communications: Replace the code within MessageReceivedAsync method, with the following code. This code ensures that the communication is escalated to a Live Agent with ‘Human’ skill as soon as the customer messages ‘transfer to Human’ or ‘Pathetic’. This can be easily extended to use Text Analytics to escalate based on customer sentiment, present menus to customers and what not! Let’s start simple and build.
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> result) { /* When MessageReceivedAsync is called, it's passed an IAwaitable<IMessageActivity>. To get the message, * await the result. */ var message = await result; var qnaAuthKey = GetSetting("QnAAuthKey"); var qnaKBId = Utils.GetAppSetting("QnAKnowledgebaseId"); var endpointHostName = Utils.GetAppSetting("QnAEndpointHostName"); // QnA Subscription Key and KnowledgeBase Id null verification if (!string.IsNullOrEmpty(qnaAuthKey) && !string.IsNullOrEmpty(qnaKBId)) { //saparash if (message.ChannelId == "directline") { var laChannelData = message.GetChannelData<LiveAssistChannelData>(); switch (laChannelData.Type) { case "visitorContextData": //process context data if required. This is the first message received so say hello. //await context.PostAsync("How can I help you today"); break; case "systemMessage": //react to system messages if required break; case "transferFailed": //react to transfer failures if required break; case "otherAgentMessage": //react to messages from a supervisor if required break; case "visitorMessage": // Check for transfer message if (message.Text.StartsWith(TRANSFER_MESSAGE)) { await context.PostAsync("I am sorry. I'm transferring you to an agent now..."); var reply = context.MakeMessage(); var transferTo = message.Text.Substring(TRANSFER_MESSAGE.Length); reply.ChannelData = new LiveAssistChannelData() { Type = "transfer", Skill = "Human" }; reply.Text = ""; reply.Type = ActivityTypes.Message; await context.PostAsync(reply); } else if (message.Text.StartsWith("Pathetic") ) { await context.PostAsync("I am sorry. I'm transferring you to an agent now..."); var reply = context.MakeMessage(); reply.ChannelData = new LiveAssistChannelData() { Type = "transfer", Skill = "Human" }; reply.Text = ""; reply.Type = ActivityTypes.Message; await context.PostAsync(reply); } else { // Forward to the appropriate Dialog based on whether the endpoint hostname is present if (string.IsNullOrEmpty(endpointHostName)) { await context.Forward(new BasicQnAMakerPreviewDialog(), AfterAnswerAsync, message, CancellationToken.None); } else { await context.Forward(new BasicQnAMakerDialog(), AfterAnswerAsync, message, CancellationToken.None); } } break; default: await context.PostAsync("This is not a Live Assist message " + laChannelData.Type); break; } } else { // Forward to the appropriate Dialog based on whether the endpoint hostname is present if (string.IsNullOrEmpty(endpointHostName)) { await context.Forward(new BasicQnAMakerPreviewDialog(), AfterAnswerAsync, message, CancellationToken.None); } else { await context.Forward(new BasicQnAMakerDialog(), AfterAnswerAsync, message, CancellationToken.None); } } //saparash } else { await context.PostAsync("Please set QnAKnowledgebaseId, QnAAuthKey and QnAEndpointHostName (if applicable) in App Settings. Learn how to get them at https://aka.ms/qnaabssetup."); } } private async Task AfterAnswerAsync(IDialogContext context, IAwaitable<IMessageActivity> result) { // wait for the next user message context.Wait(MessageReceivedAsync); } public static string GetSetting(string key) { var value = Utils.GetAppSetting(key); if (String.IsNullOrEmpty(value) && key == "QnAAuthKey") { value = Utils.GetAppSetting("QnASubscriptionKey"); // QnASubscriptionKey for backward compatibility with QnAMaker (Preview) } return value; } } |
Define the Live-Assist Channel Data object, Insert the following code at the end.
// Live Assist custom channel data. public class LiveAssistChannelData { [JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)] public string Type {get; set;} [JsonProperty("skill", NullValueHandling = NullValueHandling.Ignore)] public string Skill {get; set;} } |
Compile your code
- Open Kudu console
- Navigate to site > wwwroot
- Type Build.cmd and hit Enter.
Step 4: Enable direct line channel for the Bot.
- Navigate to Channels and make the Bot available on Direct line channel. This is the channel which CafeX live-assist uses. If you don’t want to use CafeX, you can make the Bot available in the channel of your choice. You would happy to see that there are quite a few to choose from. After the Bot is published to Direct line channel, take note of any one of the secret keys
Step 5: Connect the Bot to Live-Assist and Test
Create a CafeX Bot
Login to Dynamics 365 and launch the Live-Assist Administration Portal. Ensure that the Dynamics 365 user intended to handle escalation has access to Live-Assist by clicking ‘Manage Users’. Thereafter create a CafeX bot by selecting Users > Bots > Add.
Add Skills to the newly created Bot and the Agent
- Launch the engagement portal and navigate to Users Tab.
- Add the Skill ‘BotSkill’ to the newly created Bot.
- Add the skill ‘Human’ to the Dynamics 365 Agent who will handle the escalation.
Test the Bot
Your Bot is now ready to be tested. Launch the Bot from the CafeX test Portal. Alternatively, you can embed the Bot in your own Portal by adding a code snippet in the Header of your webpage, available in the same CafeX wizard.
Microsoft Dynamics 365 Chatbot / Chatbot with Dynamics 365 is becoming an important pillar of customer service using the Microsoft platform. Hope this article helped, please feel free to share with the larger community, comment, feedback and reach out for help if needed. if you like to evangelize with your professional network - A version of this BLOG is also available on LinkedIn :
https://www.linkedin.com/pulse/ai-powered-bots-transform-customer-service-why-how-saurabh-parashar/
Collective wisdom is good for this planet !
Any opinions expressed herein are solely those of the author.
*This post is locked for comments