How standard push works
One identity, both directions:- App → OneSignal: on login the app calls
OneSignal.login(user.id), setting the OneSignal External ID to the account’s immutable UUID. It fans out to all of the user’s devices. - Server → OneSignal:
sendPushToUser(userId, …)targetsinclude_aliases: { external_id: [userId] }withtarget_channel: "push".userIdis the alias. - Delivery truth: OneSignal returns
200with arecipientscount even for an empty audience, so the helpers treat delivery asrecipients >= 1(thedeliveredflag the admin panel and the Send test notification button in Settings surface).
sendPushToUser needs no
per-platform code.
Everything is a no-op that returns
false when ONESIGNAL_APP_ID / ONESIGNAL_API_KEY are
unset — the kit ships push off by default.shipwide_api/src/modules/push/push.service.ts is the whole server surface:
High-priority / time-sensitive pushes
PassPushOptions to raise priority and shorten the delivery window — these are the knobs that
make a push wake the device promptly instead of being batched:
This is enough for high-priority alerts on both platforms without any native work. It is not
enough for a native call UI — that is VoIP.
VoIP-ready server layer (included)
sendVoipPushToUser(userId, data, options?) sends a voip APNs push through a separate
OneSignal app (ONESIGNAL_VOIP_APP_ID / ONESIGNAL_VOIP_API_KEY), with call-appropriate defaults
(apns_push_type_override: 'voip', content_available: true, ttl: 30). It targets the same
External ID alias, so identity needs no extra work.
data. Alongside it the helper sends a placeholder contents: { en: '-' },
because OneSignal requires a content field on some routing paths; the native call layer ignores it
and reads data only. Like the other helpers, it is a no-op that returns false until the VoIP
app is configured.
Adding full native VoIP
What’s left is native and platform-specific — the exact shape of a working implementation.iOS — PushKit + CallKit
- A Capacitor plugin registers
PKPushRegistry(a VoIP push token, separate from the APNs device token) and, inpushRegistry(_:didReceiveIncomingPushWith:), reports a call to CallKit (CXProvider). iOS 13+ requires reporting a call for every VoIP push, or the app is penalized. - The app needs the
voipbackground mode (Xcode → Signing & Capabilities → Background Modes → Voice over IP). Without it, PushKit registration succeeds but pushes are silently dropped. TheAppDelegatemust bootstrap the plugin so the registry is live at launch. - A client flow registers the VoIP token with OneSignal’s VoIP app, so the user’s alias has a VoIP subscription.
- Apple provisioning: a VoIP-services APNs certificate, uploaded to the OneSignal VoIP app.
Android — high-priority FCM + ConnectionService
- The call push must be data-only (no
notification/headings/contents/template_id), or FCM delivers it to the system tray and yourFirebaseMessagingService.onMessageReceivednever runs.sendVoipPushToUsersends no heading, and its placeholdercontentsis stripped by OneSignal for FCM data delivery. If you build your own sender, keep it data-only. - A custom
FirebaseMessagingServicethat, on an incoming-call message, starts a foreground service, registers aConnectionService, and posts a full-screen-intent notification. - The helper already sets
content_available: trueand a shortttl, but not the FCM priority — pass{ priority: 10 }asoptionsso the call wakes the device.
Web
No true VoIP: browsers can’t do data-only pushes or CallKit. A “call” on web is a high-priority notification shown by the OneSignal service worker (shipwide_app/public/OneSignalSDKWorker.js)
and handled in shipwide_app/src/helpers/onesignal/notificationHandlers.ts — register a handler
for your call type there with registerNotificationHandler() (keyed by the push’s
data.notificationType).
Checklist to go live with calls
1
OneSignal VoIP app
Create a second OneSignal app for VoIP; upload the Apple VoIP APNs certificate to it. Set
ONESIGNAL_VOIP_APP_ID / ONESIGNAL_VOIP_API_KEY.2
Native pieces
Add the iOS PushKit/CallKit plugin +
voip background mode; register the VoIP token on
login. Add the Android data-only FirebaseMessagingService + ConnectionService +
full-screen intent.3
Signal & test
Call
sendVoipPushToUser(...) from your call-signaling code. Test on physical devices —
CallKit and VoIP pushes do not work in the iOS Simulator.