Campaigns

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 Push 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


Handles a notification payload and starts activity.

Important: This method was removed in SDK version 0.10.0.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.handleNotification(payload)

Parameters

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

Return Value

There is no return value.

Example

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

Get Walkthrough


Fetches a walkthrough.

Declared In

lib/main/modules/InjectorModule.js

Method

Synerise.Injector.getWalkthrough()

Return Value

There is no return value.

Show Walkthrough


Shows a walkthrough when it is loaded.

Declared In

lib/main/modules/InjectorModule.js

Method

Synerise.Injector.showWalkthrough()

Return Value

There is no return value.

Check if Walkthrough is loaded


Checks if a walkthrough is loaded.

Declared In

lib/main/modules/InjectorModule.js

Method

Synerise.Injector.isWalkthroughLoaded()

Return Value

true if the walkthrough is loaded, otherwise returns false.

Check if is loaded Walkthrough unique


Checks if the walkthrough is unique compared to the previous one.

Declared In

lib/main/modules/InjectorModule.js

Method

Synerise.Injector.isLoadedWalkthroughUnique()

Return Value

true if the walkthrough is unique, otherwise returns false.

Fetch Banners


Fetches banners set for mobile campaigns and caches the valid ones.

Declared In

lib/main/modules/InjectorModule.js

Method

Synerise.Injector.fetchBanners(onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
success (([[AnyHashable: Any]]) -> Void) yes - Closure/Block to be executed when the operation finishes successfully
failure ((ApiError) -> Void) yes - Closure/Block to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Get Banners


Provides valid banners directly from SDK cache.

Declared In

lib/main/modules/InjectorModule.js

Method

Synerise.Injector.getBanners()

Return Value

List of structures that represents cached Banners.

Show Banner


Shows a banner immediately.

Declared In

lib/main/modules/InjectorModule.js

Method

Synerise.Injector.showBanner(banner, markPresented)

Parameters

Parameter Type Mandatory Default Description
bannerDictionary object yes - Dictionary representation of a banner
markPresented boolean yes - Sets the banner as presented and this banner instance representation will not appear again

Return Value

There is no return value.

😕

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