Push Notifications - WonderPush
Send unlimited push notifications to iOS and Android devices.
Get started in minutes: Ionic Quickstart Guide.
Advanced segmentation, automation and personalization of push messages for β¬1 per 1000 subscribers.
Requires the Cordova plugin wonderpush-cordova-sdk
.
WonderPush push notifications are the most effective way to retain your users and grow your audience while remaining fully GDPR compliant.
https://github.com/wonderpush/wonderpush-cordova-sdk
Stuck on a Cordova issue?
If you're building a serious project, you can't afford to spend hours troubleshooting. Ionicβs experts offer premium advisory services for both community plugins and premier plugins.
Installation
- Capacitor
- Cordova
- Enterprise
$ npm install wonderpush-cordova-sdk
$ npm install @awesome-cordova-plugins/wonderpush
$ ionic cap sync
$ ionic cordova plugin add wonderpush-cordova-sdk
$ npm install @awesome-cordova-plugins/wonderpush
Ionic Enterprise comes with fully supported and maintained plugins from the Ionic Team. Β Learn More or if you're interested in an enterprise version of this plugin Contact Us
Supported Platforms
- Android
- iOS
Usage
React
Learn more about using Ionic Native components in React
Angular
import { WonderPush } from '@awesome-cordova-plugins/wonderpush';
constructor(private wonderPush: WonderPush) { }
...
// Subscribe user
this.wonderPush.subscribeToNotifications()
.then(() => console.log("User subscribed to notifications"))
.catch((error: any) => console.error(error));
// Send an event (a purchase in this example)
this.wonderPush.sendEvent('purchase', {
float_price: 12.99,
string_sku: "X123456"
});
// Tag users (as customers)
this.wonderPush.addTag('customer');
// Personalize
// 1. Store user details.
// 2. Use those details to create segments.
// 3. Include those details in your notifications.
this.wonderPush.putProperties({
string_name: 'John D.',
int_age: 24
});
// GDPR
// 1. set REQUIRES_USER_CONSENT=true to enable GDPR compliance.
// 2. WonderPush doesn't start until setUserConsent(true) is called.
const onClick = (userConsent: boolean) => this.wonderPush.setUserConsent(userConsent);
// Listen to notification clicks
document.addEventListener('wonderpush.notificationOpen', function(event) {
console.log('Notification opened', event.notification);
if (event.notificationType === 'data') {
console.log('Silent notification', event.notification);
}
});