Push notifications
The push channel delivers alerts to the Android app through Firebase Cloud
Messaging.
-
Create a Firebase project and enable Cloud Messaging.
-
Create a service account with permission to send messages, and download its JSON key.
-
Give the whole file to Watcher, verbatim, as a single environment variable:
.env FIREBASE_SERVICE_ACCOUNT_JSON={"type":"service_account","project_id":"...","client_email":"...","private_key":"..."} -
Build and install the Android app, point it at your instance, and sign in. The app registers its device token automatically.
-
Add
pushto a watch’s channels and force a run to test.
How delivery works
Section titled “How delivery works”- An alert fans out to every device token registered to the watch’s owner.
- Delivery counts as successful if at least one device accepted it.
- Tokens the provider reports as gone (uninstalled app, rotated token) are pruned automatically.
- Messages are data-only: the app renders the notification itself, so device-side preferences — which tiers to show, quiet hours — are honoured even when the app is closed.
Watcher mints its own short-lived access token from the service account using standard cryptography; there is no Firebase SDK dependency on the server.
Managing device tokens directly
Section titled “Managing device tokens directly”The app handles this, but the routes are open to any client:
curl -s -X PUT "https://<your-host>/devices/<token>" \ -H "authorization: Bearer $TOKEN" \ -H 'content-type: application/json' -d '{"platform":"android"}'See Devices API.
Platform support
Section titled “Platform support”Android only. The iOS project in the repository is unmaintained, and the device
platform field currently accepts android alone.
Security notes
Section titled “Security notes”- The service-account JSON is a credential: it can send messages as your project. Keep it in the environment or a secret store.
- Watcher never logs it, and its errors report status codes only — never the key material or the device token.
- Registration tokens are device addresses, not secrets, but they are still scoped per owner and never returned to other accounts.