RATIO MACHINA STARTER logo

MERCURY

Conversation Monitoring RPC API

The Conversation Monitoring RPC API provides advanced monitoring operations including on-demand job execution, batch analysis, and real-time monitoring triggers. Use these endpoints for complex monitoring workflows and automated quality assurance.

Base URL & Authentication

Base URL: https://your-api-name.mercury.ratiomachina.com
Authentication: x-mercury-api-key: YOUR_API_KEY

Create Monitor Job

🚀 Primary RPC Endpoint: Trigger on-demand monitoring jobs for specific conversations, conversation batches, or custom criteria. This endpoint enables real-time quality analysis and automated alerting workflows.

POST /persona-monitors/{id}/jobs

Key Features

  • On-Demand Execution: Trigger monitoring analysis immediately
  • Batch Processing: Analyze multiple conversations simultaneously
  • Custom Criteria: Filter conversations by date, channel, or metadata
  • Priority Queuing: Set job priority for urgent analysis
  • Real-time Alerts: Immediate notifications on threshold breaches

Use Cases

  • Quality assurance spot checks
  • Post-campaign conversation analysis
  • Escalation trigger validation
  • A/B testing conversation quality
  • Compliance audit processing

Job Processing Flow

  1. 1. Validate monitor configuration and permissions
  2. 2. Apply target criteria and filter conversations
  3. 3. Queue job based on priority and system load
  4. 4. Execute monitoring analysis on matched conversations
  5. 5. Process results and trigger alerts if needed
  6. 6. Store results and send completion notifications

Single Conversation Analysis

Request Body

{
  "target": {
    "type": "conversation_id",
    "conversationId": "uuid-conv-456"
  },
  "options": {
    "includeHistory": true,
    "historyLimit": 50,
    "priority": "high",
    "analysisDepth": "detailed"
  },
  "notifications": {
    "onCompletion": true,
    "onAlert": true,
    "webhookUrl": "https://your-app.com/webhook/monitor-complete"
  },
  "context": {
    "triggeredBy": "manual_qa_review",
    "reviewerId": "qa_specialist_123",
    "escalationReason": "customer_complaint"
  }
}

Response Example

{
  "monitorJob": {
    "id": "uuid-job-789",
    "personaMonitorId": "uuid-monitor-123",
    "target": {
      "type": "conversation_id",
      "conversationId": "uuid-conv-456"
    },
    "status": "queued",
    "priority": "high",
    "estimatedCompletion": "2024-01-15T10:32:00Z",
    "queuePosition": 2,
    "createdAt": "2024-01-15T10:30:00Z"
  },
  "monitor": {
    "id": "uuid-monitor-123",
    "name": "Customer Support Quality Monitor",
    "monitorType": "sentiment_analysis"
  },
  "execution": {
    "expectedDuration": "30-120 seconds",
    "conversationsToAnalyze": 1,
    "processingResources": "medium"
  }
}

Batch Conversation Analysis

Process multiple conversations simultaneously based on flexible criteria. Ideal for periodic quality reviews, campaign analysis, or compliance audits.

Date Range Batch

{
  "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": 50,
    "priority": "normal",
    "parallelProcessing": true,
    "stopOnFirstAlert": false
  },
  "filters": {
    "minMessageCount": 3,
    "excludeResolved": false,
    "customerTiers": ["premium", "enterprise"]
  }
}

Tag-based Batch

{
  "target": {
    "type": "batch", 
    "criteria": {
      "tags": ["escalated", "billing_inquiry"],
      "status": "active",
      "lastActivity": {
        "within": "24h"
      }
    }
  },
  "options": {
    "batchSize": 25,
    "priority": "high",
    "includeMetrics": true
  },
  "analysis": {
    "compareBaseline": true,
    "baselinePeriod": "7d",
    "generateReport": true
  }
}

Batch Response Example

