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

# AI Phone Call: Webhooks

## Setup

To enable AI Phone Call status updates through webhooks:

1. Navigate to the admin panel
2. Go to the AI Phone Call settings
3. Enter your webhook URL in the "Webhook URL" field
4. Save your changes

## Output

The webhook will send updates about the status of your AI phone calls. Here are the different types of updates you may receive:

### Call Completed Successfully

```json theme={null}
{
  "callId": "call_123456",
  "status": "completed",
  "results": {
    "benefits_verified": {
      "question": "Are the benefits active?",
      "answer": "Yes, the benefits are active until December 31, 2024"
    },
    "copay_amount": {
      "question": "What is the copay amount for this service?",
      "answer": "The copay is $25 for office visits"
    },
    "deductible_met": {
      "question": "Has the deductible been met?",
      "answer": "Yes, the deductible has been met for this year"
    },
    "prior_auth_required": {
      "question": "Is prior authorization required?",
      "answer": "No, prior authorization is not required for this service"
    },
    "service_covered": {
      "question": "Is this service covered under the plan?",
      "answer": "Yes, this service is covered at 80% after the deductible"
    }
  }
}
```

### Call Failed

```json theme={null}
{
  "callId": "call_123456",
  "status": "failed",
  "error": "Call failed | Tag: xxx | ID: xxx",
  "errorDetails": {
    "originalError": "Error message",
    "internalTag": "tag",
    "internalId": "id",
    "timestamp": "2024-03-21T12:34:56.789Z",
    "webhookBody": {
      // Original webhook payload
    }
  }
}
```

### Status Updates

```json theme={null}
{
  "callId": "call_123456",
  "status": "in_progress"
}
```

## Field Descriptions

| Field          | Description                                                                                     |
| -------------- | ----------------------------------------------------------------------------------------------- |
| `callId`       | Unique identifier for the call                                                                  |
| `status`       | Current status of the call (`completed`, `failed`, or `in_progress`)                            |
| `results`      | Object containing question-answer pairs from the call (only present when status is `completed`) |
| `error`        | Error message describing why the call failed (only present when status is `failed`)             |
| `errorDetails` | Additional error information (only present when status is `failed`)                             |
