AI Support Guide

Simpli Sentiment

Customer health and sentiment tracker with escalation risk detection.

Frustrated customers don't always say "I want to cancel" — but their language signals it. Sentiment runs in the background, tracking customer emotions across every interaction and flagging escalation risk before it's too late.

Simpli Sentiment analyses customer messages to track emotional trajectory, detect escalation risk, and alert teams before situations deteriorate. It uses keyword-based analysis by default (no LLM required), with an optional ML module for deeper analysis.

Configuration

VariableDefaultDescription
APP_PORT8000Server port
APP_LOG_LEVELinfoLog level
DATABASE_URLDatabase connection string
REDIS_URLRedis connection URL

For ML-based analysis (optional):

pip install "simpli-sentiment[ml]"

Start the server

simpli-sentiment serve

API endpoints

POST /analyze

Analyse the sentiment of a message.

Request:

{
  "customer_id": "C-001",
  "text": "I've been waiting 3 days and this is completely unacceptable. I want to speak to a manager.",
  "channel": "email"
}

The channel field accepts values from the Channel enum: email, chat, phone, social, or web.

Response:

{
  "score": -0.72,
  "label": "negative",
  "escalation_risk": 0.65,
  "triggers": ["unacceptable", "manager"]
}
  • score: -1.0 (very negative) to 1.0 (very positive)
  • label: positive (score >= 0.3), neutral, or negative (score <= -0.3)
  • escalation_risk: 0.0 to 1.0 — alerts are created when >= 0.5
  • triggers: escalation keywords found (e.g. cancel, lawsuit, manager, refund)

GET /customers/{customer_id}/sentiment

Get a customer's sentiment timeline.

Query parameters:

ParamDefaultDescription
limit50Max results (1-500)
offset0Pagination offset

Response:

{
  "customer_id": "C-001",
  "current_score": -0.72,
  "trend": "declining",
  "timeline": [
    {"timestamp": "2025-01-15T10:00:00Z", "score": 0.3, "label": "positive", "source": "chat"},
    {"timestamp": "2025-01-16T14:00:00Z", "score": -0.5, "label": "negative", "source": "email"},
    {"timestamp": "2025-01-17T09:00:00Z", "score": -0.72, "label": "negative", "source": "email"}
  ]
}

GET /alerts

Get escalation risk alerts.

Query parameters:

ParamDescription
severityFilter by low, medium, or high
customer_idFilter by customer
limitMax results (default: 50)
offsetPagination offset

Response:

[
  {
    "id": "alert-uuid",
    "customer_id": "C-001",
    "severity": "high",
    "reason": "Escalation risk 0.65 — triggers: unacceptable, manager",
    "created_at": "2025-01-17T09:00:00Z"
  }
]

GET /health

Health check.

Next steps

On this page