{
  "monitorJob": {
    "id": "uuid-job-batch-456",
    "type": "batch_analysis",
    "status": "processing",
    "progress": {
      "totalConversations": 127,
      "processed": 43,
      "remaining": 84,
      "alertsTriggered": 3
    },
    "estimatedCompletion": "2024-01-15T10:45:00Z"
  },
  "batch": {
    "criteria": {
      "dateRange": {
        "from": "2024-01-14T00:00:00Z",
        "to": "2024-01-15T00:00:00Z"
      },
      "channel": "email"
    },
    "conversationsMatched": 127,
    "avgProcessingTime": "2.3s"
  },
  "alerts": [
    {
      "conversationId": "uuid-conv-789",
      "alertType": "negative_sentiment_threshold",
      "severity": "medium",
      "triggeredAt": "2024-01-15T10:33:45Z"
    }
  ]
}

Real-time Monitoring Triggers

Set up automated monitoring jobs that trigger based on conversation events, thresholds, or external system signals.

Event-Based Trigger

{
  "target": {
    "type": "trigger_based",
    "trigger": {
      "event": "conversation_updated",
      "conditions": {
        "messageCount": {
          "greaterThan": 10
        },
        "duration": {
          "greaterThan": "30m" 
        },
        "keywords": ["escalate", "supervisor", "manager"]
      }
    }
  },
  "options": {
    "immediateExecution": true,
    "priority": "critical",
    "alertThreshold": "any"
  },
  "automation": {
    "autoEscalate": true,
    "escalationTarget": "senior_support_queue",
    "notifyManager": true
  }
}

Threshold-Based Trigger

{
  "target": {
    "type": "threshold_trigger",
    "criteria": {
      "personaId": "uuid-persona-123",
      "thresholds": {
        "sentimentScore": {
          "lessThan": -0.7
        },
        "consecutiveNegative": {
          "greaterThan": 3
        }
      }
    }
  },
  "options": {
    "continuousMonitoring": true,
    "samplingInterval": "5m",
    "cooldownPeriod": "1h"
  },
  "responses": {
    "alertChannel": "slack",
    "autoAssignAgent": true,
    "priorityEscalation": true
  }
}

Job Scheduling & Automation

Scheduled Monitor Jobs

Create recurring monitoring jobs that execute automatically on defined schedules. Perfect for regular quality audits, compliance checks, and performance monitoring.

Daily Quality Audit

{
  "target": {
    "type": "scheduled_batch",
    "schedule": {
      "frequency": "daily",
      "time": "09:00",
      "timezone": "America/New_York"
    },
    "criteria": {
      "dateRange": "yesterday",
      "allPersonas": true,
      "excludeWeekends": false
    }
  },
  "options": {
    "batchSize": 100,
    "priority": "normal",
    "generateReport": true
  },
  "reporting": {
    "emailRecipients": ["qa@company.com"],
    "includeMetrics": true,
    "dashboardUpdate": true
  }
}

Weekly Compliance Review

{
  "target": {
    "type": "scheduled_batch",
    "schedule": {
      "frequency": "weekly", 
      "day": "monday",
      "time": "08:00",
      "timezone": "UTC"
    },
    "criteria": {
      "dateRange": "last_7_days",
      "channels": ["email", "chat"],
      "complianceFlags": true
    }
  },
  "options": {
    "deepAnalysis": true,
    "includeTranscripts": true
  },
  "compliance": {
    "regulations": ["GDPR", "CCPA"],
    "auditTrail": true,
    "reportGeneration": "detailed"
  }
}

Job Management Operations

Cancel Job

DELETE /persona-monitors/{id}/jobs/{jobId}

Cancel a queued or running monitor job. Jobs that have already completed cannot be cancelled.

Pause Job

POST /persona-monitors/{id}/jobs/{jobId}/pause

Temporarily pause a running batch job. Can be resumed later from the same position.

Resume Job

POST /persona-monitors/{id}/jobs/{jobId}/resume

Resume a paused monitor job. Processing continues from where it was paused.

Custom Analysis Workflows

Advanced Analysis Options

Multi-Monitor Analysis

{
  "target": {
    "type": "multi_monitor",
    "monitors": [
      "uuid-sentiment-monitor-123",
      "uuid-escalation-monitor-456", 
      "uuid-compliance-monitor-789"
    ],
    "criteria": {
      "conversationIds": ["uuid-conv-001", "uuid-conv-002"],
      "aggregateResults": true
    }
  },
  "options": {
    "parallelExecution": true,
    "crossAnalysisCorrelation": true,
    "generateInsights": true
  },
  "output": {
    "combinedReport": true,
    "individualResults": true,
    "correlationMatrix": true
  }
}

