With an ever-changing business landscape and diverse user base, it is all the more important to keep a close eye your customer’s perception. As Peter Drucker famously said, “what gets measured gets improved.”

Customer interactions with your business take the form of various channels, most of them being indirect. If you can figure out a quantifiable way to measure your customer’s feedback, then you have got every chance of improving your business.


In this tutorial, we’ll harness the power of IBM Watson combined with PubNub to build a quick and easy observation system to analyze customer feedback. Thanks to the IBM Watson Natural Language Classifier API, we can now leverage AI and cognitive computing to build a system that can deliver superior insights about our customers.

This post was originally published in PubNub Tutorials

IBM Watson Natural Language Classifier

We talk about Google Analytics and various other tools for measuring customer engagement with our products and services over the Internet. But this is all about active engagement. What about the scores of passive engagement channels, such as review websites.

When it comes to customer feedback about B2C businesses, most of it is strewn around the Internet, across hundreds of review websites. Most businesses are unaware of this and their reputation keeps languishing in the red if there is a surge of negative feedback.

How can your business tap into this immense source of data? You guessed it: Let Watson Natural Language Classifier help you find the true intent of your customers’ reviews and build a customer observation system based on that.

Watson Natoral Language Cladccifier for Customer Feedback Analysis

The Natural Language Classifier service is an amazing API that can unearth the real intent beneath every conversation. Like all Watson services, you can build your model based on a training set and help the Watson engine learn over time.

Realtime Customer Observation

Sifting through the scores of historical online reviews and feedback is an interesting prospect for gathering insights. But for some businesses, the insight needs to come at the moment.

Making Sense of Customer Feedback

Making sense of objective feedback is easy…it’s is the feedback comments and remarks that are left out. Watson Natural Language Classifier comes to your rescue. You can initially start with a predefined set of standard feedback comments and assign a classification to them.

As you can see, we are classifying all customer feedback texts into two classifications, “Suggestions” and “Complaints”.

Once you train the Watson Natural Language Classifier service, you have a system in place to analyze every feedback statement and classify it as either “Suggestion” or a “Complaint”.

Launch Your Watson Natural Language Classifier Instance

We have put together a small training set that captures the standard suggestions and complains that can arise at an event.

Go and grab the CSV file from this GitHub repository and start training your Watson classifier. Follow this README file to know the steps for configuring the Watson Natural Language Classifier.

Once the classifier learns to classify the feedback comment into suggestions and complaint, you are ready to launch your realtime customer observation system.

Hosting Your Realtime Customer Feedback System

PubNub Functions makes it really easy to host your application. This edge optimized Function-as-a-Service is ideally suited for realtime application and leverages the PubNub network.

The overall architecture of the application is simple. At the front there is a feedback form. It makes a call to the PubNub Functions along with passing the customer feedback text. This invokes a business logic embedded inside the PubNub Functions. This business logic makes an API call to the Watson Natural Language Classifier to retrieve the classifiers we have trained it for.

Setting Up PubNub Functions

You’ll first need to sign up for your free PubNub account. Once you are done, head over to the GitHub repository where you’ll find the code and installation instructions.

Follow this README file to setup your own instance of the PubNub function. Once done you can paste the function code block from this file.

The code has three major sections:

1. Fetch the customer feedback.

2. Get the feedback classification by making a call to Watson Natural Language Classifier Service.

3. Send the classification results back to the client.

Setting Up the Client

The client application is simulated as a simple bare-bones HTML page. To keep things simple, we have the feedback form and the classification results displayed on the same page.

The client code does three things

1. Initializes the PubNub JS library. You will need your PubNub publish and subscribe keys for that.

2. Publishes the customer feedback on form submit.

3. Subscribes to the channel on response from the PubNub Functions and update the UI.

Let’s Test It Out

We are all set. The Watson Natural Language Classifier service is trained. PubNub function is setup and running. Let’s fire up the client HTML file on a browser and try it out.

You can see the counters for suggestions and complain incrementing with each feedback message being fed to the system.


A proactive customer observation system like this can help analyze customer’s expectations and perception in an effective manner. We hope you like this idea and if this is something that resonates with your business then you should surely give it a try. The globally scalable PubNub Data Stream Network infrastructure allows you to set this up within minutes. And once the Watson service is trained and up, it can become an immense source of customer-driven insights that can benefit your business in the long run.

About the author 

Radiostud.io Staff

Showcasing and curating a knowledge base of tech use cases from across the web.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
TechForCXO Weekly Newsletter
TechForCXO Weekly Newsletter

TechForCXO - Our Newsletter Delivering Technology Use Case Insights Every Two Weeks