Push notifications
Send push notifications to your app users through FCM and APNs with your own credentials: register tokens from the app, send from a function or your server.
Add credentials
Console › Authentication › Mobile › Push notifications: upload the Firebase service account JSON (Android, and iOS through Firebase) and/or an APNs
.p8key (key id, team id, bundle id, sandbox or production). They are encrypted and never shown again.Register the token after sign-in
final token = await FirebaseMessaging.instance.getToken(); await sovaria.push.register(token: token!, platform: Platform.isIOS ? 'ios' : 'android', topics: ['news']); FirebaseMessaging.instance.onTokenRefresh.listen((t) => sovaria.push.register(token: t, platform: 'android'));Send from a function
// Functions › Secrets: SOVARIA_SERVICE_ROLE_KEY await sov.api.push.send({ message: { to: { user_ids: [order.user_id] }, // or device_ids, or topic: 'news' notification: { title: 'Order shipped', body: 'Arriving tomorrow' }, data: { order_id: order.id }, } })
| Field | Meaning |
|---|---|
to | user_ids, device_ids and/or topic (devices subscribed with push.subscribe). |
notification | title, body, image (https). |
data | String key/values your app receives. |
badge, sound, thread_id, android_channel_id | Platform extras. |
priority, ttl_seconds, collapse_key | high (default) or normal; how long to keep trying; replace an older push with the same key. |
content_available | Silent push that wakes the app (sent with APNs priority 5). |
dry_run | Count the audience; nothing is sent and nothing is billed. |
- App users can only register and remove their own tokens; only console admins and server keys send.
- Tokens a provider reports as gone (uninstalled app) are disabled automatically.
- Each send is logged with counts and error codes — never the message content (Push notifications › Recent sends).
- Limits:
push.sends_month(Free stops at the cap, paid plans bill overage),push.max_recipients_per_send,push.sends_per_second,push.devices_per_user.
Something unclear or missing on this page?Tell us