# BetterUptime

To automate the reporting and closing of incidents on your status page based on the status reported by BetterUptime synthetic checks, follow these steps.

### Create your Webhook Integration in StatusPal

First, you need to create an <mark style="color:purple;">endpoint URL</mark> within StatusPal. This URL will act as the bridge between BetterUptime and StatusPal, receiving notifications from BetterUptime about uptime check results via webhook.

* **Navigate to Services:** On your Status Page, create a new service or edit an existing service.
* **Add Webhook:** On *Monitoring and incident automation section*, check on `Webhook` and select BetterUptime.
* **Finish and Save:** Create or update the service, then copy the <mark style="color:purple;">endpoint URL</mark> that will be created for you.

<figure><img src="https://4061983002-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgIMm5p2V7PNx3dS7vwKE%2Fuploads%2FcmZUHgFNecUa0IL1yPzn%2Fstatuspal-betteruptime.png?alt=media&#x26;token=949aed9e-c216-4c3a-a6ea-1323b15bc90b" alt=""><figcaption></figcaption></figure>

### Create your Webhook Integration in BetterUptime

Next, you need to create a webhook integration.&#x20;

* **Navigate to Integrations:** On the BetterUptime navigation bar, click on `Integrations`.
* **Add a Webhook:** Navigate to *Exporting data* option and choose `Webhooks`. Then choose do add a `Monitor webhook`.
* **Configure Webhook:** On the Webhooks configuration, you'll need to add the <mark style="color:purple;">endpoint URL</mark> provided by StatusPal. *This URL is specific to your StatusPal service configuration and is essential for the integration to work correctly*. Paste this URL into the appropriate field.
* **Payload Configuration:** On the *Advance settings section*, you need to make sure the HTTP Method is set to POST. On the *Request body section*, please make sure the properties and their values  are added and set as we shown here: `"type": "incident"` and `"status": "$STATUS"`.
* **Attention:** If you have to configure the body to accommodate other uses, please make sure to keep the same structure as the default template where the data is read as <mark style="color:yellow;">**`data -> id, type, status...`**</mark>

```
{
  "data": {
    "id": "$INCIDENT_ID",
    "type": "incident",
    "status": "$STATUS",
    "attributes": {
      "name": "$NAME",
      "url": "$URL",
      "http_method": "$HTTP_METHOD",
      "cause": "$CAUSE",
      "started_at": "$STARTED_AT",
      "acknowledged_at": "$ACKNOWLEDGED_AT",
      "resolved_at": "$RESOLVED_AT",
      "response_content": "$RESPONSE_CONTENT",
      "response_url": "$RESPONSE_URL",
      "screenshot_url": "$SCREENSHOT_URL"
    }
  }
}
```

<figure><img src="https://4061983002-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgIMm5p2V7PNx3dS7vwKE%2Fuploads%2FhAffJi3hnmPnEmb41DVu%2Fbetteruptime-payload.png?alt=media&#x26;token=40b9e651-81c1-49c6-9c29-dfb39672e763" alt=""><figcaption></figcaption></figure>

### Create your Synthetic Monitor Test in BetterUptime

Next, you need to configure your synthetic monitor in BetterUptime and link it to the webhook you just created.

* **Navigate to Synthetics:** On the BetterUptime navigation bar, click on `Monitors`.
* **Create Uptime Monitor:** Click on `Create monitor` and create a new monitor for the synthetic you want to track. Configure the monitor according to your needs (e.g., check frequency, target URL).
* **Add Escalation:** On the settings configuration, make sure that on the *On-call escalation section*, the `Critical alert` is selected.

That's it! Once you have completed these steps, BetterUptime will send notifications about your uptime checks to StatusPal, allowing you to monitor and manage your service availability from a centralized platform.
