> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thinnest.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Analytics & Monitoring

> Call scoring, CRM auto-sync, knowledge gap detection, speed-to-lead, and post-call analytics for voice agents.

# Analytics & Monitoring

These features run automatically during or after calls to track performance, sync data, and improve your agent over time.

***

## Call Summary & Transcript

Automatically generate a summary after each call ends. The summary is saved to the session and optionally sent via webhook.

```json theme={null}
{
  "callSummaryEnabled": true,
  "callSummaryPrompt": "Summarize: key topics discussed, action items, customer sentiment, and outcome."
}
```

The LLM processes the full transcript and generates a concise summary.

***

## Call Tagging / Disposition

Automatically tag calls with categories and disposition codes based on the conversation content.

```json theme={null}
{
  "callTaggingEnabled": true,
  "callTaggingCategories": ["sales", "support", "billing", "complaint", "inquiry"],
  "callTaggingModel": "gpt-4o-mini"
}
```

After the call, the LLM analyzes the transcript and assigns relevant tags.

***

## CRM Auto-Sync

Automatically log call data to your CRM after each call — including duration, summary, outcome, and next steps.

```json theme={null}
{
  "crmAutoSyncEnabled": true,
  "crmProvider": "hubspot",
  "crmApiKey": "...",
  "crmSyncFields": ["duration", "summary", "outcome", "next_steps", "sentiment"]
}
```

| Setting              | Type      | Description                                     |
| -------------------- | --------- | ----------------------------------------------- |
| `crmAutoSyncEnabled` | boolean   | Enable automatic CRM logging                    |
| `crmProvider`        | string    | CRM provider: `hubspot`, `salesforce`, `custom` |
| `crmApiKey`          | string    | CRM API key                                     |
| `crmSyncFields`      | string\[] | Fields to sync to the CRM                       |

***

## Speed-to-Lead Timer

Track how quickly the agent responds to the first inbound call. Useful for measuring lead response time.

```json theme={null}
{
  "speedToLeadEnabled": true,
  "speedToLeadWebhookUrl": "https://your-app.com/webhooks/speed-to-lead"
}
```

Records the time between call arrival and first agent response, then sends it via webhook.

***

## Call Scoring & QA

Automatically score each call against quality criteria using an LLM review of the transcript.

```json theme={null}
{
  "callScoringEnabled": true,
  "scoringCriteria": [
    "greeting_quality",
    "issue_resolution",
    "professionalism",
    "call_efficiency"
  ],
  "scoringModel": "gpt-4o-mini"
}
```

Scores are saved to the session metadata for dashboards and reporting.

***

## Knowledge Gap Detection

Track questions the agent couldn't answer. Gaps are extracted from the transcript and sent to a webhook for knowledge base improvement.

```json theme={null}
{
  "knowledgeGapDetectionEnabled": true,
  "knowledgeGapWebhookUrl": "https://your-app.com/webhooks/knowledge-gaps"
}
```

The agent marks uncertain responses with `[KNOWLEDGE_GAP: topic]`. After the call, these markers are extracted and reported.

***

## Webhook Events

Receive real-time event notifications for call lifecycle events.

```json theme={null}
{
  "webhookUrl": "https://your-app.com/webhooks/voice",
  "webhookSecret": "whsec_...",
  "webhookEvents": ["call_started", "call_ended", "message_received", "error_occurred"],
  "webhookRetryCount": 3
}
```

### Event Types

| Event                  | When It Fires                               |
| ---------------------- | ------------------------------------------- |
| `call_started`         | Call connected and agent is ready           |
| `call_ended`           | Call ended (with summary, duration, reason) |
| `message_received`     | Agent received a message from the caller    |
| `agent_speech`         | Agent spoke a message                       |
| `error_occurred`       | An error occurred during the call           |
| `sentiment.alert`      | Sentiment escalation triggered              |
| `caller.authenticated` | Caller identity verified                    |
| `caller.auth_failed`   | Caller authentication failed                |

### Webhook Security

Webhooks are signed with HMAC-SHA256 using your `webhookSecret`:

```
X-Webhook-Signature: sha256=<signature>
X-Event-Type: call_ended
```

Verify the signature by computing `HMAC-SHA256(webhookSecret, requestBody)` and comparing.

***

## Batch Outbound Campaign

Run automated outbound call campaigns with retry logic and voicemail handling.

```json theme={null}
{
  "batchOutboundEnabled": true,
  "batchRetryAttempts": 2,
  "batchRetryDelayMinutes": 30,
  "batchVoicemailAction": "leave_message"
}
```

| Setting                  | Type    | Default         | Description                             |
| ------------------------ | ------- | --------------- | --------------------------------------- |
| `batchOutboundEnabled`   | boolean | `false`         | Enable batch outbound                   |
| `batchRetryAttempts`     | integer | `2`             | Retry attempts for unanswered calls     |
| `batchRetryDelayMinutes` | integer | `30`            | Delay between retries                   |
| `batchVoicemailAction`   | string  | `leave_message` | On voicemail: `leave_message` or `skip` |

***

## Progressive / Predictive Dialer

Automatically dial the next number when an agent becomes available.

```json theme={null}
{
  "predictiveDialerEnabled": true,
  "dialerMode": "progressive",
  "dialerMaxConcurrent": 1,
  "dialerCallbackEnabled": true,
  "dialerCallbackDelayMinutes": 60
}
```

| Mode          | Behavior                                               |
| ------------- | ------------------------------------------------------ |
| `progressive` | Dials one number at a time as agents become available  |
| `predictive`  | Dials multiple numbers anticipating agent availability |

***

## Example — Create Agent with Analytics & Monitoring

```bash theme={null}
curl -X POST https://api.thinnest.ai/v1/agents \
  -H "Authorization: Bearer $THINNESTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Monitored Sales Agent",
    "model": "gpt-4o",
    "instructions": "You are a sales agent. Handle inbound calls professionally and try to convert leads.",
    "voiceEnabled": true,
    "transcriber": { "provider": "deepgram", "model": "nova-2-conversationalai" },
    "voice": { "provider": "deepgram", "voiceId": "aura-2-thalia-en" },
    "callSummaryEnabled": true,
    "callSummaryPrompt": "Summarize: key topics, action items, sentiment, and outcome.",
    "callTaggingEnabled": true,
    "callTaggingCategories": ["sales", "support", "billing", "complaint"],
    "crmAutoSyncEnabled": true,
    "crmProvider": "hubspot",
    "crmSyncFields": ["duration", "summary", "outcome", "sentiment"],
    "speedToLeadEnabled": true,
    "callScoringEnabled": true,
    "scoringCriteria": ["greeting_quality", "issue_resolution", "professionalism", "call_efficiency"],
    "webhookUrl": "https://your-app.com/webhooks/voice",
    "webhookEvents": ["call_started", "call_ended", "sentiment.alert"],
    "webhookRetryCount": 3
  }'
```