Comparative Analysis

{
  "target": {
    "type": "comparative_analysis",
    "compareGroups": [
      {
        "name": "pre_training",
        "criteria": {
          "dateRange": {
            "from": "2024-01-01T00:00:00Z",
            "to": "2024-01-14T23:59:59Z"
          }
        }
      },
      {
        "name": "post_training",  
        "criteria": {
          "dateRange": {
            "from": "2024-01-15T00:00:00Z",
            "to": "2024-01-29T23:59:59Z"
          }
        }
      }
    ]
  },
  "analysis": {
    "metrics": ["sentiment", "resolution_time", "satisfaction"],
    "statisticalSignificance": true,
    "confidenceLevel": 0.95
  }
}

Custom Monitoring Rules

Dynamic Threshold Adjustment

{
  "target": {
    "type": "adaptive_monitoring",
    "baseMonitorId": "uuid-monitor-123",
    "adaptationRules": {
      "adjustThresholds": true,
      "learningWindow": "7d",
      "sensitivityFactor": 0.1
    }
  },
  "conditions": {
    "volumeAdjustment": {
      "highVolume": {
        "threshold": 1000,
        "adjustment": "increase_tolerance"
      },
      "lowVolume": {
        "threshold": 50,
        "adjustment": "increase_sensitivity"
      }
    }
  },
  "learning": {
    "falsePositiveReduction": true,
    "patternRecognition": true,
    "contextualAdaptation": true
  }
}

Context-Aware Monitoring

{
  "target": {
    "type": "contextual_monitoring",
    "contextFactors": {
      "timeOfDay": {
        "businessHours": "lenient",
        "afterHours": "strict"
      },
      "customerTier": {
        "premium": "enhanced_analysis",
        "standard": "basic_analysis" 
      },
      "conversationType": {
        "support": "escalation_focused",
        "sales": "satisfaction_focused"
      }
    }
  },
  "rules": {
    "dynamicSeverity": true,
    "contextualAlerts": true,
    "adaptiveResponse": true
  }
}

Alert Management

Advanced Alert Configuration

Smart Alert Grouping

{
  "alerting": {
    "grouping": {
      "enabled": true,
      "groupBy": ["persona", "alertType"],
      "timeWindow": "15m",
      "maxGroupSize": 10
    },
    "escalation": {
      "levels": [
        {
          "threshold": 3,
          "delay": "5m",
          "recipients": ["team_lead@company.com"]
        },
        {
          "threshold": 10, 
          "delay": "15m",
          "recipients": ["manager@company.com"]
        }
      ]
    },
    "suppression": {
      "duplicateWindow": "1h",
      "maintenanceMode": false
    }
  }
}

Intelligent Alert Routing

{
  "routing": {
    "rules": [
      {
        "condition": {
          "alertType": "escalation_required",
          "severity": "critical"
        },
        "action": {
          "immediate": true,
          "channels": ["slack", "sms", "email"],
          "recipients": ["oncall_engineer"]
        }
      },
      {
        "condition": {
          "customerTier": "premium",
          "alertType": "satisfaction_low"
        },
        "action": {
          "priority": "high",
          "assignTo": "customer_success_team",
          "createTicket": true
        }
      }
    ],
    "fallback": {
      "defaultChannel": "email",
      "recipient": "general_alerts@company.com"
    }
  }
}

RPC Monitoring Best Practices

Job Optimization

  • Use appropriate batch sizes for your use case (25-100 conversations)
  • Set realistic priority levels to avoid queue congestion
  • Implement proper retry logic for failed jobs
  • Monitor job execution times and adjust batch sizes accordingly

Automation Strategy

  • Start with manual jobs before implementing automation
  • Use scheduled jobs for regular quality audits
  • Implement smart alert grouping to prevent alert fatigue
  • Regularly review and tune monitoring thresholds
Transcend the hype with MERCURY by Ratio Machina