# Make Datadog monitors land on your phone.

> Get Datadog monitor alerts as push notifications. Register Pocket Alert as a webhook and catch breaches on your phone in under a second.

<!-- source: https://pocketalert.app/use-cases/datadog-alerts -->

When a Datadog monitor triggers, the alert and its severity hit your phone in under a second. Catch the incident before it escalates to a page.

## Three steps to Datadog alerts on your phone

1. **Create a webhook** — Create a Pocket Alert webhook with a GJSON message template and copy its receive URL.
2. **Wire up the webhook** — Register the URL in the Datadog Webhooks integration with a custom $EVENT_TITLE / $TEXT_ONLY_MSG payload, then call it from a monitor.
3. **Map and ship** — GJSON maps the event title, message, and transition into your push. The next trigger buzzes your phone.

## From breached monitor to lock screen

Datadog already posts a webhook when a monitor breaches. Pocket Alert turns it into a push you cannot miss.

- **Plugs into Datadog webhooks** — Register Pocket Alert in the Datadog Webhooks integration and call it with @webhook-pocketalert from any monitor.
- **Template variables in, GJSON out** — Datadog template variables fill the JSON body. GJSON paths in Pocket Alert pull the event title, message, and transition into your notification.
- **Triggered vs recovered** — Map $ALERT_TRANSITION so a triggered monitor reads differently from a recovery, right on your lock screen.
- **A channel per environment** — Each application has its own webhook URL, so infra, APM, and per-team monitors stay in separate channels.
- **Sub-second delivery** — The breach hits your phone in under a second, well before the escalation policy kicks in.
- **Secret webhook URL** — The webhook URL is your application secret over HTTPS. Rotate it whenever you need a fresh endpoint.

## Send Datadog alerts to your phone

### 1. Create a Pocket Alert webhook

On the [Webhooks](https://pocketalert.app/webhooks) page create a webhook with a GJSON `message` template that maps the Datadog payload you will send. You can also create it via the API:

```
curl -X POST "https://api.pocketalert.app/v1/webhooks" \
  -H "Token: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Datadog","message":"%event_title% — %alert_transition%\n%body%\n%link%","application_id":"qm47b9pzxzxg"}'
```

You get an inbound URL like `https://p4a.me/wh/1234abcd`. The GJSON paths above (`%event_title%`, `%alert_transition%`, `%body%`, `%link%`) read the JSON keys Datadog will POST in the next step.

### 2. Register the webhook in Datadog

Go to [Integrations → Webhooks](https://docs.datadoghq.com/integrations/webhooks/) and add a new webhook. Paste the receive URL and define a custom payload using Datadog template variables:

```
Name:    pocketalert
URL:     https://p4a.me/wh/1234abcd
Payload: {
  "event_title": "$EVENT_TITLE",
  "body": "$TEXT_ONLY_MSG",
  "alert_transition": "$ALERT_TRANSITION",
  "level": "critical",
  "link": "$LINK"
}
```

### 3. Call it from a monitor

Add `@webhook-pocketalert` to the monitor message. When the monitor triggers, Datadog POSTs the payload above; Pocket Alert renders the GJSON template and pushes it. A recovery sends `$ALERT_TRANSITION = Recovered`, so the same alert reads "Recovered" when it clears.

The [webhook settings docs](https://info.pocketalert.app/api/webhooks/settings.html) cover every GJSON path and webhook option.

## FAQ

### How do I send Datadog alerts to my phone?

Create a Pocket Alert webhook, copy its receive URL, then register it in Datadog under Integrations → Webhooks. Call it with @webhook-pocketalert from any monitor message and the alert reaches your phone in under a second.

### How does field mapping work?

In the Datadog webhook you define the JSON body with template variables like $EVENT_TITLE, $TEXT_ONLY_MSG, $ALERT_TRANSITION, and $LINK. Pocket Alert reads that JSON with GJSON paths, so your message template maps those fields into the notification title and body.

### Can I show the alert transition and severity?

Yes. Include $ALERT_TRANSITION (Triggered / Recovered) or $ALERT_TYPE in the payload and reference it in the message template, so a triggered monitor reads differently from a recovery. Datadog also exposes $PRIORITY and $ALERT_STATUS if you want them in the text.

### Can I separate prod and staging?

Register one webhook per environment or team and reference the right one from each monitor. Prod and staging land in separate channels you can mute independently.

### Do I need another agent?

Nothing on a host. Pocket Alert receives the webhook Datadog sends from its monitor engine, so there is no extra agent beyond the Datadog Agent you already run.

### Can I map alert severity to notification priority?

Yes. Since you define the webhook payload yourself, add a "level" field next to $EVENT_TITLE — silent, low, default, high, or critical — and Pocket Alert maps it to notification priority. Send critical from a paging monitor so it breaks through Do Not Disturb, or set default_level on the webhook and skip the field entirely; an explicit level always wins. An invalid value falls back to default, never rejected.
