🍕 Let's Start With a Pizza Shop Story
Imagine you own a pizza shop. Every day, 500 customers leave reviews on your website. Some say "This pizza was absolutely amazing! Best cheese ever!" Some say "It was okay, nothing special." And some say "Worst experience of my life. Cold pizza, rude staff, never coming back."
Now imagine you have to read all 500 reviews every single day and decide which customers need urgent attention. By the time you finish reading — it is already tomorrow. Those angry customers have already left.
Sentiment Analysis is like hiring a super-smart reader who reads all 500 reviews in 2 seconds, labels each one as POSITIVE 😊, NEUTRAL 😐, or NEGATIVE 😡, and immediately tells you which ones need urgent action.
Your Oracle CX Service receives 50,000 customer feedback submissions per day. Across email, chat, survey forms, and REST APIs from mobile apps. In five languages. From 30 countries.
How do you know which customer is about to churn — right now — before it is too late?
That is the exact problem we are solving in this article — using OIC Gen 3's built-in AI capabilities to automatically classify customer feedback sentiment and take immediate action inside your Oracle ecosystem.
A complete OIC Gen 3 integration that:
① Receives customer feedback from any channel (REST API trigger)
② Calls OCI Language AI to detect sentiment + confidence score
③ Classifies the result: POSITIVE / NEUTRAL / NEGATIVE / MIXED
④ Routes based on sentiment — updates Oracle CX, creates service request for negatives, sends Teams alert for critical cases
⑤ Stores enriched feedback with sentiment label back to Oracle Fusion or a database
Full step-by-step configuration. Exact JSON. Every field explained.
🧠 Section 1: What Is Sentiment Analysis — Really?
Forget the technical definition for a moment. Here is the simplest way to understand it:
"Best service I ever had!"
"Will definitely recommend!"
Action: Log as success story. Send loyalty reward offer.
"Delivery was on time."
"Nothing special."
Action: Log it. Monitor if same customer goes negative next time.
"Completely unacceptable!"
"I want a refund immediately!"
Action: CREATE SERVICE REQUEST NOW. Alert manager. Priority response within 1 hour.
"Love the product, hate the price."
Action: Log both aspects. Route to relevant team for each issue.
The AI reads the text, looks for emotional signals (words like "amazing", "terrible", "disappointed", "fantastic"), considers the full context, and returns a sentiment label + a confidence score.
📊 Understanding the Confidence Score
The AI does not just say "NEGATIVE" — it also tells you how confident it is on a scale of 0.0 to 1.0. This confidence score is crucial for routing decisions in your OIC flow.
☁️ Section 2: Meet the Engine — OCI Language AI
Oracle provides a ready-made AI service called OCI Language — part of Oracle Cloud Infrastructure AI Services. You do not need to train any machine learning model. You do not need a data scientist. You call a REST API, pass your text, and Oracle's AI returns sentiment analysis results instantly.
Imagine Oracle has hired thousands of expert language analysts who have read millions of texts in every language. They understand sarcasm, context, mixed emotions, and industry-specific vocabulary. When you send them a customer review, they read it instantly and send back their expert analysis. OCI Language is those analysts — available as a REST API, 24/7, for any volume.
🔌 OCI Language API — What You Call in OIC
OCI Language exposes a REST API. In your OIC flow, you call this endpoint using the REST Adapter:
Content-Type: application/json
Authorization: Bearer {OCI_Auth_Token}
{
"documents": [
{
"key": "feedback-001",
"text": "Your delivery was 3 days late and the product arrived broken. Absolutely terrible experience!",
"languageCode": "en"
}
]
}
🏗️ Section 3: What We Are Building — The Complete Picture
Before we touch OIC, let us see the complete flow we are building. Like an architect who draws the blueprint before picking up a hammer.
🏗️ Customer Feedback Sentiment Analysis — Complete OIC Flow
Feedback Form
Response
Exit Feedback
REST API
(CRITICAL cases)
(NEGATIVE cases)
(POSITIVE cases)
(ALL cases)
⚙️ Section 4: Step-by-Step Build in OIC Gen 3
Now we build it. Open your OIC Gen 3 console. We go through every step exactly as an experienced OIC developer would — with the exact field values, JSON structures, and configuration decisions explained.
📌 Step 1: Create the OIC Integration
Why: We need a REST-triggered synchronous integration that receives feedback, processes it, and returns a response to the caller in the same HTTP connection.
⚙️ Integration Creation Settings
SENTIMENT_FEEDBACK_CLASSIFIER
SENTIMENT_FEEDBACK_CLASSIFIE_01
01.00.0000
App Driven Orchestration
(allows complex routing, switch, assign)
📌 Step 2: Configure the REST Trigger (Inbound Connection)
🔌 REST Trigger Connection — Configuration
LOCAL_REST_TRIGGER (built-in OIC REST trigger)
submitFeedback
/feedback/classify
POST
JSON Sample
JSON Sample
📋 Request JSON Sample — paste this in the trigger wizard:
"customerId": "CUST-00847",
"feedbackText": "Your delivery was 3 days late and the product arrived broken!",
"channel": "MOBILE_APP",
"productId": "PROD-1023",
"timestamp": "2024-09-15T14:32:00Z",
"customerEmail": "john.smith@email.com",
"orderNumber": "ORD-88291"
}
📋 Response JSON Sample — what we return to the caller:
"status": "SUCCESS",
"customerId": "CUST-00847",
"sentimentLabel": "Negative",
"sentimentScore": 0.91,
"priorityLevel": "CRITICAL",
"serviceRequestId": "SR-2024-04472",
"actionTaken": "SERVICE_REQUEST_CREATED_MANAGER_ALERTED",
"processingTimeMs": 847
}
📌 Step 3: Add the OCI Language Connection
🔌 Creating the OCI Language REST Connection in OIC
OCI_LANGUAGE_AI_CONN
https://language.aiservice.ap-mumbai-1.oci.oraclecloud.com
OCI Signature Version 1
(select from dropdown)
ocid1.tenancy.oc1..aaaa...{your_tenancy_ocid}
ocid1.user.oc1..aaaa...{service_user_ocid}
aa:bb:cc:dd:ee:ff:00:11:...
(from OCI IAM API Key details)
Allow group OICServiceGroup to use ai-language-family in tenancy
📌 Step 4: Add the OCI Language Invoke Activity
🔧 REST Invoke — OCI Language Call Configuration
detectSentiment
/20221001/actions/batchDetectLanguageSentiments
POST
JSON Sample
JSON Sample
📋 Request JSON Sample for OCI Language API:
"documents": [
{
"key": "doc1",
"text": "sample feedback text here",
"languageCode": "en"
}
]
}
📋 Response JSON Sample from OCI Language API:
"documents": [
{
"key": "doc1",
"documentSentiment": "Negative",
"documentScores": {
"Positive": 0.02,
"Neutral": 0.07,
"Negative": 0.91
},
"aspects": [
{ "text": "delivery", "sentiment": "Negative", "scores": { "Negative": 0.94 } },
{ "text": "product", "sentiment": "Negative", "scores": { "Negative": 0.88 } }
]
}
]
}
The AI is 91% confident this is Negative. The two main problems it identified are "delivery" and "product". Both aspects score above 0.85 — which means the AI is very sure about both. In our routing logic, a negative score ≥ 0.75 = CRITICAL priority → immediate escalation.
📌 Step 5: Add Assign Activity — Build the OCI Language Request
⚙️ Assign Activity — "buildOCILanguageRequest" — Variable Mappings
Add an Assign Activity BEFORE the OCI Language invoke. This activity sets up the variables that will be mapped into the REST call body. In OIC Gen 3, use the Assign activity to populate a local variable with the constructed JSON structure.
concat("feedback-", $triggerRequest.customerId, "-", $triggerRequest.timestamp)Result example: "feedback-CUST-00847-2024-09-15T14:32:00Z"
normalize-space($triggerRequest.feedbackText)normalize-space trims extra spaces and newlines from the feedback text
if(string-length($triggerRequest.languageCode) > 0, $triggerRequest.languageCode, "en")Default to "en" if languageCode not provided in the request
📌 Step 6: Map the Request to OCI Language (Data Mapper)
🗺️ Data Mapper — Source → Target Mappings
$ociLanguageDocKey
documents[1]/key
The unique identifier for this document
$ociLanguageText
documents[1]/text
The actual customer feedback text to analyse
$ociLanguageCode
documents[1]/languageCode
"en" for English — change for multilingual support
documents[1]/documentSentiment
$sentimentLabel
"Positive", "Negative", "Neutral", or "Mixed"
documents[1]/documentScores/Negative
$negativeScore
e.g. 0.91 — used for priority routing
documents[1]/documentScores/Positive
$positiveScore
e.g. 0.02
📌 Step 7: Add the Priority Classification (Assign Activity)
⚙️ Assign Activity — "classifyPriority"
Set variable $priorityLevel using a nested XPath if-else expression:
XPath Expression:
if ($sentimentLabel = 'Negative' and $negativeScore >= 0.85)
then 'CRITICAL'
else if ($sentimentLabel = 'Negative' and $negativeScore >= 0.60)
then 'HIGH'
else if ($sentimentLabel = 'Negative' and $negativeScore >= 0.40)
then 'MEDIUM'
else if ($sentimentLabel = 'Neutral')
then 'MONITOR'
else if ($sentimentLabel = 'Positive')
then 'POSITIVE'
else 'LOW'
📌 Step 8: Add the Switch Activity — Route by Priority
🔀 Switch Activity — 4 Routing Branches
$priorityLevel = 'CRITICAL'① Create Oracle CX Service Request (P1 priority)
② Send Teams notification: "⚠️ CRITICAL negative feedback received"
③ Update customer record: churn_risk = HIGH
$priorityLevel = 'HIGH'① Create Oracle CX Service Request (P2 priority)
② Log to feedback database with sentiment enrichment
③ Set follow-up flag: contact within 24 hours
$priorityLevel = 'MONITOR'① Log enriched record to feedback database
② Update customer satisfaction score in CX
③ No SR created, no alert
$priorityLevel = 'POSITIVE'① Log enriched record with positive flag
② Trigger loyalty campaign API: send discount offer
③ Add to testimonial candidate pool
📌 Step 9: Configure Oracle CX Service Request Creation (CRITICAL & HIGH Branch)
🎫 Oracle CX Service REST Invoke — Create Service Request
ORACLE_CX_SERVICE_CONN
createServiceRequest
/crmRestApi/resources/latest/serviceRequests
POST
📋 CX Service Request Payload (mapped from OIC variables):
"Title": "[AI-DETECTED NEGATIVE] Customer Feedback - concat($priorityLevel, ' Priority')",
"SeverityCd": if($priorityLevel='CRITICAL', '1-CRITICAL', '2-HIGH'),
"StatusCd": "1-Open",
"ProblemDescription": concat("AI Sentiment Score: ", $negativeScore, ". Customer Feedback: ", $triggerRequest.feedbackText),
"CustomerPartyNumber": $triggerRequest.customerId,
"ProductId": $triggerRequest.productId,
"Channel": $triggerRequest.channel,
"CustomFields": {
"SentimentLabel_c": $sentimentLabel,
"SentimentScore_c": $negativeScore,
"AIClassified_c": "Y",
"OrderNumber_c": $triggerRequest.orderNumber
}
}
response/Id → variable $serviceRequestId.
We use this in the final response back to the caller.
📌 Step 10: Build and Send the Final Response
📤 Response Mapper — Final Response to Caller
"SUCCESS"
response/status
$triggerRequest/customerId
response/customerId
$sentimentLabel
response/sentimentLabel
$negativeScore
response/sentimentScore
$priorityLevel
response/priorityLevel
$serviceRequestId
response/serviceRequestId
$actionTaken
response/actionTaken
🎯 Section 5: Real Feedback Examples — Watch the Integration Think
Let us run five real customer feedback examples through our integration and see exactly what the AI returns and what OIC does with it.
🛡️ Section 6: Error Handling — What Happens When Things Go Wrong
An experienced OIC developer always asks: "What if OCI Language is temporarily unavailable? What if the feedback text is empty? What if the AI returns an unexpected score?" Here is how we handle each scenario in production.
Check: In the Assign Activity before the OCI Language call, add a validation:
if(string-length(normalize-space($triggerRequest.feedbackText)) < 10)
Action: Use a separate path that skips the AI call entirely, sets sentimentLabel = "INSUFFICIENT_DATA", returns an appropriate response. OCI Language returns poor results on very short texts — better to skip.
In OIC Gen 3: Wrap the OCI Language REST Invoke inside a Scope activity with a Fault Handler. In the fault handler: set sentimentLabel = "AI_UNAVAILABLE", set priorityLevel = "MANUAL_REVIEW", create a service request with flag "Requires Manual Sentiment Review", log the error to OIC tracking. The integration continues and the feedback is not lost — it goes to a manual review queue.
Solution: Add a pre-call to OCI Language's batchDetectDominantLanguage endpoint first.
It detects the language automatically. Then pass the detected languageCode into the sentiment call.
OCI Language supports 29 languages natively — this makes your integration truly global-ready.
If all three scores (Positive, Neutral, Negative) are below 0.60 — the AI is not confident.
Add this check in the Priority Classification assign:
if(max($positiveScore, $neutralScore, $negativeScore) < 0.60, 'MANUAL_REVIEW', ...)
Route to manual review. A human should classify ambiguous feedback — not the AI.
📊 Section 7: Tracking, Monitoring & Business Insights
After your integration goes live, you want to see business-level insights — not just OIC technical metrics. Here is how to use OIC's Business Identifiers feature to track sentiment trends over time.
In your integration, set Business Identifiers (Integration → Tracking) to these fields so you can filter and report on them in OIC Monitoring:
- customerId — find all feedback from one customer
- sentimentLabel — filter: show me all NEGATIVE instances today
- priorityLevel — filter: show all CRITICAL cases this week
- channel — which channel produces most negative feedback?
- productId — which products get most negative sentiment?
| 📊 What You Can Now Measure | Business Question It Answers | Source in OIC |
|---|---|---|
| Daily Negative Rate | Is customer satisfaction trending down? | OIC Monitoring → filter sentimentLabel=Negative |
| CRITICAL Feedback Count | How many customers are at immediate churn risk today? | OIC Monitoring → filter priorityLevel=CRITICAL |
| Sentiment by Channel | Which channel — mobile / email / chat — has worst sentiment? | OIC Monitoring + Business Identifier: channel |
| Sentiment by Product | Which product has the most negative feedback this month? | OIC Monitoring + Business Identifier: productId |
| AI Confidence Distribution | What % of feedback requires manual review (low AI confidence)? | Custom ATP table + OIC writes sentimentScore per record |
🚫 Common Mistakes to Avoid
OCI Language works on the text field. If you accidentally send a JSON payload with metadata fields, the AI will also analyse field names and dates, producing garbage sentiment results. Always extract just the human-written feedback text before calling OCI Language.
Routing only on the label ("Negative" → create SR) means a 0.51 confidence "Negative" gets the same treatment as a 0.97 confidence "Negative". Always use both the label AND the score together in your routing logic. The score is where the real intelligence is.
If OCI Language is unavailable and you have no fault handler, the entire OIC integration fails and the customer's feedback is lost permanently. Always wrap the OCI Language invoke in a Scope with a Fault Handler that routes unclassified feedback to a manual review queue.
If you hardcode ap-mumbai-1 in your OCI Language connection and then deploy to a different region, your integration breaks. Use an OIC lookup table or property for the region so it can be changed without touching the integration design.
✅ Best Practices
OCI Language batchDetectLanguageSentiments accepts up to 100 documents in a single API call. If you have a bulk upload scenario (nightly CSV of 500 feedback records), group them in batches of 100 and call OCI Language once per batch. This is 5 API calls instead of 500 — 99% fewer calls, dramatically lower cost, and faster processing.
The overall documentSentiment tells you the general feeling. The aspects tell you exactly what to fix. A feedback with delivery=Negative and product=Positive should create a SR for the logistics team — not the product team. Map aspects to the right team in your routing logic for surgical precision in your response.
Save the complete OCI Language response JSON (all scores, all aspects, all phrase extractions) in your ATP database alongside the original feedback text. This data becomes your training set when you want to fine-tune a custom model later using OCI Data Science. Every feedback processed today is future model improvement data.
Store the RSA private key for your OCI service user in OCI Vault. Reference it from the OIC connection using the Vault Secret OCID — not by uploading the key file directly. This way, if the key needs to be rotated, you update it in Vault once. The OIC connection automatically picks up the new key without any redeployment.
🎉 Final Summary — What You Built
Before: A customer submits angry feedback. It sits in a shared inbox. Three days later someone reads it and creates a ticket. By then the customer has left and told 50 friends.
After: The customer submits feedback at 2:17 PM. By 2:17:01 PM the AI has classified it as CRITICAL. By 2:17:03 PM a P1 service request exists in Oracle CX. By 2:17:04 PM the service manager gets a Teams alert. By 2:30 PM the customer gets a call from a human who already knows the full context.
That is the difference between a company that reacts and a company that responds. OIC + OCI Language AI makes that possible today — with the integration skills you already have.
Build Smart. Integrate Intelligently.
Comments
Post a Comment