VM detection - Intermittent issue
# support
n
We are having issue with the vapi voice mail detection as it works great some days and somedays it wont at all. Is there anyway to monitor this?
c
Hi Niraj, A good way to monitor voicemail detection performance is by using structured outputs or the summary field in your
analysisPlan
. This allows you to define a rubric for evaluating how accurately the voicemail detection worked — for example, tracking whether calls were correctly classified as voicemail or live pickup. By consistently reviewing these structured results, you can identify trends or inconsistencies and better assess when detection may be failing intermittently. Please let me know if you’d like a short example of how to configure that.
n
Sure that would be super helpful.
c
1) Create a reusable structured output Use this once and apply it to any assistant:
Copy code
curl -X POST "https://api.vapi.ai/structured-output" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Voicemail Detection Monitor",
  "type": "ai",
  "schema": {
    "type": "object",
    "properties": {
      "wasVoicemail": {"type": "boolean"},
      "detectedAsVoicemail": {"type": "boolean"},
      "detectionAccuracy": {
        "type": "string",
        "enum": ["Correct", "False Positive", "False Negative", "Unknown"]
      }
    },
    "required": ["wasVoicemail","detectedAsVoicemail","detectionAccuracy"]
  }
}'
You’ll get an ID like:
"id": "so_abc123def456"
--- 2) Attach it to your assistant
Copy code
curl -X PATCH "https://api.vapi.ai/assistant/YOUR_ASSISTANT_ID" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "structuredOutputIds": ["so_abc123def456"]
}'
--- 3) Run it on existing calls (retro-analysis)
Copy code
curl -X POST "https://api.vapi.ai/structured-output/run" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "structuredOutputId": "so_abc123def456",
  "callIds": ["call_123", "call_456"]
}'
--- 4) Retrieve voicemail metrics
Copy code
curl -X GET "https://api.vapi.ai/call/YOUR_CALL_ID" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  | jq '.artifact.structuredOutputs["so_abc123def456"]'
Example result:
Copy code
{
  "wasVoicemail": true,
  "detectedAsVoicemail": true,
  "detectionAccuracy": "Correct"
}
---
3 Views