The Conversation Monitoring REST API provides endpoints for creating and managing persona monitors, which continuously analyze conversations for quality, compliance, sentiment, and escalation triggers.
Base URL: https://your-api-name.mercury.ratiomachina.com Authentication: x-mercury-api-key: YOUR_API_KEY
🔍 Persona Monitors: Define automated surveillance rules that continuously analyze conversations involving specific personas, detecting patterns, quality issues, or trigger conditions that require attention.
limit - Number of results (default: 50)offset - Skip results for paginationpersonaId - Filter by specific personamonitorType - Filter by monitor typeactive - Filter by active status{
"personaMonitors": [
{
"id": "uuid-monitor-123",
"personaId": "uuid-persona-456",
"name": "Sales Sentiment Monitor",
"monitorType": "sentiment_analysis",
"isActive": true,
"thresholds": {
"negativeSentiment": 0.7,
"alertAfterCount": 3
},
"alertMethods": ["email", "webhook"],
"createdAt": "2024-01-15T10:30:00Z"
}
],
"pagination": {
"total": 25,
"limit": 50,
"offset": 0
}
}{
"personaId": "uuid-persona-456",
"name": "Customer Support Quality Monitor",
"description": "Monitor customer satisfaction and escalation triggers",
"monitorType": "sentiment_analysis",
"configuration": {
"sentimentThresholds": {
"negative": 0.7,
"positive": 0.3
},
"windowSize": 10,
"alertConditions": {
"consecutiveNegative": 3,
"averageNegativeWindow": 0.6
}
},
"alertMethods": [
{
"type": "email",
"recipients": ["manager@company.com"]
},
{
"type": "webhook",
"url": "https://your-app.com/webhook/alert",
"headers": {
"Authorization": "Bearer token"
}
}
],
"schedule": {
"enabled": true,
"frequency": "real_time"
}
}{
"personaMonitor": {
"id": "uuid-monitor-789",
"personaId": "uuid-persona-456",
"name": "Customer Support Quality Monitor",
"description": "Monitor customer satisfaction and escalation triggers",
"monitorType": "sentiment_analysis",
"configuration": {
"sentimentThresholds": {
"negative": 0.7,
"positive": 0.3
},
"windowSize": 10,
"alertConditions": {
"consecutiveNegative": 3,
"averageNegativeWindow": 0.6
}
},
"alertMethods": [
{
"type": "email",
"recipients": ["manager@company.com"]
},
{
"type": "webhook",
"url": "https://your-app.com/webhook/alert"
}
],
"schedule": {
"enabled": true,
"frequency": "real_time"
},
"isActive": true,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
}id - Persona Monitor UUIDincludeJobs - Include recent monitoring jobsincludeStats - Include execution statistics{
"personaMonitor": {
"id": "uuid-monitor-789",
"personaId": "uuid-persona-456",
"name": "Customer Support Quality Monitor",
"monitorType": "sentiment_analysis",
"configuration": { ... },
"alertMethods": [ ... ],
"isActive": true,
"stats": {
"totalJobs": 1247,
"alertsTriggered": 23,
"lastExecution": "2024-01-15T14:30:00Z",
"averageExecutionTime": 1.2
},
"createdAt": "2024-01-15T10:30:00Z"
}
}Updates persona monitor configuration. Only provided fields will be updated (partial updates supported).
{
"name": "Enhanced Support Quality Monitor",
"configuration": {
"sentimentThresholds": {
"negative": 0.6,
"positive": 0.4
},
"alertConditions": {
"consecutiveNegative": 2
}
},
"isActive": true
}{
"personaMonitor": {
"id": "uuid-monitor-789",
"name": "Enhanced Support Quality Monitor",
"configuration": {
"sentimentThresholds": {
"negative": 0.6,
"positive": 0.4
},
"alertConditions": {
"consecutiveNegative": 2,
"averageNegativeWindow": 0.6
}
},
"isActive": true,
"updatedAt": "2024-01-15T11:30:00Z"
}
}⚠️ Warning: Deleting a persona monitor will permanently remove it and all associated job history. Active monitoring for the persona will stop immediately.
id - Persona Monitor UUID{
"message": "Persona monitor deleted successfully",
"deletedMonitor": {
"id": "uuid-monitor-789",
"name": "Customer Support Quality Monitor",
"personaId": "uuid-persona-456"
}
}⚙️ Monitor Jobs: Individual execution instances of persona monitors that analyze specific conversations or batches of conversations, producing alerts and insights based on the monitor's configuration.
limit - Number of results (default: 50)offset - Skip results for paginationstatus - Filter by job statusfrom - Jobs created after dateto - Jobs created before datealertsTriggered - Jobs that triggered alerts{
"monitorJobs": [
{
"id": "uuid-job-123",
"personaMonitorId": "uuid-monitor-789",
"conversationId": "uuid-conv-456",
"status": "completed",
"results": {
"sentiment": {
"overall": "negative",
"confidence": 0.82,
"score": -0.7
},
"alertsTriggered": [
{
"type": "negative_sentiment_threshold",
"severity": "medium",
"message": "Negative sentiment exceeded threshold",
"timestamp": "2024-01-15T10:35:22Z"
}
]
},
"executionTime": 1.4,
"createdAt": "2024-01-15T10:35:00Z",
"completedAt": "2024-01-15T10:35:01Z"
}
],
"pagination": {
"total": 1247,
"limit": 50,
"offset": 0
}
}Manually trigger a monitoring job for specific conversations or conversation batches. This is useful for on-demand analysis or testing monitor configurations.
{
"target": {
"type": "conversation_id",
"conversationId": "uuid-conv-456"
},
"options": {
"includeHistory": true,
"historyLimit": 50,
"priority": "high"
},
"notifications": {
"onCompletion": true,
"onAlert": true
}
}{
"target": {
"type": "batch",
"criteria": {
"personaId": "uuid-persona-456",
"dateRange": {
"from": "2024-01-14T00:00:00Z",
"to": "2024-01-15T00:00:00Z"
},
"channel": "email"
}
},
"options": {
"batchSize": 100,
"priority": "normal"
}
}{
"monitorJob": {
"id": "uuid-job-987",
"personaMonitorId": "uuid-monitor-789",
"target": {
"type": "conversation_id",
"conversationId": "uuid-conv-456"
},
"status": "queued",
"options": {
"includeHistory": true,
"historyLimit": 50,
"priority": "high"
},
"estimatedCompletion": "2024-01-15T10:36:00Z",
"createdAt": "2024-01-15T10:35:30Z"
}
}queued - Job is waiting to be processedrunning - Job is currently executingcompleted - Job completed successfullyfailed - Job failed with errorscancelled - Job was cancelled{
"monitorType": "sentiment_analysis",
"configuration": {
"thresholds": {
"negative": 0.7,
"positive": 0.8,
"neutral_range": [0.3, 0.7]
},
"alertConditions": {
"consecutiveNegative": 3,
"slidingWindowAverage": {
"windowSize": 10,
"threshold": 0.6
}
},
"analysisOptions": {
"includeIntensity": true,
"detectSarcasm": true,
"contextWindow": 5
}
}
}{
"type": "negative_sentiment_trend",
"severity": "high",
"message": "3 consecutive negative responses detected",
"details": {
"averageSentiment": -0.8,
"conversationId": "uuid-conv-123",
"messageCount": 3
}
}{
"monitorType": "string_analysis",
"configuration": {
"keywords": [
{
"phrase": "cancel subscription",
"caseSensitive": false,
"wholeWord": false,
"severity": "high"
},
{
"phrase": "speak to manager",
"caseSensitive": false,
"wholeWord": true,
"severity": "medium"
}
],
"patterns": [
{
"regex": "\\b(refund|money back)\\b",
"description": "Refund requests",
"severity": "medium"
}
],
"alertConditions": {
"immediateAlert": ["cancel subscription"],
"threshold": {
"count": 2,
"timeWindow": "1h"
}
}
}
}{
"type": "keyword_detected",
"severity": "high",
"message": "Cancellation intent detected",
"details": {
"keyword": "cancel subscription",
"messageContent": "I want to cancel my subscription",
"conversationId": "uuid-conv-123",
"position": 15
}
}{
"monitorType": "support_escalation",
"configuration": {
"escalationTriggers": {
"conversationLength": {
"messageCount": 15,
"timeSpan": "30m"
},
"repeatConcerns": {
"threshold": 3,
"similarity": 0.8
},
"complexityKeywords": [
"technical issue",
"not working",
"bug",
"error"
]
},
"skillGapDetection": {
"enabled": true,
"confidenceThreshold": 0.5
},
"priorityRules": [
{
"condition": "premium_customer",
"priority": "high"
}
]
}
}{
"type": "escalation_required",
"severity": "high",
"message": "Conversation requires human intervention",
"details": {
"reason": "complex_technical_issue",
"conversationLength": 18,
"customerTier": "premium",
"suggestedAction": "route_to_senior_support"
}
}