UniFi Protect glass break heard notifications on your phone.

Get a Highest-priority push notification when a UniFi Protect camera hears glass breaking, with a button to open the event clip.

alrmGlassBreakSmart homeSecurity
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 UniFi Protect

Add it as a webhook for Glass Break.

STEP 03

Get a push on your phone

With the text, sound and buttons from the recipe.

Setup

How to set up the UniFi Protect glass break webhook

  1. Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL.
  2. In UniFi Protect, go to Settings > Alarm Manager and click Add Alarm.
  3. Set the trigger to Glass Break and select the camera(s) it should watch.
  4. Under actions, add a Webhook with method POST and paste your webhook URL?tz=Europe/Amsterdam as the URL, using your own time zone.https://••••••••/•••••••• your personal URL, shown after install
  5. Save the alarm, then press Test to send a sample event.
  6. Add your time zone to the webhook URL so the notification shows the local time:
  7. ```
  8. your webhook URL?tz=Europe/Amsterdam
  9. ```
  10. Use your own [time zone name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). UniFi only sends a UTC timestamp; without `tz`, the time is left out of the message.
  11. Alarm Manager sends every alarm to the same webhook shape. This recipe only reacts when the alarm contains a glass break trigger, so it stays quiet if you point other alarms at the same integration.
  12. Give the alarm a descriptive name, like "Living Room Glass". The payload only identifies the camera by its MAC address, so the alarm name is what tells you where it happened.
  13. The **View clip** button uses `eventLocalLink`, which only resolves on your home network (and shows a certificate warning). Away from home it won't load.
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// UniFi Protect → glass break heard
2// Fires when a UniFi Protect camera's audio detection hears glass breaking.
3//
4// Set this up as an Alarm Manager alarm in UniFi Protect with the "Glass Break"
5// audio trigger and a Webhook action pointing at your JustPush Studio integration URL.
6
7// UniFi only sends a UTC timestamp, not your console's time zone, so the time zone comes
8// from the webhook URL: ?tz=Europe/Amsterdam. Without one (or with an unknown name) the
9// time is left out rather than shown in the server's time zone.
10function localTime(timestamp, request) {
11 const timeZone = typeof request.query?.tz === "string" ? request.query.tz.trim() : ""
12
13 if (!timestamp || !timeZone) return null
14
15 try {
16 return new Date(timestamp).toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit", timeZone })
17 } catch {
18 return null // not a time zone name this runtime knows
19 }
20}
21
22function handleRequest(request) {
23 const alarm = (request.body || {}).alarm
24
25 // Guard: ignore anything that isn't a UniFi Protect alarm payload.
26 if (!alarm || !Array.isArray(alarm.triggers)) {
27 console.log("Not a UniFi Protect alarm payload — skipping")
28 return null
29 }
30
31 // Alarm Manager sends every alarm to the same webhook, so only handle glass breaks.
32 const glass = alarm.triggers.find((trigger) => trigger?.key === "alrmGlassBreak")
33
34 if (!glass) {
35 console.log(`Ignoring "${alarm.name ?? "unknown"}" alarm — no glass break trigger`)
36 return null
37 }
38
39 const heardAt = localTime(glass.timestamp, request)
40
41 // The payload only carries the camera's MAC, so the alarm name is the most
42 // readable hint of where this happened (e.g. "Living Room Glass").
43 const where = alarm.name ? ` — ${alarm.name}` : ""
44
45 // The local link only resolves on your LAN, and only when the event was recorded.
46 const eventLink = alarm.eventLocalLink
47
48 return {
49 title: "💥 Glass break detected",
50 message: (heardAt ? `Breaking glass heard at ${heardAt}` : "A camera heard breaking glass") + where,
51 topic: "UniFi Protect",
52 priority: 2, // Highest — possible break-in happening right now
53 // sound: "siren", // any of Studio's sounds, e.g. incoming, bugle, siren
54 buttons: eventLink ? [{ cta: "View clip", url: eventLink }] : [],
55 }
56}
Payload

The UniFi Protect alrmGlassBreak webhook

This is what UniFi Protect sends to your URL for glass break. It is a sample, trimmed to the fields recipes use.

alrmGlassBreak · sample.json
1{
2 "alarm": {
3 "name": "Living Room Glass",
4 "sources": [],
5 "triggers": [
6 {
7 "key": "alrmGlassBreak",
8 "device": "FAKE_MAC",
9 "eventId": "testEventId",
10 "timestamp": 1783505319282
11 }
12 ],
13 "eventPath": "/protect/events/event/testEventId",
14 "conditions": [
15 {
16 "condition": {
17 "type": "is",
18 "source": "alrmGlassBreak"
19 }
20 }
21 ],
22 "eventLocalLink": "https://192.168.1.1/protect/events/event/testEventId"
23 },
24 "timestamp": 1783505319286
25}
FAQ

UniFi Protect glass break heard 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 UniFi Protect 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

UniFi Protect on your phone in two minutes.

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