Moving from OneSignal
Moving from OneSignal is mostly a rename. Your backend sends the same request to a new URL, the
Flutter and web calls keep their names under Takeed, and your Android and iOS subscribers come
with you. Your app no longer needs google-services.json, and WhatsApp login codes come in the same
account.
On this page
| What | Details |
|---|---|
| Stays the same | The REST fields and segment names; the Flutter v5 and Web v16 call names; your users' External IDs (login) and tags |
| Changes | The URL and the key; OneSignal becomes Takeed; the Firebase service account goes in the dashboard, not google-services.json in the app |
| You gain | Free, unlimited notifications; WhatsApp OTP in the same account; branches with their own keys and limits |
| Not available | OneSignal.Debug, Location, InAppMessages, LiveActivities; sending email or SMS |
The code change is small. The slow part is the app store release, so plan the switch around your next release. Five steps:
- Create the app and add your keys.
- Point your backend at Takeed.
- Swap the SDK in the app.
- Import your subscribers.
- Cut over.
1Create the app and add your keys#
Create an account, enter the company name and add an app. Open Settings → Notification settings → Firebase and Apple keys, then choose Add key:
- Android: the Firebase service account JSON (Firebase console, Project settings, Service accounts, Generate new private key). Takeed reads the project's Android apps from Firebase itself; nothing goes in your app.
- iOS: your APNs
.p8key with its Key ID, your Team ID and the app's Bundle ID.
Watch out
Use the same Firebase project and Apple team as OneSignal. The subscribers you import in step 4 belong to them, and a different project can't reach them.
The Flutter quick start has the details.
2Point your backend at Takeed#
Change the URL, the key and the App ID. The body stays as it is:
curl https://api.onesignal.com/notifications \ -H "Authorization: Key $ONESIGNAL_REST_KEY" \curl https://takeed-iq.com/api/v1/notifications \ -H "Authorization: Key $TAKEED_KEY" \ -H "Content-Type: application/json" \ -d '{"app_id": "ONESIGNAL-APP-ID", -d '{"app_id": "TAKEED-APP-ID", "included_segments": ["All"], "headings": {"en": "Hello"}, "contents": {"en": "It works"}}'| OneSignal | Takeed |
|---|---|
https://api.onesignal.com/notifications (older: https://onesignal.com/api/v1/notifications) |
https://takeed-iq.com/api/v1/notifications |
Authorization: Key <REST API key> (older keys: Basic <key>) |
Authorization: Key <Takeed key>; Basic and Bearer work too |
app_id |
The Takeed App ID (or target with your slugs) |
| One OneSignal app per company subdomain | One app: target: "app:company", or a branch key |
Check the fields your backend sends against the list under Supported fields.
3Swap the SDK in the app#
Flutter#
From onesignal_flutter v5 to takeed_flutter 2.1.2 or later:
dependencies: onesignal_flutter: ^5.2.0 takeed_flutter: ^2.1.2import 'package:onesignal_flutter/onesignal_flutter.dart';import 'package:takeed_flutter/takeed_flutter.dart';OneSignal.initialize('ONESIGNAL-APP-ID');await Takeed.initialize('TAKEED-APP-ID');OneSignal.login(user.id);await Takeed.login(user.id);OneSignal.User.addTagWithKey('plan', 'gold');await Takeed.User.addTag('plan', 'gold');- Remove
google-services.jsonand the Google services Gradle plugin if they were only there for OneSignal. Takeed gives the SDK the Firebase settings from the service account you added in step 1. - iOS: replace the Notification Service Extension's file with the package's
extension/NotificationService.swift, and remove the OneSignal pod from that target. - Rename the other calls with this table:
| OneSignal | Takeed |
|---|---|
OneSignal.initialize(appId) |
Takeed.initialize(appId) |
OneSignal.login(id) / logout() |
Takeed.login(id) / logout() |
OneSignal.User.addTagWithKey(k, v) |
Takeed.User.addTagWithKey(k, v) or addTag(k, v) |
OneSignal.User.addTags / removeTag / removeTags |
Same names |
OneSignal.User.addEmail / addSms |
Same names (or setEmail / setPhone) |
OneSignal.User.pushSubscription.optIn() / optOut() / id |
Same names |
OneSignal.Notifications.requestPermission(true) |
Same |
OneSignal.Notifications.addClickListener |
Same; the event type is TakeedNotificationClickEvent |
OneSignal.Notifications.addForegroundWillDisplayListener |
Same; event.preventDefault() / event.display() |
OneSignal.Debug, Location, InAppMessages, LiveActivities |
Not available |
Web (v16)#
<script src="https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js" defer></script><script src="https://takeed-iq.com/sdk/v1/takeed.js" defer></script><script> window.OneSignalDeferred = window.OneSignalDeferred || []; OneSignalDeferred.push(async (OneSignal) => { await OneSignal.init({ appId: 'ONESIGNAL-APP-ID' }); window.TakeedDeferred = window.TakeedDeferred || []; TakeedDeferred.push(async (Takeed) => { await Takeed.init({ appId: 'TAKEED-APP-ID', serviceWorkerPath: '/push/TakeedSDKWorker.js', serviceWorkerScope: '/push/' }); });</script>| OneSignal | Takeed |
|---|---|
OneSignalDeferred.push(...) |
TakeedDeferred.push(...) |
OneSignal.init({ appId }) |
Takeed.init({ appId, serviceWorkerPath }) |
OneSignalSDKWorker.js |
TakeedSDKWorker.js, served from your own domain |
login, logout, Notifications.permission, Notifications.requestPermission |
Same names |
The Web quick start shows where the worker file goes.
4Import your subscribers#
- In OneSignal, export your subscribers as a CSV file.
- In Takeed, open the app's Notification users page and use Import from OneSignal. Choose the key the Android and iOS tokens use.
- Android and iOS tokens move over, and the phones still on your old app version receive Takeed's notifications. Web subscriptions can't move (they are tied to OneSignal's keys); browsers that allowed notifications subscribe again silently on their next visit to a page with the Takeed SDK.
5Cut over#
- Test first: on Notification users, mark your own phone as a test device, then send to the
Test Userssegment from Test notifications. - Switch your backend to Takeed for every send. Don't send the same notification through both: phones that are in both would get it twice.
- Release the app version with the Takeed SDK. Updated phones and new installs register with Takeed directly.
- When the counts in Notification log look right, turn off the OneSignal app.