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

# CubeAPM Alert Integration

> Receive CubeAPM alerts through CubeAPM's webhook receiver using a Flashduty Prometheus integration; alerts close automatically when they resolve.

CubeAPM can send alert notifications by HTTP POST to any webhook URL. The default JSON body is compatible with the Prometheus Alertmanager webhook format (`receiver`, `status`, `alerts`, `groupLabels`, `commonLabels`, `commonAnnotations`, `externalURL`, and so on; each alert carries `status`, `labels`, `annotations`, `startsAt`, `endsAt`, `generatorURL`, `fingerprint`, plus CubeAPM's own `cubeImageURL` and `cubeSampleLog`). The Flashduty [Prometheus integration](/en/on-call/integration/alert-integration/alert-sources/prometheus) accepts this format, so no separate CubeAPM integration is needed: create a Prometheus integration in Flashduty and paste its push URL into CubeAPM.

<div className="hide">
  ## In Flashduty On-call

  ***

  Get an integration push URL in either of the two ways below. **Choose the Prometheus integration type** in both, not Chronosphere.

  ### Use a dedicated integration

  1. In the Flashduty console, go to **Channels** and open a channel
  2. Go to **Settings** → **Integrations** → **Dedicated integrations** and click **Add an integration**
  3. Select **Prometheus** and click **Save**
  4. Open the generated integration card and copy the **Push URL**, in the form `https://api.flashcat.cloud/event/push/alert/prometheus?integration_key=<integration key>`

  ### Use a shared integration

  1. In the Flashduty console, go to **Integration Center → Alert Events**
  2. Select **Prometheus** and enter an integration name
  3. Configure the default route and select a channel; you can add more rules under **Routes** after creation
  4. Click **Save** and copy the generated **Push URL**
</div>

## Configure in CubeAPM

***

<Steps>
  <Step title="Create a webhook receiver">
    When creating an alert in CubeAPM, select **Webhook** as the **Receiver Type** and enter the full push URL copied above, including `?integration_key=...`, in **Webhook URL**.

    The CubeAPM documentation states that the webhook JSON body is Alertmanager-compatible by default and can be customized with a Go template in **Payload**. If you customize it, keep the Alertmanager-style `alerts` array and make every alert carry `status`, `labels`, `annotations`, `startsAt`, `endsAt` and `fingerprint`; otherwise Flashduty cannot tell trigger from recovery or match a recovery to its alert.
  </Step>

  <Step title="Verify">
    Let a CubeAPM alert rule fire and confirm Flashduty receives an active alert; after it resolves, confirm the original alert closes in Flashduty.
  </Step>
</Steps>

## Field mapping

***

| CubeAPM field | Flashduty |
| :- | :- |
| `alerts[].fingerprint` | Alert Key; notifications with the same `fingerprint` belong to one alert |
| `alerts[].status` | `firing` creates or updates the alert with the mapped severity; any other value (such as `resolved`) closes it |
| `alerts[].labels.severity` | `critical` → Critical; `warn` or `warning` → Warning; `info` → Info; missing or unrecognized → Warning |
| `alerts[].labels.alertname` | Check (`check`), also used in the title |
| `alerts[].labels.instance` | Label `resource` |
| Other `labels`, `annotations`, `groupLabels`, `commonLabels` | Each key becomes a label; `annotations.description` becomes the alert description |
| `startsAt`, `endsAt` | Labels `starts_at` and `ends_at` |
| CubeAPM extension fields such as `cubeImageURL`, `cubeSampleLog`, `groupKeyHash` | Not used |

One notification can carry several alerts, and Flashduty handles each one separately (up to 100 per request).

## Recovery and deduplication

***

* When CubeAPM sends a notification whose `status` is not `firing` (for example `resolved`), Flashduty closes the alert with the same `fingerprint`. CubeAPM's own PagerDuty and Zenduty examples likewise map any non-`firing` status to a resolve.
* The CubeAPM documentation does not say whether the webhook has a test-send function. After the first setup, verify with a real alert that both trigger and recovery appear in Flashduty.

## Troubleshooting

***

* **Flashduty returns `Invalid parameters`**: the push URL is incomplete, `integration_key` is missing, or the integration type is not Prometheus
* **Alerts do not resolve**: confirm that every alert in a customized Payload has `status` and `fingerprint`, and that the recovery notification carries the same `fingerprint` as the trigger
* **No alerts arrive**: confirm CubeAPM can reach `api.flashcat.cloud` and that the alert rule uses this webhook receiver
