Here is the case study demonstrating how an Intelligent Customer Feedback system can be plugged into existing eCommerce portals without the need to re-architect them. Serverless hosting is a cost-effective model to host such systems with ease. The intelligent bot and the analytics system can be built quite quickly with the use of Azure services.
The article is written by Abhishek Mishra, the speaker of the nopCommerce Days 2019 conference. It is an adapted version of his event’s speech.
Abhishek Mishra is an Architect with a leading organization and has deep expertise in designing and building Enterprise-grade Intelligent Azure and .NET based architectures. He is an expert in .NET Full stack, Azure (PaaS, IaaS), Infrastructure as Code, Azure Machine Learning, Intelligent Azure (Azure Bot Services and Cognitive Services) and Robotics Process Automation. He has a rich 14+ years of experience working across leading organizations in the industry. He is an active Author and MVP with C# Corner where he writes on Microsoft Azure, Machine Learning and Artificial Intelligence. Certifications to his credit – TOGAF Certified, Microsoft Certified Solutions Associate in Machine Learning, Microsoft Certified Azure Developer Associate and many more.
Table of contents
- Setting the Context
- The Business Case
- Transforming the Business Case to Requirements
- Building the Intelligent Customer Feedback System
- Assembling all the Architecture Components
Setting the Context
Serverless Architecture has been the favorite design practice for Cloud Architects while building Modern Enterprise-Grade Cloud solutions. Serverless Architecture is cheap, reliable, and scalable, secured and comes packed with all goodness that a classic traditional Cloud Platform as a Service solution can offer.
Serverless Architectures have been the favorite offerings for Cloud giants like Amazon and Microsoft. Even a lot of their own in-house applications and offerings run on Serverless Architectures.
Microsoft Intelligent Azure platform provides a bunch of Artificial Intelligence offerings that can make the applications smart enough to understand customers’ intent and respond back with the right action.
Here we would pick up a business case for an intelligent customer feedback system for an eCommerce company and build a Reference Architecture step by step using the Serverless Intelligent Azure platform.
The Business Case
A mid-sized eCommerce company is looking forward to build an enhanced collaboration with the customers. It is planning to have an Intelligent Bot that can interface with the customers and gather their feedback. The Bot should be intelligent enough to understand the natural language of the customers. The feedbacks gathered should be analyzed and actioned in a timely manner. The customers are active on social platforms like Twitter and share feedbacks there as well, so the feedback from Twitter should also be analyzed and actioned.
The company has heavily invested to modernize its eCommerce portal two years back. The customers love the experience they are having with this revamped site. A cost-effective solution has to be delivered for the business case and the solution should work as-is in the current ecosystem it has. The current portal should not be re-architected or refactored to support a customer interaction system. However, the solution should have the ability to sit on the existing portal with minimal changes incorporated.
The solution should be scalable enough to handle a large customer base. It should be highly secure and reliable. High Availability is a key concern. There should be zero or low Infrastructure Maintenance.
Transforming the Business Case to Requirements
The Requirements in the Business Case can be grouped into three areas.
- Intelligent Bot that can understand Customer Interactions and respond back appropriately.
- A Feedback Analytics system that can analyze the feedbacks and pass them on to the backend team who can act on it.
- Non Functional Requirements like Scalability, Security, Availability, Cost Effectiveness, easily pluggable to existing portal and low Infrastructure Maintenance.
The business flow would be as below for the case.
Step 1: The customer sends feedback to the Bot. Example feedback, “Did not have a great experience”.
Step 2: Bot interprets customer feedback and responds back. Example reply, “Sorry to hear that. We will sort it out and get back to you at earliest.”
Step 3: Bot forwards the feedback to the Feedback Analytics system.
Step 4: Feedback Analytics system determines the sentiment involved in the feedback. It saves the feedback in the database and forwards the sentiment score and details to the backend team for appropriate actions.
Step 5: Feedback Analytics system should also be invoked whenever customer tweets feedback on Twitter.
Microsoft Azure Platform has a wide range of offerings to handle these requirements. Services like Azure Bot Service, Azure Machine Learning Service, Cognitive Services and Language Understanding Intelligent Service can help build an Intelligent Bot.
Azure Serverless offerings can help build a cost-effective Feedback Analytics System. Bots can pass on the feedback to it. It can interface with social media platforms with great ease and tap in the feedbacks from there as well.
Azure Serverless and Intelligent Azure Services are inherently secured, scalable, and highly available and have zero maintenance overhead as Microsoft maintains the Infrastructure and developers just host their code there without being worried about the underlying Infrastructure. Azure Serverless are budget-friendly offerings as the cost is incurred only when the services are consumed. The system can be made highly secured by integrating it with Azure Active Directory.
Building the Intelligent Customer Feedback System
The Intelligent Customer Feedback System can be built in smaller chunks and then can be integrated into a full-blown system. Below are the components that have to be built.
- The Intelligent Bot that can process the Natural Language of customers and reply back.
- The Serverless component that can receive the customers’ feedback from the Bot, analyze the sentiment of the feedback and pass on the feedback to the backend team for appropriate action. This component is a part of the Feedback Analytics System.
- The Serverless component that can track customer feedbacks from Twitter, analyze the feedback sentiment and pass on the feedback to the backend team for appropriate action. This component is a part of the Feedback Analytics System.
Building the Intelligent Bot
The Intelligent Bot should understand the customer chats and respond back appropriately. It should understand Natural Language.
Microsoft Bot Framework
Microsoft Bot Framework provides a great platform to build Bots. Let us dive into what Microsoft Bot Framework is. This Framework allows building Bots using C# or Node JS. These Bots are set of Web APIs that can be invoked or integrated with a variety of communication channels like Facebook, Slack, Twitter, Skype, Teams, etc.
Figure 1 highlights communication between different components of the Bot Framework. The user sends a chat to the Bot using a popular medium like Facebook, Twitter, Microsoft Teams or Skype or any other supported channel. Each messaging channel generates a channel-specific JSON message containing the user chat that the generating channel can only understand. Connector Service converts the channel-specific message to Activity JSON message that the Bot developed using C# or Node JS can understand. The Bot can be hosted on Azure Bot Service. When the Bot replies back it sends the message using Activity JSON. Connector service converts the Activity JSON into the corresponding channel JSON. The channel JSON interprets the Bot message and delivers the message to the user.
Figure 1: Microsoft Bot Framework
Language Understanding Intelligent Service (LUIS)
The Bot needs to process the Natural Language of the customer. Microsoft Language Understanding Intelligent Service (LUIS) can help here. LUIS is a machine learning based Natural Language Processing Service hosted on Microsoft Azure. LUIS works using Intents, Utterances, and Entities. Point to be noted here that Microsoft LUIS is a Natural Language Processing engine provided by Microsoft. Figure 2 gives a detailed description of LUIS.
Figure 2: Language Understanding Intelligent Service (LUIS)
Intelligent Bot Architecture
Now let us use Microsoft Bot Framework and LUIS to build the Intelligent Bot. The bot built using Microsoft Bot Framework can be hosted on Azure Bot Service. Direct Line Channel should be enabled for the Bot. Web Chat v4.0 that supports Direct Line Channel can sit on the existing customer portal using iframe and interface between the customer and the Bot.
The responses that the Bot needs to reply to the customers are maintained in a Knowledge Base hosted on Microsoft QnA Maker Service.
LUIS will interpret user chats and understand the Natural Language and fetch the right response from the QnA Maker Knowledge Base.
The customer sends a chat to the Web Chat v4.0 that further sends the chat to the Bot hosted on Azure Bot Service (with Direct Line channel enabled). The Bot invokes the LUIS API to understand what the customer chat. Based on the understanding of the chat the Bot searches for an appropriate response from the QnA Maker Knowledge Base and replies back.
Figure 3 shows the architecture for the Intelligent Bot.
Figure 3: Reference Architecture for the Intelligent Bot component
Building the Serverless Feedback Analytics System
The Feedback Analytics System consists of two major components.
- A component that would receive user feedbacks from the Bot, analyze the sentiment score of the feedback and forward the feedback to the backend team for further action.
- A component that would fetch the feedback from Twitter, analyze the sentiment score of the feedback and forward the feedback to the backend team for further action.
Before we start building the Feedback Analytics system let us try to understand what Serverless hosting is in the cloud context.
Serverless is the most cost-effective and highly scalable cloud hosting model. As in Platform as a Service model there is no Infrastructure overhead for the developers. Developers just need to build their code and push it to Serverless cloud service Figure 4 shows a quick comparison of different cloud hosting models.
Figure 4: Cloud Hosting Models
Architecture for Serverless Feedback Analytics System that interfaces with the Bot
Azure Functions are the basic and most commonly used building units of Azure Serverless architectures. In our current business scenario, we need to invoke the Serverless Feedbacks Analytics System from the Bot using an HTTP call. Azure functions can easily be triggered using HTTP calls. The feedbacks need to be screened whether they are negative or positive. If negative, to what degree they are negative and if positive, to what degree they are positive. Microsoft Cognitive Services exposes Text Analytics Sentiment API that can accept the Feedback, analyze it and get back with a decimal score between 0 and 1. Score tending towards 1 is relatively positive and score tending towards 0 is relatively negative. Microsoft Cognitive Services are web services hosted on Azure and are an essential Artificial Intelligence offering of Azure. Figure 5 gives a quick glance at Microsoft Cognitive Services.
Figure 5: Microsoft Cognitive Services
The bot can pass on feedback received from the customers to the Azure function using HTTP Triggers. Azure Function can pass on the feedback to the Microsoft Cognitive Services Text Analytics Sentiment API and get the sentiment score. It can judge whether the feedback is negative or positive and can pass it on to the backend team that will action the feedback using the Azure Send Grid email service. All feedbacks and the corresponding sentiments can be logged in Cosmos DB for future Analytics purposes. Figure 6 depicts the architecture of this component.
Figure 6: Feedback Analytics System that interfaces with the Bot
Architecture for Feedback Analytics System that picks customer feedbacks from Twitter
Microsoft Logic Apps is an excellent Azure Serverless offering that can interface with Twitter and fetch the tweets. Microsoft Logic Apps has an array of connectors that helps it to interface with different services and industry standard components with ease. Twitter Connector can be used in Logic Apps to interface with Twitter and pull out the tweets. Once the Logic App gets the customer feedback tweets, it passes them to the Microsoft Cognitive Services Text Analytics Sentiment API and gets the sentiment score. Based on the score it decides whether it is a positive tweet or negative tweet and forwards it to the backend team for the next set of actions using Azure Send Grid Email service. Tweets are logged in Azure Cosmos DB for future analytics. Figure 7 depicts the architecture for the component.
Figure 7: Feedback Analytics System that analyses tweets
Assembling all the Architecture Components
We have built the sub-components of the Architecture. Now let us assemble the components to build a full-blown Intelligent Serverless Component hosted on Azure Serverless. Figure 8 depicts the complete architecture of the system.
Figure 8: The Final Architecture
The solution is integrated with Azure AD. User needs to authenticate with Azure AD and then start chatting with the Bot. The Web Chat sits on iframe in the existing customer portal. The customer sends chat to the webchat that forwards the chat to the Bot service hosted on Azure Bot Service. Azure Bot Service sends the chat to Microsoft LUIS to understand the Natural Language of the customer and then fetches the right the response that it has to communicate back to the customer from the Azure QnA Maker knowledge base. Point to be noted here that Microsoft LUIS is a Natural Language Processing engine provided by Microsoft. It has to be trained with the right intents, utterances and entities during development phase so that it can process the Natural language. Azure Bot Service responds back a response to the customer and passes on the feedback to the Azure Function using HTTP Trigger. Azure Function invokes Microsoft Cognitive Services Text Analytics Sentiment API and gets the sentiment score of the feedback. Based on the sentiment it passes on the feedback to the backend team to action it using Azure Send Grid email service. Azure Logic Apps gets the customer feedback tweets from Twitter, passes it to Microsoft Cognitive Services Text Analytics Sentiment API and gets the sentiment score. Based on the sentiment it passes on the sentiment to the backed team for further action. Bot Azure Function and Azure Logic Apps log the feedbacks in Azure Cosmos for future analytics.