OneSignal
OneSignal as a planned MainSDK notify driver for push - what to set up, main.yaml, testing and swapping.
OneSignal is a hosted service for push notifications and other messaging channels. It is named as a notify driver in the MainSDK requirements, so a person reached on push could get it through OneSignal. Pick it if your team already manages push audiences in OneSignal.
Interfaces it serves
Pick OneSignal in main.yaml for any of these. Your calls stay the same, and you can swap later.
notifyBuilding for 0.3Driver onesignal OneSignalPlanned driver
notify:
driver: onesignalBefore you start
- Create a OneSignal app and connect your push credentials (FCM for Android, an APNs key for iOS).
- Create an API key for server-side sends.
Store the API key in your secrets manager.
Configure
notify:
channels: [push, whatsapp, sms, email]
# push through OneSignal: [to be decided] the push block shape for this driver is not in the spec yetIts credential will be a secret: reference such as secret:ONESIGNAL_API_KEY (suggested name).
Use it
import { notify } from "mainsdk";
await notify(user, { template: "order.shipped", data: { orderId: order.id }, category: "orders" });Local development and testing
createTestApp() from @mainsdk/testing runs notify on its in-memory fake, and chaos.on("notify", { outage: true }) simulates an outage. Until a push driver is configured, the push channel is skipped.
What MainSDK adds on top
- Push only with opt-in, respecting opt-outs and quiet hours.
- No personal data in push payloads.
- A retry never sends twice.
See Notifications.
Limits and notes
- Planned driver, not in the spec yet. The email-notify spec lists OneSignal for the driver kit, later.
- Push through FCM, APNs and Expo comes with the expo-adapter spec (phase 3).
Swap to or from it
notify:
push: { drivers: [fcm, apns], via: expo } # instead of OneSignalFAQ
Can I use OneSignal today? Not through MainSDK yet. Use the FCM, APNs or Expo drivers when push arrives in phase 3.
Do OneSignal segments replace notify preferences? No. notify decides who gets a message from each person's preferences and consent.
Next
Open questions
Was this page helpful?