Documentation
OneSignal Integration
Complete setup guide for push notifications
OneSignal enables you to send push notifications to your app users. This guide covers both the initial setup and the JavaScript integration for user identification.
Prerequisites
- OneSignal Account: Create a free account at onesignal.com
- iOS: Apple Developer Program membership ($99/year)
- Android: Firebase project (free)
Step 1: Create a OneSignal App
- Go to onesignal.com and sign in.
- Click New App/Website.
- Enter your app name and select Mobile App.
- Configure platforms:
- iOS: Upload your APNs Authentication Key (.p8 file) or certificate
- Android: Enter your Firebase Server Key and Sender ID
- Copy your OneSignal App ID (UUID format).
Step 2: Configure in WebToApp
- Go to your app's Integrations tab.
- Unlock the OneSignal add-on (requires credits).
- Toggle it ON.
- Paste your OneSignal App ID.
- Save and request a new build.
iOS: One-Time App Group Setup
For iOS builds, you must create a shared App Group in the Apple Developer Portal. This is a one-time setup that enables all WebToApp apps to receive rich push notifications.
- Go to Apple Developer Portal → App Groups
- Click the (+) button to register a new App Group
- Enter:
- Description: WebToApp OneSignal Group
- Identifier:
group.app.webtoapp.onesignal
- Click Continue → Register
Once created, this App Group works for all your WebToApp apps automatically.
JavaScript Bridge Integration
Link your website's user accounts with OneSignal devices to send targeted push notifications.
Login User
When a user logs into your website, send their ID to the app to register them with OneSignal.
window.FlutterWebView.postMessage(JSON.stringify({
type: 'userId',
userId: 'user_12345'
}));User Tags
Set tags for user segmentation (e.g., membership level, preferences).
window.FlutterWebView.postMessage(JSON.stringify({
type: 'userTags',
tags: {
plan: 'premium',
country: 'US',
notifications_enabled: 'true'
}
}));Logout
When the user logs out, clear their OneSignal registration.
window.FlutterWebView.postMessage(JSON.stringify({
type: 'userId',
userId: null
}));Opening URLs from Notifications
When sending a notification from OneSignal, include a URL in the additional data to open a specific page:
{
"additionalData": {
"openUrl": "https://yoursite.com/specific-page"
}
}