Webhooks

Webhooks let you process every DebugBear test result on your own infrastructure.

For example, with webhooks you can:

  • Store performance metrics in your own analytics solution
  • Set the status of a build in your CI solution after the DebugBear test completes

How to set up a webhook

  1. Open the project Integrations tab
  2. Click Create webhook

Create DebugBear webhook

  1. Provide a URL where you can handle incoming POST requests
  2. Click Save

Edit DebugBear webhook

To test the webhook, go to a page in your project and trigger a one-off test.

Webhook data

For each test result, the webhook URL will receive a POST request with the a JSON body like this one:

{
    "event": "testComplete",
    "page": {
        "id": "123456",
        "url": "https://www.debugbear.com/",
        "name": "Homepage",
        "tags": [],
        "device": {
            "id": "9999",
            "rtt": 40,
            "name": "Desktop",
            "formFactor": "desktop",
            "bandwidthKbps": 8192,
            "cpuThrottling": 1
        },
        "region": "us-east",
        "formFactor": "desktop",
        "testSchedules": [{
            "id": "8888",
            "name": "Every 24 hours"
        }]
    },
        "project": {
        "id": "456789",
        "name": "DebugBear"
    },
    "analysis": {
        "id": "123456789",
        "baseHash": null,
        "isPrimary": true,
        "baseBranch": null,
        "commitHash": null,
        "commitBranch": null
    },
    "result": {
        "url": "https://www.debugbear.com/viewResult/6498968/overview",
        "status": "neutral",
        "metrics": {
            "cpu.total": 854,
            "pwa.score": 0.33,
            "seo.score": 1,
            "html.errors": 6,
            "crux.cls.p75": 0.02,
            "crux.fcp.p75": 1352,
            "crux.fid.p75": 3,
            "crux.lcp.p75": 2177,
            "analysis.date": "2022-01-01T12:52:13.419Z",
            "html.warnings": 1,
            "console.errors": 0,
            "pageWeight.ajax": 2105,
            "pageWeight.font": 22639,
            "console.warnings": 0,
            "crux.granularity": "origin",
            "pageWeight.image": 761464,
            "pageWeight.media": 0,
            "pageWeight.other": 0,
            "pageWeight.total": 1311400,
            "pageWeight.script": 482215,
            "performance.score": 0.99,
            "accessibility.score": 0.96,
            "bestPractices.score": 0.92,
            "pageWeight.document": 11490,
            "pageWeight.redirect": 252,
            "cpu.scriptEvaluation": 240.6,
            "pageWeight.stylesheet": 31235,
            "performance.speedIndex": 835,
            "performance.interactive": 2139,
            "performance.totalBlockingTime": 3,
            "performance.firstContentfulPaint": 506,
            "performance.firstMeaningfulPaint": 603,
            "performance.cumulativeLayoutShift": 0.003,
            "performance.largestContentfulPaint": 826
        },
        "oneLineSummary": "No changes."
    }
}

The analysis.isPrimary property indicates whether the page test was run on the normal URL that's configured for scheduled tests. For example, if you use the API to test a feature branch on your staging server then isPrimary would be false.


Still need help? Contact matt@debugbear.com for support.
DebugBear is a website monitoring tool built for front-end teams. Track performance metrics and Lighthouse scores in CI and production. Learn more.