> ## Documentation Index
> Fetch the complete documentation index at: https://checkly-422f444a-mda-troubleshooting-section.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# PhoneCallAlertChannel Construct

> Learn how to configure phone call alert channels with the Checkly CLI.

<Tip>
  Learn more about Phone Call alerts in [the Phone Call Alerts documentation](/integrations/alerts/phone-calls).
</Tip>

Use Phone Call Alerts to make voice calls when checks fail or recover. Phone call alerts are the most immediate form of notification, ideal for critical systems requiring instant attention.

<CodeGroup>
  ```ts Basic Example theme={null}
  import { PhoneCallAlertChannel } from "checkly/constructs"

  const callChannel = new PhoneCallAlertChannel("call-channel-1", {
    phoneNumber: "+1234567890",
    name: "Tim's phone",
  })
  ```

  ```ts Advanced Example theme={null}
  import { PhoneCallAlertChannel } from "checkly/constructs"

  const emergencyCall = new PhoneCallAlertChannel("emergency-call-channel", {
    phoneNumber: "+1234567890",
    name: "Tim's phone",
    sendRecovery: false, // Only call for failures, not recoveries
    sendFailure: true,
    sendDegraded: false, // Only for complete failures
    sslExpiry: true,
    sslExpiryThreshold: 3, // Call 3 days before SSL expires
  })
  ```
</CodeGroup>

## Configuration

<Tabs>
  <Tab title="Phone Call Alert Channel">
    Configure phone call-specific settings:

    | Parameter     | Type     | Required | Default | Description                                                         |
    | ------------- | -------- | -------- | ------- | ------------------------------------------------------------------- |
    | `phoneNumber` | `string` | ✅        | -       | Phone number in international format (e.g., +1234567890)            |
    | `name`        | `string` | ❌        | -       | Friendly name for the phone call alert channel (e.g. "Tim's phone") |
  </Tab>

  <Tab title="General Alert Channel">
    Configure common alert channel properties:

    | Property             | Type      | Required | Default | Description                                              |
    | -------------------- | --------- | -------- | ------- | -------------------------------------------------------- |
    | `sendRecovery`       | `boolean` | ❌        | `true`  | Send notifications when checks recover                   |
    | `sendFailure`        | `boolean` | ❌        | `true`  | Send notifications when checks fail                      |
    | `sendDegrade`        | `boolean` | ❌        | `false` | Send notifications when checks degrade (API checks only) |
    | `sslExpiry`          | `boolean` | ❌        | `false` | Send notifications for SSL certificate expiry            |
    | `sslExpiryThreshold` | `number`  | ❌        | `30`    | Days before SSL expiry to send notification              |
  </Tab>
</Tabs>

## Phone Call Alert Channel Examples

<Tabs>
  <Tab title="Emergency Response">
    ```ts theme={null}
    import { PhoneCallAlertChannel, ApiCheck } from "checkly/constructs"

    const emergencyCall = new PhoneCallAlertChannel("emergency-response", {
      phoneNumber: "+1555EMERGENCY",
      sendFailure: true,
      sendRecovery: false, // Don't call for recoveries
      sendDegraded: false, // Only complete failures
    })

    new ApiCheck("life-safety-system", {
      name: "Life Safety System",
      alertChannels: [emergencyCall],
      tags: ["life-safety", "critical"],
      request: {
        method: "GET",
        url: "https://life-safety.example.com/health",
      },
    })
    ```
  </Tab>

  <Tab title="Executive Notifications">
    ```ts theme={null}
    import { ApiCheck, PhoneCallAlertChannel } from "checkly/constructs"

    const executiveCall = new PhoneCallAlertChannel("executive-call", {
      phoneNumber: "+1555EXEC", // Executive phone number
      sendFailure: true,
      sendRecovery: true, // Notify of both failures and recoveries
      sendDegraded: false,
    })

    new ApiCheck("revenue-critical-api", {
      name: "Revenue Critical API",
      alertChannels: [executiveCall],
      tags: ["revenue-critical", "executive-level"],
      request: {
        method: "GET",
        url: "https://payments.example.com/health",
      },
    })
    ```
  </Tab>

  <Tab title="Security Incident Response">
    ```ts theme={null}
    import { ApiCheck, PhoneCallAlertChannel } from "checkly/constructs"

    const securityCall = new PhoneCallAlertChannel("security-incident", {
      phoneNumber: "+1555SECURITY",
      sendFailure: true,
      sendRecovery: false,
      sslExpiry: true,
      sslExpiryThreshold: 1, // Call immediately for SSL expiry
    })

    new ApiCheck("security-endpoint", {
      name: "Security Endpoint Monitor",
      alertChannels: [securityCall],
      tags: ["security", "authentication"],
      request: {
        method: "GET",
        url: "https://auth.example.com/security-health",
      },
    })
    ```
  </Tab>
</Tabs>

## Phone Number Format

The phone numbers used for SMS alerting need to be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). Stick to the following rules and you'll be fine:

* Prepend international access codes with a + sign
* Do not use any white spaces
* Use up to 15 characters

<Tabs>
  <Tab title="Correct Format">
    ```ts theme={null}
    // US numbers
    const usCall = new PhoneCallAlertChannel('us-call', {
      phoneNumber: '+15551234567' // +1 (country code) + area code + number
    })

    // UK numbers
    const ukCall = new PhoneCallAlertChannel('uk-call', {
      phoneNumber: '+447911123456' // +44 (country code) + mobile number
    })

    // German numbers
    const deCall = new PhoneCallAlertChannel('de-call', {
      phoneNumber: '+491701234567' // +49 (country code) + mobile number
    })

    // Australian numbers
    const auCall = new PhoneCallAlertChannel('au-call', {
      phoneNumber: '+61412345678' // +61 (country code) + mobile number
    })
    ```
  </Tab>

  <Tab title="Incorrect Format">
    ```ts theme={null}
    // ❌ Don't use these formats:

    // Missing country code
    phoneNumber: '5551234567'

    // With spaces or dashes
    phoneNumber: '+1 555-123-4567'

    // With parentheses
    phoneNumber: '+1 (555) 123-4567'

    // Domestic format
    phoneNumber: '(555) 123-4567'
    ```
  </Tab>
</Tabs>

## Combining with Other Alert Channels

Phone calls should be used as part of a comprehensive alerting strategy:

```ts theme={null}
import {
  PhoneCallAlertChannel,
  SmsAlertChannel,
  EmailAlertChannel,
  SlackAlertChannel,
  ApiCheck,
} from "checkly/constructs"

// Layered alerting approach
const teamSlack = new SlackAlertChannel("team-slack", {
  url: new URL("https://hooks.slack.com/services/YOUR/WEBHOOK/URL"),
  channel: "#alerts",
})

const oncallEmail = new EmailAlertChannel("oncall-email", {
  address: "oncall@example.com",
})

const oncallSms = new SmsAlertChannel("oncall-sms", {
  phoneNumber: "+1555ONCALL",
})

const emergencyCall = new PhoneCallAlertChannel("emergency-call", {
  phoneNumber: "+1555EMERGENCY",
  sendFailure: true,
  sendRecovery: false, // Only call for failures
})

new ApiCheck("comprehensive-alerting", {
  name: "Critical System with Comprehensive Alerting",
  alertChannels: [
    teamSlack, // Immediate team visibility
    oncallEmail, // Documentation and detail
    oncallSms, // Mobile notification
    emergencyCall, // Immediate voice alert
  ],
  tags: ["critical", "comprehensive"],
  request: {
    method: "GET",
    url: "https://critical.example.com/health",
  },
})
```

## Best Practices

<Warning>
  **Use Sparingly**: Phone calls are the most intrusive form of notification. Reserve them for truly critical systems where immediate human intervention is required.
</Warning>

<Info>
  **Recovery Notifications**: Consider whether recovery calls are necessary. For some critical systems, knowing when the system recovers is as important as knowing when it fails.
</Info>
