/api/sentiment_realtime

Header
POST https://api.Fluxrails.app/api/v1/ai/sentiment_realtime
X-Customer-Api-Id: <uuid>
X-Secret: <secret>
Content-Type: application/json
Request Body Schema
// Request Body Schema (choose one format)
// A. Plain-text payload:
{ "text": "string" }

// B. Rich record payload:
{
  "id":         "string",          // optional unique message ID
  "timestamp":  "ISO-8601 string",// optional date-time
  "text":       "string",          // message content
  "metadata": {                    // optional context
    "customer_id": "string",
    "channel":     "string",
    "ticket_id":   "string"
  }
}
Example Request Body
// Example Request Body (Rich record)
{
  "id":        "msg-1042",
  "timestamp": "2025-05-21T14:07Z",
  "text":      "App freezes after every photo upload. I'm furious!",
  "metadata": {
    "customer_id": "C-987",
    "channel":     "chat",
    "ticket_id":   "TCK-2025-1042"
  }
}
Example Response Body
// Example Response Body
{
  "analysis": {
    "id":           "msg-1042",
    "sentiment":    "negative",       
    "emotion":      "anger",          
    "score":        -0.80,            
    "key_topics":  [ "app freeze", "photo upload", "frustration" ],
    "interpretation":"Score -0.80 → NEGATIVE (−1…+1 scale)."
  },
  "interpretation": "Suggested priority: HIGH."
}
Description

• Real-time triage of single messages (chat lines, tweets, reviews). • Returns sentiment polarity, dominant emotion, extracted topics. • Provides a one-liner “priority” hint (e.g. HIGH urgency for anger/frustration).

Business Usage

• Power live support dashboards – flag urgent tickets before escalation. • Automate alerts on spikes of negative/emotion-heavy messages. • Route high-priority items to senior agents for rapid resolution. • Preserve metadata (channel, customer_id) for downstream analytics. • Combine with /api/sentiment_report for macro- vs micro-level monitoring.

← Back to all routes