Sentiment Analysis — Setup & Usage Guide
Score every customer interaction automatically, get real-time alerts on negative sentiment, and see which agents and customers need attention. This guide walks tenant admins through activating, configuring, and getting daily value from the module.
Overview
The Sentiment Analysis module is an AI-powered sentiment scoring system built into Rubi Professional CRM. Once activated, every customer interaction logged by an agent — call notes, chat transcripts, email summaries, omnichannel messages — is automatically scored by Anthropic's Claude for sentiment, dominant emotion, and confidence.
The module turns noisy interaction logs into three high-value signals: a customer-level risk indicator, an agent performance view, and real-time alerts when things are going sideways.
Real-time scoring
Every interaction with 20+ characters of notes gets scored within seconds of being saved.
Configurable alerts
Supervisors get pinged when any customer's sentiment drops below your configured threshold.
At-risk customer detection
Spot customers whose average sentiment is trending negative before they churn.
Coaching insights
Identify agents who consistently create more negative interactions so you know where to coach.
How it works
The module consists of three moving parts:
-
A scorer (
SentimentAnalyzerclass) that sends each interaction's text to Claude, parses the response as structured JSON, and stores the result ininteraction_sentimentwith the score, label, dominant emotion, confidence, and keywords that drove the verdict. -
A hook inside
/crm/api/log-interaction.phpthat calls the scorer after a successful interaction save. The hook is wrapped in try/catch — if the Claude API is down, your interaction logging still works normally. -
A set of views (
v_customer_sentiment_rollup,v_agent_sentiment_rollup) that pre-aggregate scores for fast dashboard rendering, plus a daily rollup table that powers the 30-day trend chart.
Each scored row carries:
- Score — integer from −100 (angriest) to +100 (happiest)
- Label —
positive,neutral,negative, ormixed - Confidence — how sure the model is, 0-100%
- Dominant emotion — a single word (frustration, relief, gratitude, etc.)
- Summary — one or two analyst-voiced sentences describing what happened
- Keywords — the specific phrases that drove the score
Quick start ≈ 5 minutes
-
1
Activate the module
Go to RubiMine, find the Sentiment Analysis tile, click Activate. Billing starts immediately at $99.99/mo.
-
2
Confirm Claude API is configured
Go to Tenant Admin → AI Settings and make sure you have a Claude API key. Without it, scoring silently skips.
-
3
Open settings and tune your alerts
Visit
/tenant-admin/modules/sentiment-settings.php. Set your alert threshold (default −50) and pick who receives alerts. -
4
(Optional) Backfill historical data
Run the backfill utility to score recent interactions so the dashboard has data on day one.
-
5
Watch the dashboard
Open Tenant Admin → Sentiment Analysis. Stats, trend chart, at-risk customers, top and bottom agents — all real data.
Configuration settings
All settings live at /tenant-admin/modules/sentiment-settings.php and persist to the tenant_modules.settings.sentiment_analysis JSON key. Changes take effect on the next interaction scored.
General
- Enable sentiment scoring — master switch. When off, no new interactions are scored even if the module itself is active.
- Channels to score — opt individual channels in/out. Available: web, chat, email, voice, sms, phone. Default: all.
- Claude model — optional override. Leave on "Tenant default" unless you know you need a specific model for quality or cost tradeoffs.
Negative-sentiment alerts
- Alert threshold — integer between −100 and +100. An alert fires when score ≤ this number. Default
−50. - Cooldown (minutes) — don't re-alert for the same customer within this window. Default
30. - Who gets the alert — choose Tenant admins & supervisors, Supervisors / managers only, or Specific users. The specific-users picker shows when the third option is selected.
Text & Budget
- Minimum note length — skip scoring on notes shorter than this (default 20 chars). Prevents wasting tokens on "Called customer." stubs.
- Maximum note length — truncate notes longer than this before sending to Claude (default 8000 chars). Keeps token costs bounded per call.
- Daily token cap — hard limit per day.
0= unlimited. Default 100,000 tokens (~$0.30/day at Sonnet pricing).
Advanced
- Emit Workflow Engine events — fires
sentiment.scored+sentiment.negativeon every applicable score. See Workflow & webhook events. - Dispatch outbound webhooks — subscribed webhook endpoints receive the same events. Configure endpoints under Tenant Admin → Webhooks.
Understanding the dashboard
The tenant-admin dashboard at /tenant-admin/modules/sentiment-analysis-dashboard.php surfaces the most actionable signals:
Headline stats
Four at-a-glance cards: Total scored, Average sentiment, Positive count, Negative count. Today's numbers are called out underneath.
Sentiment trend (last 30 days)
Line chart of daily average score. Quick way to spot weeks where morale or product experience shifted. Hover a point to see how many interactions were scored that day.
Label mix
Donut showing what percentage of your scored interactions are positive, neutral, negative, or mixed — across all time.
At-risk customers
Customers whose average sentiment is ≤ 0 across 2 or more scored interactions. Lowest first. This is where to spend outreach and retention energy.
Top agents & coaching opportunities
Two side-by-side panels. Top agents ranks your highest-average-sentiment agents (min 3 scored interactions) — good candidates for mentoring roles. Coaching opportunities flips the list: your lowest-average agents, where short 1:1 coaching sessions will have the biggest impact.
Today's activity
Live counter of interactions scored today, alongside a progress bar showing how much of your daily token budget has been used. The bar turns yellow at 65% and red at 85%.
Alerts & notifications
When a score drops to or below your alert threshold, the module dispatches an in-app notification and queues an email (respecting each recipient's per-category notification preferences). The alert links directly to the customer's profile so the supervisor can click through and intervene.
Cooldown: to prevent alert fatigue, the module won't fire another alert for the same customer within your configured window (default 30 minutes). Even if the customer has three negative interactions in that window, only one alert goes out.
Who hears the alert: by default, all active users in your tenant with the admin, tenant_admin, supervisor, or manager role receive it. You can narrow this to supervisors only, or pick a specific list of users if you have dedicated retention staff.
Manual overrides
The AI is good but not perfect. Sarcasm, cultural context, and industry jargon can all produce misleading scores. Any user with access to the customer profile can override an AI score using 👍 / 👎 controls on the interaction timeline.
Overrides are stored in the same interaction_sentiment row alongside the AI's original score, in the human_override_* columns.
The rollup views use COALESCE(human_override_*, *), meaning corrections take precedence over the AI verdict in every aggregate.
Every override is written to audit_log with action sentiment_override, capturing who reviewed, when, and what changed. No data is ever lost.
Backfilling historical data
Fresh activations see an empty dashboard until new interactions start flowing in. The backfill utility at /admin/backfill-sentiment.php fixes that.
Unscored mode (safe)
Picks the N most recent interactions that don't have a sentiment row yet. Idempotent — running it twice won't re-spend tokens on anything already scored. Start here.
Refresh mode (use carefully)
Re-scores the N most recently created interactions with force-refresh. Every call costs tokens. Use this after a prompt or model change, or when you want to verify the scorer is behaving consistently on known data.
Controls
- Batch size — 1 to 100 interactions per run.
- Sleep between calls — rate-limit pause in ms. Default 200 ms. Use higher values if you're hitting API rate limits.
- Confirm checkbox — required. Acknowledges that you're spending tokens.
Workflow & webhook events
The module emits two event types on every scored interaction:
| Event | Fires when | Payload keys |
|---|---|---|
sentiment.scored |
Every time an interaction is scored | tenant_id, interaction_id, customer_id, agent_id, channel, score, label, confidence, dominant_emotion, summary, scored_at |
sentiment.negative |
Score ≤ alert threshold | Same as above |
Both events can drive Workflow Engine rules ("when sentiment.negative fires, assign the customer to the retention queue") and can be dispatched to outbound webhook endpoints (Slack, Zendesk, PagerDuty, or any custom webhook).
Cost & budget controls
Sentiment Analysis has two cost components: the $99.99/mo module subscription and the Claude API tokens consumed on each scoring call. A typical interaction costs roughly 500-700 tokens end-to-end (prompt + response), which at Claude Sonnet pricing is a fraction of a cent per score.
Three controls keep your spend bounded:
- Daily token cap — hard-stops scoring for the day when exceeded. Default 100,000 tokens ≈ $0.30 at Sonnet pricing.
- Minimum note length — skips trivial notes so you don't spend tokens on "Called." entries.
- Maximum note length — truncates very long notes before sending so a single call can't run away.
Today's token usage is visible on the dashboard as a progress bar. Tenant Admin → AI Usage has month-over-month totals across all AI features (AI Coach, Customer Intelligence, Sentiment Analysis, RubiLens).
Developer API reference
Two internal HTTP endpoints expose sentiment data to the CRM UI. Both require a logged-in session.
GET /crm/api/sentiment.php?action=customer_rollup&customer_id=123
Returns aggregate sentiment stats for a single customer plus the last-scored label/score. Used by the customer profile sidebar.
{
"ok": true,
"rollup": {
"total_scored": 7,
"avg_score": 42.1,
"count_positive": 5,
"count_negative": 1,
"count_neutral": 1,
"count_mixed": 0,
"first_scored_at": "2026-03-02 10:14:00",
"last_scored_at": "2026-04-22 18:33:11"
},
"last": { "score": 85, "label": "positive", "created_at": "2026-04-22 18:33:11" }
}
GET /crm/api/sentiment.php?action=escalation_queue&hours=24
Returns recent negative-labeled interactions needing attention, lowest score first. Used by the escalation queue.
POST /crm/api/sentiment.php?action=set_override
Writes a human override on an AI score. CSRF-protected. Body: { sentiment_id, score?, label? }.
Tenant-admin settings API
/tenant-admin/api/sentiment-settings.php exposes get, save, and reset actions. All writes are CSRF-protected and whitelist the accepted keys.
Troubleshooting
My dashboard is empty but I logged interactions today
Verify three things, in order:
- Module is active — visible on the top-right stat of the settings page.
- Your tenant has a Claude API key configured under AI settings.
- The interactions you logged have notes at least as long as your minimum note length setting (default 20 characters).
If all three are true and the dashboard is still empty, check that your enabled channels include the channel those interactions used.
No alerts are firing even though I see negative scores
Three common causes:
- The score wasn't negative enough. Default threshold is −50. A score of −30 is negative but won't trigger alerts.
- Recipient-mode is set to Specific users but no users are selected in the picker.
- Alert cooldown is still active for that customer — another alert was sent to the same customer within the cooldown window.
Daily token cap is stopping scoring early
The cap is a hard stop — once hit, the scorer returns null for the rest of the day. Raise the cap in Settings → Text & Budget → Daily token cap, or set to 0 for unlimited (your tenant-wide monthly AI budget still applies).
A score feels clearly wrong
Use the 👍 / 👎 override buttons on the interaction timeline. Your correction rewrites the label and score, is reflected in the dashboard rollups, and is logged to audit_log with your user ID attached.
Frequently asked questions
What data does Claude see?
Only the interaction text — notes, chat content, or email body — plus light context (channel name, direction, timestamp). Customer names, email addresses, and other PII are not sent unless they appear in the interaction text itself. Anthropic's data-use policy applies; they do not train models on API traffic.
Does the module work with the macOS app?
Yes. Interactions logged through the macOS app hit the same /api/v2/interactions endpoint. Scoring will be added to that code path in a later release; for now scoring runs on web-CRM interactions. The macOS app experience is not affected by this module.
Can I export sentiment data?
Not yet via the tenant-admin UI. Developers with database access can query interaction_sentiment directly. A CSV export is on the roadmap.
What if I deactivate the module?
New interactions stop being scored. Historical sentiment rows stay in the database — they won't be deleted. Dashboard and rollup views continue to show them. Reactivating the module resumes scoring on new interactions only.
Does it score interactions in languages other than English?
Yes — Claude handles dozens of languages natively. Spot-check a few scores in your target language after activation to make sure the output matches your expectations.
Can I trigger a re-score manually?
Yes. The backfill utility's refresh mode re-scores the N most recent interactions with force-refresh enabled. Individual re-scores are coming to the customer profile in a future release.
Are overrides reversible?
Yes. An override is just a value stored alongside the AI score. The original AI score is never deleted. Clearing the override reverts the rollups to the AI's verdict.
Ready to start scoring?
Activate Sentiment Analysis from RubiMine and you'll have real data in the dashboard inside an hour.
Open RubiMine Read the deep-dive blog post