UniFi Protect vehicle detected notifications on your phone.

Get a push notification when a UniFi Protect camera spots a vehicle, with a button to open the event clip.

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 Vehicle.

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 vehicle 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 Vehicle 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 vehicle trigger, so it stays quiet if you point other alarms at the same integration.
  12. Give the alarm a descriptive name, like "Driveway Vehicle". 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 → vehicle detected
2// Fires when a UniFi Protect camera's smart detection spots a vehicle.
3//
4// Set this up as an Alarm Manager alarm in UniFi Protect with a "Vehicle"
5// 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 vehicles.
32 const vehicle = alarm.triggers.find((trigger) => trigger?.key === "vehicle")
33
34 if (!vehicle) {
35 console.log(`Ignoring "${alarm.name ?? "unknown"}" alarm — no vehicle trigger`)
36 return null
37 }
38
39 const seenAt = localTime(vehicle.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. "Driveway Vehicle").
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: "🚗 Vehicle detected",
50 message: (seenAt ? `Spotted at ${seenAt}` : "A vehicle was spotted") + where,
51 topic: "UniFi Protect",
52 priority: 0, // Normal — cars come and go; this is informational
53 // sound: "incoming", // any of Studio's sounds, e.g. incoming, bugle, siren
54 buttons: eventLink ? [{ cta: "View clip", url: eventLink }] : [],
55 }
56}
Payload

The UniFi Protect vehicle webhook

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

vehicle · sample.json
1{
2 "alarm": {
3 "name": "Driveway Vehicle",
4 "sources": [],
5 "triggers": [
6 {
7 "key": "vehicle",
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": "vehicle"
19 }
20 }
21 ],
22 "eventLocalLink": "https://192.168.1.1/protect/events/event/testEventId"
23 },
24 "timestamp": 1783505319286
25}
FAQ

UniFi Protect vehicle detected 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.