> ## 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.

# Ghost Inspector alert integration

> Send Ghost Inspector test failures and recoveries to Flashduty On-call through a webhook.

Use a Ghost Inspector webhook to send test run results to Flashduty On-call. Each test maps to one Flashduty alert: it triggers when the test fails, and recovers the next time that same test runs and passes.

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

  ***

  You can obtain an integration push URL in either of the following ways.

  ### Use a dedicated integration

  1. In the Flashduty console, select **Channel** and open a channel
  2. Select **Configuration** → **Integrations** → **Private integration**, then click **Add an integration**
  3. Select **Ghost Inspector**, then click **Save**
  4. Open the generated integration card and copy the **Push URL**

  ### Use a shared integration

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

## Configure Ghost Inspector

***

Ghost Inspector's notification settings have three levels — organization, suite, and test — and each level inherits from the one above by default, though you can override it at any level. Pick whichever level matches how broadly you want the webhook applied; setting it at the organization or suite level covers every test underneath at once.

<Steps>
  <Step title="Add a webhook">
    1. Open the test, its suite, or the organization settings page, whichever level you want to configure
    2. Click **Settings**, then select **Notifications** in the left sidebar
    3. Under **Webhooks**, set **Enabled** to **Yes** (the default, **Use suite setting**, sends nothing unless the suite or organization has webhooks on), then click **Add webhook**
    4. Paste the full Flashduty push URL (it must include `integration_key`) and keep the delivery option at **Always send**. Flashduty needs both failing and passing results; the other options, **Passing result only** and **Failing result only**, would stop the alert from opening or recovering
    5. Click **Save changes**
  </Step>

  <Step title="Verify the lifecycle">
    1. Run a test that will fail (for example, temporarily break one assertion step) and confirm Flashduty receives a Critical alert
    2. Fix the step and rerun the test until it passes, then confirm the original alert recovers

    Ghost Inspector has no separate "send test notification" button: every test run, whether it passes or fails, sends one result. Flashduty only opens a new alert when a run fails, and only closes the matching alert when a run passes — a passing run with no matching open alert leaves nothing behind.
  </Step>
</Steps>

## Alert key

***

Flashduty keys the alert on the test's `test._id`, the `data.test._id` field in the webhook body. Ghost Inspector sends the same `test._id` on every run of that test — unlike `data._id`, the id of that individual run's result, which is different every time — so a failing run and the later passing run of the same test reliably map to one alert. Changes to the test name, browser, region, or start/end URL do not change the alert key.

## Status and severity

***

Ghost Inspector has no severity levels, only a pass/fail result:

| Ghost Inspector `passing` | Flashduty status or severity |
| :- | :- |
| `false` | Critical |
| `true` | Recovers |

A request missing the `passing` field is rejected, so Flashduty never treats an indeterminate result as a failure.

## Labels

***

| Label | Source |
| :- | :- |
| `test_id` | The test's `test._id` |
| `result_id` | This run's own result `_id` |
| `suite_id` / `suite_name` | The id and name of the test's suite (absent for a test that isn't in a suite) |
| `organization_id` | The Ghost Inspector organization id |
| `browser` | The browser the run used, e.g. `chrome-79` |
| `region` | The region the run executed in, e.g. `us-east-1` |
| `start_url` / `end_url` | The page the run started on and ended on |
| `passing` | Whether this run passed |

## Troubleshooting

***

* **Flashduty returns a parameter error**: confirm the push URL includes `integration_key`, and the payload includes `data.test._id` and `data.passing`
* **The alert never recovers**: confirm the recovery came from the same test, and that the level you configured the webhook at (test, suite, or organization) actually covers it
* **A passing run created no new alert — this is expected**: a passing result with no matching open alert leaves nothing behind

For field details, see [Ghost Inspector Test Webhooks](https://docs.ghostinspector.com/api/webhooks/) and [Notifications & Alerts](https://docs.ghostinspector.com/notification/).
