LangWatch automation notifications on your phone.

Get a push notification when a LangWatch automation matches traces, fires a graph alert, or sends a scheduled report.

automationAIMonitoring
How it works

Three steps to your first push

STEP 01

Install the recipe

One click in Studio gives you a personal webhook URL.

STEP 02

Paste your URL into LangWatch

Add it as a webhook for Automation.

STEP 03

Get a push on your phone

With the text, sound and buttons from the recipe.

Setup

How to set up the LangWatch automation webhook

  1. Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL.
  2. Follow the setup notes below for Automation.
  3. Paste your webhook URL as the webhook URL and save.https://••••••••/•••••••• your personal URL, shown after install
  4. Send a test fire to check it.
  5. In LangWatch, create an automation (a trace filter, a graph alert, or a scheduled report) and choose the **Webhook** action with the URL above. Keep the **default body**: the recipe reads LangWatch's default fields, so a custom template would break it.
  6. **Availability:** the Webhook action for automations is new and may not be switched on for every LangWatch workspace yet. If you don't see it, use the [gateway](../gateway) recipe or ask LangWatch to enable it.
  7. LangWatch can sign requests with `X-LangWatch-Signature` (HMAC-SHA256), but JustPush doesn't check it yet, so keep your endpoint URL private.
The code

What runs when the webhook arrives

Studio calls handleRequest(request) with the incoming webhook and sends the message it returns. It's yours after install; change anything.

transform.js
1// LangWatch → automation webhook
2// Fires when a LangWatch automation with a Webhook action matches traces, fires a graph
3// alert, or sends a scheduled report. Expects LangWatch's default webhook body.
4// Docs: https://langwatch.ai/docs/features/automations
5
6// Alert types → emoji and priority.
7const ALERT_TYPES = {
8 CRITICAL: { emoji: "🚨", priority: 2 },
9 WARNING: { emoji: "🟠", priority: 0 },
10 INFO: { emoji: "ℹ️", priority: -1 },
11}
12
13// Condition operators → symbols.
14const OPERATORS = { gt: ">", gte: "≥", lt: "<", lte: "≤", eq: "=" }
15
16// Look a key up in one of the tables above, ignoring inherited names like "toString".
17function pick(table, key, fallback) {
18 return Object.prototype.hasOwnProperty.call(table, key) ? table[key] : fallback
19}
20
21// Keep long inputs readable in a notification.
22function clip(value, max = 100) {
23 const text = (typeof value === "string" ? value : value == null ? "" : JSON.stringify(value)).replace(/\s+/g, " ").trim()
24 return text.length > max ? text.slice(0, max - 1) + "…" : text || null
25}
26
27// Only link to real http(s) URLs.
28function link(url, cta) {
29 return typeof url === "string" && /^https?:\/\//.test(url) ? [{ cta, url }] : []
30}
31
32function handleRequest(request) {
33 const body = request.body || {}
34 const name = body.trigger?.name ?? "LangWatch automation"
35 const project = body.project?.name
36 const type = pick(ALERT_TYPES, body.trigger?.alertType, null)
37
38 if (body.event === "trigger.matched") {
39 const matches = Array.isArray(body.matches) ? body.matches : []
40 const count = Number(body.digest?.count) || matches.length
41 const first = clip(matches[0]?.input, 80)
42
43 return {
44 title: `${type?.emoji ?? "🔎"} ${name}`,
45 message:
46 `${count} trace${count === 1 ? "" : "s"} matched` +
47 (project ? ` in ${project}` : "") +
48 (first ? ` — “${first}”` : ""),
49 topic: "LangWatch",
50 priority: type?.priority ?? 0,
51 buttons: link(matches[0]?.url, "View trace"),
52 }
53 }
54
55 if (body.event === "alert.fired") {
56 const metric = body.metric?.label ?? body.graph?.name ?? "Metric"
57 const operator = pick(OPERATORS, body.condition?.operator, body.condition?.operator ?? "")
58 const rule = body.condition?.threshold != null ? ` (${operator} ${body.condition.threshold}${body.condition.window ? ` over ${body.condition.window}` : ""})` : ""
59
60 return {
61 title: `${type?.emoji ?? "🚨"} ${name}`,
62 message: `${metric}: ${body.currentValue ?? "?"}${rule}` + (project ? ` · ${project}` : ""),
63 topic: "LangWatch",
64 priority: type?.priority ?? 1,
65 buttons: link(body.graph?.url, "View graph"),
66 }
67 }
68
69 if (body.event === "report.scheduled") {
70 const charts = Array.isArray(body.charts) ? body.charts : []
71 const summary = charts
72 .filter((chart) => chart?.title && chart.total != null)
73 .slice(0, 3)
74 .map((chart) => `${chart.title}: ${chart.total}`)
75 .join(" · ")
76
77 return {
78 title: `📊 ${name}`,
79 message: summary || (body.report?.isEmpty ? "Nothing to report" : `Report for ${project ?? "your project"}`),
80 topic: "LangWatch",
81 priority: -1, // Low — a scheduled digest
82 buttons: link(body.viewUrl, "View report"),
83 }
84 }
85
86 // Guard: anything else (including custom templates) is ignored.
87 console.log(`Ignoring LangWatch event "${body.event ?? "unknown"}"`)
88 return null
89}
Payload

The LangWatch automation webhook

This is what LangWatch sends to your URL for automation. It is a sample, trimmed to the fields recipes use.

automation · sample.json
1{
2 "event": "alert.fired",
3 "graph": {
4 "url": "https://app.langwatch.ai/support-bot/analytics/custom/graph_01J9",
5 "name": "Faithfulness score"
6 },
7 "metric": {
8 "label": "Avg. faithfulness"
9 },
10 "project": {
11 "name": "Support bot",
12 "slug": "support-bot"
13 },
14 "trigger": {
15 "id": "trigger_01J9",
16 "name": "Hallucination rate",
17 "alertType": "CRITICAL"
18 },
19 "condition": {
20 "window": "1h",
21 "operator": "lt",
22 "threshold": 0.8
23 },
24 "currentValue": 0.71,
25 "previousValue": 0.86
26}
FAQ

LangWatch automation notifications: questions

Does this work on iPhone and Android?

Yes. Install the JustPush app from the App Store or Google Play and sign in. Every phone signed in to your account gets the notification.

Do I need to write code?

No. Install the recipe in Studio, paste your webhook URL into LangWatch and you are done. The code is there if you want to change the text, the sound or the buttons.

Can I change what the notification says?

Yes. After install the recipe's code is yours. Edit it in Studio and test it against the sample payload before you save.

What does it cost?

JustPush is free for 30 days. After that it's $19.99 a year, or $39.99 once. There is no extra charge for recipes.

Ready when you are

LangWatch on your phone in two minutes.

Install the recipe, paste one URL, done. Free for 30 days, no credit card required.