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

# Types

> Collection of types to import into your codebase

### Calls

Calls will be returned to each active webhook recipient URL as a webhook event.

```typescript theme={null}
export type Call = {
  call_id: string;
  agent_id: string;
  outcome: string;
  outcome_sentiment: "positive" | "negative" | "neutral";
  outcome_justification: string;
  status: CallStatuses;
  appointment_date: string; // the timezone-aware ISO 8601 date string, eg "2030-07-15T14:00:00.000-07:00" (luxon DateTime formatting)
  summary: string;
  started_at: string; // the call start time in UTC ISO 8601 format, eg "2024-04-27T23:52:10.000Z"
  ended_at: string; // call end time in UTC ISO 8601 format
  call_length: string; // call duration in minutes, eg 0.5 
  recording_wav: string;
  transcript: string;
  ehr: "healthie" | "none"; // the EHR workflow this call was run on

  action_item: string; // see action items tab
  action_item_reason: string; // a brief explanation for the action item
  patient_request: string; // see action items tab
  patient_request_details: string; // a brief explanation for the patient request

  // any variables will be at the top level
}
```

### Variables

#### Strings

"string" type variables represent a single string, eg `"patient_first_name": "John"`\
"string\[]" type variables represent a series of strings, eg `"physicians": ["Physician One", "Physician Two", ...]`

#### Numbers

"number" type variables represent a single number, eg `"cost": 5`\
"number\[]" types variables represent a series of numbers, eg `"costs": [1, 2, 3.5, ...]`

#### Dates

"date" type variables represent a single date, eg `"appointment_date": "2030-07-15T14:00:00.000-07:00"` (luxon DateTime formatting)\
"date\[]" type variables represent a series of dates, eg `"available_dates": ["2030-07-15T14:00:00.000-07:00", "2030-07-16T14:00:00.000-07:00"]`

#### Phone Numbers

"phone\_number" type variables represent a single phone number, eg `"phone_number": "+11994816785"` (E.164 formatting)\
"phone\_number\[]" type variables represent a series of phone numbers, eg `"phone_numbers[]": ["+11994816785", "+15673643554"]`

### Special Variables

`patient_phone_number` and `live_transfer_number` will not be injected into the prompt but instead be used for call mechanics, which is why they are their own distinct types.

The following are also applicable:

* `patient_first_name`: reserved type for patient's first name
* `patient_last_name`: reserved type for the patient's last name
* `preferred_contact_method`: reserved type for the patient's preferred contact method
* `preferred_language`: reserved type for the patient's preferred language
* `email`: reserved type for patient's email

### Variable Errors

Type failures will collect all issues and return them as the error message, eg: `Invalid input:  
Received "+17223820171" but declared type is date[], Received "2030-07-15T14:00:00.000-07:00" but declared type is phone_number[]`

### Call Statuses

```typescript theme={null}
enum CallStatuses {
  calling = "calling",
  complete = "complete",
  error = "error",
  voicemail = "voicemail"
}
```

### Webhook Payloads

```typescript theme={null}
type WebhookPayload = {
  type: "call",
  data: Call
}
```

<CardGroup cols={2}>
  <Card title="Getting an API Key" icon="pen-to-square" href="/quickstart">
    Get your docs set up locally for easy development
  </Card>

  <Card title="Access your dashboard" icon="image" href="https://app.penciled.com">
    Preview your changes before you push to make sure they're perfect
  </Card>
</CardGroup>
