How to Detect the Sentiment of Your Customers on Cases in Salesforce Using OpenAI
Here is a step-by-step guide on how to analyze the sentiment of your customers on cases in Salesforce.


Traditionally when a customer logs a case with the company, we have used different factors to route the cases to different support queues for resolution. Like using customer tier, customer lifetime value, their support entitlement, the nature/type/category of the case or language, geographical location etc.
One of the critical factors that have been missing is detecting the sentiment of the customer on that case. Like are they happy, angry or frustrated about your product or services?
But why is it important to detect customers sentiments?
It is important because it provides valuable insights into how customers feel about their experience with the business. By analyzing customer sentiment, businesses can better understand their customers’ needs, preferences, and pain points, and use that information to improve their products, services, and overall customer experience.
Detecting customer sentiment can also help businesses identify potential issues or trends that may be affecting multiple customers, allowing them to proactively address those issues before they escalate. Additionally, analyzing customer sentiment can help businesses identify and prioritize which cases need to be handled urgently and which ones can wait, which can improve overall efficiency and customer satisfaction.
And why is it important to prioritize handling of unhappy customers?
Unhappy customers are at a higher risk of churning or leaving your business. Studies have also shown that unhappy customers are more likely to share their negative experiences with others and leave negative reviews online, which can harm your business’s reputation and ultimately impact your bottom line.
By prioritizing unhappy customer cases, you can address their concerns and complaints in a timely and effective manner, potentially preventing them from leaving your business and even turning them into loyal customers. Additionally, addressing unhappy customer cases first shows that you value your customers and are committed to providing excellent customer service, which can help build trust and loyalty with your customer base.
How do I detect sentiments?
In the past, it was challenging for computer systems to comprehend human emotions. However, thanks to the latest advancements in AI technology, particularly in generative AI, detecting a customer’s sentiment when they log a case has become much simpler than before.
By analyzing the customer’s tone and language, it is now possible to identify if they are unhappy, angry, or frustrated. Consequently, such cases can be fast-tracked and directed to more experienced personnel who can handle them more effectively.
Here is a step-by-step guide on how to do this on a Case in Salesforce Using OpenAI
It’s time to put words into action and learn something super cool. Follow these step-by-step instructions to use OpenAI, the company behind ChatGPT, to detect the sentiment of cases created in Salesforce. Knowing the sentiment will enable you to use Salesforce’s native features to route the cases, monitor their progress, and ensure timely and effective resolution. It won’t take more than 30-40 minutes for you to get this working end-to-end in your Salesforce org.
This will help you get started. Once you get the idea of how this is done, it will be up to your imagination and creativity on how you can marry these two technologies to achieve amazing results for your business. Enjoy!
Here is what we will be covering in this guide, step-by-step:
- Register with OpenAI & Get API Key
- Prework
- Create Permission Set
- Create External Credential
- Create Named Credential
- Create Apex Class
- Create Screen Flow
- Deploy & Test the Flow