Sentiment Analysis in Salesforce – A Part of Artificial Intelligence

How to Implement Sentiment Analysis in Salesforce – A Part of Artificial Intelligence

 

screen-shot-2017-06-07-at-11-23-42-am

What is Sentiment Analysis:

Sentiment analysis is extremely useful us to gain an overview of the public opinion behind certain topics and feedbacks. Automatically classifying text by sentiment allows you to easily find out the general opinions of people in your area of interest. For example, you might want to analyze reviews of a product to help you improve the customer experience, or to find the most or least popular product.

The Obama used sentiment analysis to gauge public opinion to policy announcements and campaign messages ahead of 2012 presidential election.

How can we get this?

There is lots of tool for sentiment analysis. But I found haven on demand easy to use API.

About HavenOnDemand Sentiment Analysis API: The Sentiment Analysis API analyzes text to return the sentiment as positive, negative, neutral, or mixed. It contains a dictionary of positive and negative words of different types and defines patterns that describe how to combine these words to form positive and negative phrases.

 

How to implement in Salesforce:

Use Case:

You can use this API as you want but in my blog, I am using an example of feedback’s mails.

The user will send an email to Salesforce and here I am saving this email to a custom object and analyzing the sentiment of that email. So support and sales person know that which email is top to pick in morning. Because a team can have tons of emails. In these mail, most negative emails are important to work on because we want the positive feedback from clients. So it is very hard to read one by one email. But from this API you can get the sentiment score and sort them by the score.

Implementation-

A. Get API key from HavenOnDemand:

1. Go here and register yourself.

2. After registration, Go here.

3. Then click on Generate Key button. Here you will get a popup for the name of the key. Fill this and click on Continue.

4. You will see a key here. Copy this key and save it on your computer. we need this on salesforce apex code.

 

B. Coding Part: Download Source Code from here.

After the code deployment. Add your API key in EMailHandler Class.

screen-shot-2017-06-08-at-12-19-28-am

API Explanation:

We need to send request on https://api.havenondemand.com/1/api/sync/analyzesentiment/v2

It is GET call. So you need to pass 2 params in URL.-apikey = Your API key-text = set the text for sentiment analysis.

Read more about API here

C. Now create an Email Services:

1. Go to Setup –> Develop –> Email Services

2. Create Email Service here as belowEmail Service Name = SentimentAnalysisApex Class = EMailHandlerActive = Checked (It should be checked to get inbound emails.)

3. After that create new Email Addresses under Email Service.

D. Add Sentiment View Page: Now add feedback VF page to your page layout. I added in lightning view at the top.

Time to run: Open your mailbox and send an email to an above-created email address. Salesforce will create a record of Feedback object. You can see the sentiment score and sentiment in the record.

If you have any concern then please feel free to contact me.

Please send your feedback to this email address. I will share your sentiment score on my facebook and twitter page.

sentimentanalysis@2ivr6p1y22tgkbwb5z8jsznyk9v7z0ssyk21pi9yrhx3ohl5we.7f-rozfuaq.ap5.apex.salesforce.com

Cheers!!

Happy Salesforce

Read more blogs here..

Article Source:
https://vishnuvaishnav.wordpress.com/2017/06/08/sentiment-analysis-in-salesforce-a-part-of-artificial-intelligence/

2 Comments
  1. Salesforce | Radhakrishna
    Radhakrishna 6 months ago

    Very informative.. Salesforce – The Sentiment Analysis API analyzes text to return the sentiment as positive, negative, neutral, or mixed..

Leave a Reply

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Property of Forcetalks.com
Copyright 2017 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?