Push notifications


Register for push notifications


Use this method to pass the Firebase Token to Synerise for notifications.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.registerForNotifications(registrationToken, mobileAgreement, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
registrationToken string yes - Firebase Token
mobileAgreement boolean yes - Agreement (consent) for mobile push campaigns
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

// If you integrate Firebase Messaging in the native part of app
Synerise.Notifications.setListener({
	onRegistrationToken: function(registrationToken) {
		Synerise.Notifications.registerForNotifications(registrationToken, true, function(){
			//success
		}, function() {
			//failure
		});
	},
	onNotification: function(payload) {
		//...
	}
	//...
	//other listener's methods
});
// Or if you want to use Firebase Messaging in react native
Synerise.Notifications.registerForNotifications("YOUR_FIREBASE_TOKEN", true, function(){
	//success
}, function() {
	//failure
});

Check if push notification is from Synerise


Verifies if a notification was sent by Synerise.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.isSyneriseNotification(payload)

Parameters

Parameter Type Mandatory Default Description
payload object yes - Notification’s key-value data object

Return Value

Boolean value is returned.

Example

Synerise.Notifications.setListener({
	onNotification: function(payload) {
		if (Synerise.Notifications.isSyneriseNotification(payload)) {
			Synerise.Notifications.handleNotification(payload);
		}
	}
	//...
	//other listener's methods
});

Check if push notification is a simple push campaign


Verifies if a notification was sent by Synerise and that it’s a Simple Push.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.isSyneriseSimplePush(payload)

Parameters

Parameter Type Mandatory Default Description
payload object yes - Notification’s key-value data object

Return Value

Boolean value is returned.

Example

Synerise.Notifications.setListener({
	onNotification: function(payload) {
		if (Synerise.Notifications.isSyneriseSimplePush(payload)) {
			Synerise.Notifications.handleNotification(payload);
		}
	}
	//...
	//other listener's methods
});

Check if push notification is a banner campaign


Verifies if a notification was sent by Synerise and that it’s a Banner.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.isSyneriseBanner(payload)

Parameters

Parameter Type Mandatory Default Description
payload object yes - Notification’s key-value data object

Return Value

Boolean value is returned.

Example

Synerise.Notifications.setListener({
	onNotification: function(payload) {
		if (Synerise.Notifications.isSyneriseBanner(payload)) {
			Synerise.Notifications.handleNotification(payload);
		}
	}
	//...
	//other listener's methods
});

Check if push notification is a silent command


Verifies if a notification was sent by Synerise and that it’s a Silent Command.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.isSilentCommand(payload)

Parameters

Parameter Type Mandatory Default Description
payload object yes - Notification’s key-value data object

Return Value

Boolean value is returned.

Example

Synerise.Notifications.setListener({
	onNotification: function(payload) {
		if (Synerise.Notifications.isSilentCommand(payload)) {
			Synerise.Notifications.handleNotification(payload);
		}
	}
	//...
	//other listener's methods
});

Check if push notification is a silent SDK command


Verifies if a notification was sent by Synerise and that it’s a Silent SDK Command.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.isSilentSDKCommand(payload)

Parameters

Parameter Type Mandatory Default Description
payload object yes - Notification’s key-value data object

Return Value

Boolean value is returned.

Example

Synerise.Notifications.setListener({
	onNotification: function(payload) {
		if (Synerise.Notifications.isSilentSDKCommand(payload)) {
			Synerise.Notifications.handleNotification(payload);
		}
	}
	//...
	//other listener's methods
});

Check if push notification is encrypted


Verifies if a notification is encrypted.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.isNotificationEncrypted(payload)

Parameters

Parameter Type Mandatory Default Description
payload object yes - Notification’s key-value data object

Return Value

Boolean value is returned.

Example

Synerise.Notifications.setListener({
	onNotification: function(payload) {
		if (Synerise.Notifications.isNotificationEncrypted(payload)) {
			Synerise.Notifications.decryptNotification(payload);
		}
	}
	//...
	//other listener's methods
});

Decrypt notification


Decrypts the notification payload.
If the payload is not encrypted, the method returns raw payload.
The method returns null if the crypter fails while decrypting the payload.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.decryptNotification(payload)

Parameters

Parameter Type Mandatory Default Description
payload object yes - Notification’s key-value data object

Return Value

Key-value data object is returned.

Example

Synerise.Notifications.setListener({
	onNotification: function(payload) {
		let data = Synerise.Notifications.decryptNotification(payload)
		// custom notification implementation
	}
	//...
	//other listener's methods
});

Handle Synerise push notification with action identifier


Handles a notification payload with an action and starts activity.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.handleNotification(payload, actionIdentifier)

Parameters

Parameter Type Mandatory Default Description
payload object yes - Notification’s key-value data object
actionIdentifier string no - Identifier of the action, received in the notification response

Return Value

There is no return value.

Example

Synerise.Notifications.setListener({
	onNotification: function(payload, actionIdentifier) {
		Synerise.Notifications.handleNotification(payload, actionIdentifier);
	}
	//...
	//other listener's methods
});
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker