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

# IncidentioAlertChannel Construct

> Learn how to configure Incident.io alert channels with the Checkly CLI.

<Tip>
  For general information about alerting, see our docs on [the Incident.io integration](/integrations/incident-management/incidentio) and [alerting with Checkly](/communicate/alerts/overview/).
</Tip>

Triggers and resolves alerts in Incident.io.

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

  const incidentioChannel = new IncidentioAlertChannel('incidentio-channel-1', {
    name: 'ACME alerts',
    url: 'https://api.incident.io/v2/alert_events/checkly/xxxxx',
    apiKey: 'xxxxx45afe73'
  })
  ```

  ```ts Advanced Example theme={null}
  import { IncidentioAlertChannel } from 'checkly/constructs'

  const incidentioChannel = new IncidentioAlertChannel('incidentio-channel-1', {
    name: 'ACME alerts',
    url: 'https://api.incident.io/v2/alert_events/checkly/xxxxx',
    apiKey: 'xxxxx45afe73',
    sendRecovery: true,
    sendFailure: true,
    sendDegraded: true,
    sslExpiry: true,
    sslExpiryThreshold: 30,
  })
  ```
</CodeGroup>

<Note>
  If you need to reference existing alert channels that were created outside of your CLI project, use [`fromId()`](/constructs/alert-channel#using-fromid-to-reference-an-existing-channel).
</Note>

## Configuration

### Incident.io Alert Channel Options

<ResponseField name="name" type="string" required>
  Friendly name to recognise the integration.
</ResponseField>

<ResponseField name="url" type="string" required>
  The target URL created by installing the Checkly integration in Incident.io.
</ResponseField>

<ResponseField name="apiKey" type="string" required>
  The API key created by installing the Checkly integration in Incident.io.
</ResponseField>

<ResponseField name="payload" type="string">
  The payload sent to the target URL when an alert is triggered. If this is not specified, we'll send a default payload with a basic title, description, etc.

  We have [handlebar helpers and variables](/integrations/alerts/webhooks/#using-variables) available for building custom payloads.

  Here's an example payload, using the default one that we provide:

  ```ts highlight={5-26} theme={null}
  new IncidentioAlertChannel('incidentio-channel-1', {
    name: 'ACME alerts',
    url: 'https://api.incident.io/v2/alert_events/checkly/xxxxx',
    apiKey: 'xxxxx45afe73',
    payload: `
      {
        "title": "{{ALERT_TITLE}}",
        "description": "{{ALERT_TITLE}} at {{STARTED_AT}} in {{RUN_LOCATION}} {{RESPONSE_TIME}}ms\\n\\n{{#if AI_ANALYSIS_CLASSIFICATION}}# AI Analysis\\n\\n{{AI_ANALYSIS_CLASSIFICATION}}\\n\\n{{{AI_ANALYSIS_ROOT_CAUSE}}}\\nRead full analysis: {{AI_ANALYSIS_LINK}}{{/if}}",
        "deduplication_key": "{{CHECK_ID}}",
        "metadata": {
          {{#if AI_ANALYSIS_CLASSIFICATION}}
          "ai_analysis_classification": "{{AI_ANALYSIS_CLASSIFICATION}}",
          "ai_analysis_root_cause": "{{{AI_ANALYSIS_ROOT_CAUSE}}}",
          "ai_analysis_link": "{{AI_ANALYSIS_LINK}}",
          {{/if}}
          "alertType": "{{ALERT_TYPE}}",
          "check_result_id": "{{CHECK_RESULT_ID}}",
          "resultLink": "{{RESULT_LINK}}"
        },
        {{#contains ALERT_TYPE "RECOVERY"}}
        "status": "resolved"
        {{else}}
        "status": "firing"
        {{/contains}}
      }
      `
  })
  ```
</ResponseField>

### General Alert Channel Options

These options are valid for all alert channels types.

<ResponseField name="sendRecovery" type="boolean">
  Whether to send notifications when checks recover from a [failed or degraded state](/communicate/alerts/overview/#alert-channels). Default value is `true`.
</ResponseField>

<ResponseField name="sendFailure" type="boolean">
  Whether to send notifications when checks [fail](/communicate/alerts/overview/#alert-channels). Default value is `true`.
</ResponseField>

<ResponseField name="sendDegraded" type="boolean">
  Whether to send notifications when checks [become degraded](/communicate/alerts/overview/#alert-channels). Default value is `false`.
</ResponseField>

<ResponseField name="sslExpiry" type="boolean">
  Whether to send notifications when a SSL/TLS certificate is about to expire. Default value is `false`.

  ```ts highlight={3} theme={null}
  new EmailAlertChannel("email-channel-1", {
    address: "alerts@acme.com",
    sslExpiry: true,
    sslExpiryThreshold: 30, // Alert 30 days before expiry
  })
  ```

  [Learn more about SSL alerts.](/communicate/alerts/ssl-expiration/)
</ResponseField>

<ResponseField name="sslExpiryThreshold" type="number">
  Number of days before the SSL/TLS certificate expiry date to send notifications. Only relevant when `sslExpiry` is enabled. Default value is `30`.

  ```ts highlight={4} theme={null}
  new EmailAlertChannel("email-channel-1", {
    address: "alerts@acme.com",
    sslExpiry: true,
    sslExpiryThreshold: 30, // Alert 30 days before expiry
  })
  ```

  [Learn more about SSL alerts.](/communicate/alerts/ssl-expiration/)
</ResponseField>
