Recipe · Grafana

Route Grafana alerts to your phone

Grafana's webhook contact point sends its own payload shape — a small relay reshapes it into a Paperplane event, with the alert's labels carried through as context.

Grafana’s alerting webhook payload carries a full alert group — labels, annotations, state, a commonLabels block — not a flat title/message. Rather than fight Grafana’s templating for an exact match, point it at a small relay that reshapes the payload and forwards it.

The relay

A few lines is enough — this one runs on Cloudflare Workers, but any small HTTP handler works the same way:

export default {
  async fetch(request, env) {
    const alert = await request.json();
    const first = alert.alerts?.[0];
    const firing = alert.status === 'firing';

    await fetch(`https://<host>/events/<username>/Grafana`, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        title: `${firing ? 'Alert' : 'Resolved'}: ${alert.commonLabels?.alertname ?? 'Grafana'}`,
        message: first?.annotations?.summary ?? alert.message ?? 'No summary provided',
        priority: firing ? 'High' : 'Low',
        nature: firing ? 'error' : undefined,
        dataJson: JSON.stringify(alert.commonLabels ?? {}),
      }),
    });

    return new Response('ok');
  },
};

Wiring it up

  1. Alerting → Contact points → Add contact point, type Webhook.
  2. Set the URL to your relay, not directly to Paperplane.
  3. Attach the contact point to a notification policy scoped to whichever alert rules should reach your phone — not everything Grafana tracks needs to page you.

Why a relay instead of Grafana’s own templating

Grafana can template the webhook body directly in newer versions, which avoids the extra hop if you’re comfortable with its templating syntax. The relay is the more durable recipe here: it doesn’t depend on which Grafana version you’re running, and it’s the same pattern you’d reuse for any tool — like Stripe — whose webhook payload doesn’t already match Paperplane’s shape.