Providing customer support in a timely manner is very important to enhance customer experience. Organisations receive communication, from their customers, through various channels like emails, phone calls, applications etc. Organisations need to understand the intent and content of each of the communication and ask customers for any additional information required to fulfil their requests. Manually processing each email request requires a lot of time to go through the emails, understand them and respond to them in a quick and appropriate manner. Additionally, manual processing is error prone. Delay in acting on customer requests could affect customer satisfaction levels. This code pattern addresses these issues. It will demonstrates Watson’s ability to automate email responses that are related to business processes. Customers will benefit from more timely responses and clear instructions for what information is needed in order to fulfill their requests.
In this code pattern we take use cases of a telecom domain customer support who need to action upon email requests they receive from customer. We will consider request scenarios for enabling a service, disabling a service, changing plan and Adding family member to plan.
As a customer support, one should
This code pattern provides an automatic and cognitive way of achieving the above requirements. It uses natural language processing of emails, understanding intents of emails, auto composing responses and providing a dashboard with high level summary of intents and emails. While the use case demonstrated here is for a telecom domain, it can be applied to any domain. It integrates with database, which acts as a CRM, to pull customer information to validate emails and requests. It uses Watson Knowledge Studio for custom domain natural language processing, Watson Natural Language Understanding(NLU) to deploy custom domain model and get entities from emails, Watson Natural Language Classifier(NLC) to get intent of email, IBM Cloudant database to store emails and customer data, Node-RED to integrate with emails, Watson services and IBM Cloudant database, Node runtime for user interface application.
After completing this pattern, you will learn how to:
Create all the resources in the same region, organisation and space so that there will be no issues in accessing the services. Whenever you login to IBM Cloud from command prompt, ensure that you log into the right region, organisation and space by running the command
ibmcloud target
.
Follow these steps to setup and run this code pattern. The steps are described in detail below.
git clone git@github.com:IBM/smart-email-support.git
or
git clone https://github.com/IBM/smart-email-support.git
run cd smart-email-support
to change directory to project parent folder
wbc-Natural Language Understanding
.Free
plan and click Create
.Show Credentials
and save Username
and Password
in a file.wbc-Knowledge Studio
.Lite
plan and click Create
.Launch Tool
.Create Workspace
. Enter a name for workspace and click Create
.Assets
-> Entity types
. Click Upload
. Click on the icon and browse to WKS folder in the cloned git repo and select types-e9.json
file and click Open
. Then click Upload
. Entity types should be populated.Assets
-> Documents
. Click on Upload Document Sets
. Click on the icon and browse to WKS folder in the cloned git repo and select corpus-e9.zip file. Let the options selected be default. click Upload
. Document sets should be loaded.Machine Learning Models
-> Performance
. Click Train and Evaluate
.All
under Document Set
and click on Train and Evaluate
. Training will commence and can be seen at the top right corner of the screen which shows the message Train Processing...
. This process will take about 10 minutes to complete the training process.Machine Learning Model Evaluation Complete
.Machine Learning Models
-> Versions
. Click Take Snapshot
. Enter Description
(optional) and click OK
Deploy
. Select Natural Language Understanding
. Click Next
. Select appropriate region and space. From the Service name drop down select the NLU instance that was created in section. Click Deploy
.OK
.Use both legacy credentials and IAM
when asked for authentication method. While creating database you can use any name to create. For this code pattern we have considered wbc-Cloudant
. Make a note of Cloudant Service credential username and password. Update username and password in cloudant_username
and cloudant_password
.Manage
. Then click Launch Cloudant Dashboard
.Create Database
.Create
.Create Customer database
Manage
. Then click Launch Cloudant Dashboard
.Create Database
.Create
.databases
.customer_data
databaseCreate Document
.Only _id, first_name, last_name, email and phone_no are mandatory
{
"_id": "<email id of customer>",
"first_name": "<first name of customer>",
"last_name": "<last name of customer>",
"email": "<email id of customer>",
"phone_no": "<phone number of customer>",
"plan": "<plan of customer>",
"family": [
{
"first_name": "<first name of family member, if any>",
"last_name": "<last name of family member, if any>",
"phone_no": "<phone number of family member>",
}
],
"services": [
"MCA",
"News"
]
}
e.g
{
"_id": "firstname.lastname@gmail.com",
"first_name": "FirstName",
"last_name": "LastName",
"email": "firstname.lastname@gmail.com",
"phone_no": "1234567890",
"plan": "Infinity"
}
Similarly add all customer details who will send email requests.
wbc-Natural Language Classifier
.Create
.Show Credentials
and make a note of Username
and password
.<git repo parent folder>/NLC
curl -i --user <username>:<password> -F training_data=@./Intent_training.csv -F training_metadata="{\"language\":\"en\",\"name\":\"NLClassifier\"}" "https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers"
curl -u <username>:<password> "https://api.us-south.natural-language-classifier.watson.cloud.ibm.com/v1/classifiers"
wbc-node-red
.Create
.Node-RED
folder and open the contents of the file node-red-flow.json
in a text editor.Visit App URL
.Welcome to your new Node-RED
page click next
.username
and password
.Next
twice and click Finish
.Go to your Node-RED flow editor
.username
and password
that was created in a couple of steps earlier and click Next
.Import
and then click on clipboard
Import
button.FromEmail
node. Update Userid
and Password
fields here. This is the customer support email id which needs to be monitored by organisations to receive emails from customers. For this code pattern, you can use your existing email id or create a new email account with gmail and provide the details here. Also, if required, update the refresh rate, which is in seconds, so that the node will look for new emails at regular intervals. The imported flow has a refresh rate of 360 seconds or 6 minutes. Click Done
.customer_data_search
node.Server
.Host
, Username
and Password
and click Update
. Click Done
.Add Model Id
node and update the model id against msg.nlu_options.entity_model
. Click Done
.nlu
node and specify NLU service instance credentials and click on Done
.NLClassifier
node. Update NLC credentials. Update classifier_id as noted in this section. Click Done
.email db cloudant node
.Server
.Host
, Username
and Password
and click Update
. Click Done
.Deploy
on the top right corner of the screen.Service
dropdown, select the default cloudant node created when Node-Red service got created.
Sendgrid service is used to send emails from our application to customers.
cd smart-email-support
.ibmcloud login
or ibmcloud login --sso
(for federated login).ibmcloud cf push
ibmcloud cf logs <app_name> --recent
.Visit App URL
.Here you can see what all entities were identified and what all entities are missing
Editing auto composed email is not provided in this code pattern while the user can use this code pattern to implement this feature
That concludes the flow of the application.
We saw that emails sent by customers are categorised into different intents. Emails are parsed to identify information available in emails. Missing information, if any, is identified. Email responses are auto composed and customer support representative can just click a button to send the auto composed email. We used WKS to build a custom model and deployed it on NLU to extract entities from emails. We used NLC to get intents of emails, sendgrid to send email and Note-RED flow for process orchestration. We used a Node application to show the working of this use case.
See Debugging.md
This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.