People get their notifications on their phones and computers, even with the app closed: in Chrome, Edge, Firefox and Safari, and in the app installed from the browser (Android, iPhone and iPad, Windows, macOS). DrootERP uses standard Web Push with VAPID keys: each browser's own push service carries the message (Google's for Chrome and Android, Mozilla's, Apple's, Microsoft's). There is no third-party account to create and no SDK in the app.
Set It Up
-
In Setup › Integrations › Connectors › Advanced, add Web Push and press Generate Keys. The kernel makes a VAPID key pair, saves the private key as a new secret (it is never shown) and fills VAPID Public Key and VAPID Private Key for you. Set Contact to
mailto:an address you read, or your site'shttpsURL: push services use it if they need to reach you. Save, then Test Connection checks that the keys belong together. -
Or make the pair on the command line and paste it (the private key as a secret):
npm run vapid:keys -w kernel(
node dist/cli/vapid-keys.jsin the kernel image.) It prints a public and a private key and stores nothing. -
In Setup › Customize › Notification Rules, turn on Push for a rule and choose the Web Push connector.
-
Each person turns push on for each device in Notifications › Preferences › Push Notifications. The same card lists their devices (they can remove a lost phone from another device) and has Send Test Notification: one push to each of their devices, with how many it reached and the first problem.
Keep one Web Push connector. Browsers subscribe with its public key, so a new key pair means everyone turns push on again (their old subscriptions are dropped the next time the app opens).
iPhone and iPad
Safari gets push only in the installed app (iOS and iPadOS 16.4 or later): Share › Add to Home Screen, open the app from the Home Screen, then turn push on. In a Safari tab the card says so instead of offering the button.
What a Device Gets
The rule's title, body and link. Tapping the notification opens the link in the app (focusing a window already open). A link is always an app path: a notification never opens another site. A repeated push of the same notification replaces the one shown. Messages are encrypted for the device (RFC 8291) and signed with the instance's key (RFC 8292). A push service keeps a message for a device that is off for Keep Undelivered For (default one day).
Devices and Signing Out
- A device registers when push is turned on, and again each time the app opens, so a shared computer's device moves to whoever is signed in.
- Signing out drops the browser's subscription. When a push service says a subscription is gone (the person blocked notifications or cleared the site's data), the device is removed.
- A person has at most 10 devices. The oldest is dropped.
API
| Method | Path | What it does |
|---|---|---|
| GET | /api/me/push-config |
{ webPush: { connectorKey, publicKey } }, or { webPush: null } when push is not set up |
| GET | /api/me/push-tokens |
The caller's devices (label, platform, last seen, a short fingerprint, never the token) |
| POST | /api/me/push-tokens |
Registers this device: token is the browser's PushSubscription.toJSON() as text, platform: "web", label |
| DELETE | /api/me/push-tokens |
Unregisters a device by its token |
| DELETE | /api/me/push-tokens/{device} |
Removes a device by its id |
| POST | /api/me/push-test |
Sends a test push to the caller's devices (or deviceId), now: each device's status (sent, rejected, failed), code and message. 5 a minute |
| POST | /api/admin/web-push/keys |
connectors.admin: a new VAPID pair; the private key is stored as a new secret. Answers { publicKey, secretName } |
A subscription's endpoint must be https on a browser push service (fcm.googleapis.com, android.googleapis.com,
updates.push.services.mozilla.com, *.push.apple.com, *.notify.windows.com). Any other endpoint is refused with
400, so the kernel never posts to an address a client chose.