Campaigns


Set Injector listener


This method sets callbacks for an injector module.

Declared In:
lib/main/modules/InjectorModule.js

Related To:
ClientStateChangeListener

Class:
InjectorModule

Declaration:

public setListener(listener: IInjectorListener)

Discussion:
Learn more about the methods and the purpose of this listener here.

Set In-App Message listener


This method sets callbacks for in-app message campaigns.

Declared In:
lib/main/modules/InjectorModule.js

Related To:
ClientStateChangeListener

Class:
InjectorModule

Declaration:

public setInAppMessageListener(listener: IInjectorInAppMessageListener)

Discussion:
Learn more about the methods and the purpose of this listener here.

Set Notifications listener


This method sets callbacks for notifications module.

Declared In:
lib/main/modules/NotificationsModule.js

Class:
NotificationsModule

Declaration:

public setListener(listener: INotificationsListener)

Register for push notifications


This method passes the Firebase Token to Synerise for notifications.

Note: The API key must have the API_BY_IDENTIFY_DEVICE_CLIENT_UPDATE permission from the Client group.
Note: If the registration fails, the SDK requests a token update again by a listener/delegate method (Android, iOS, React Native, Flutter).

Declared In:
lib/main/modules/NotificationsModule.js

Class:
NotificationsModule

Declaration:

public registerForNotifications(registrationToken: string, mobileAgreement: boolean | null, onSuccess: () => void, onError: (error: Error) => void)

Parameters:

Parameter Type Mandatory Default Description
registrationToken string yes - Firebase Token
mobileAgreement boolean false null Agreement (consent) for mobile push campaigns
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

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


This method verifies if a notification was sent by Synerise.

Declared In:
lib/main/modules/NotificationsModule.js

Class:
NotificationsModule

Declaration:

public isSyneriseNotification(payload: object): boolean

Parameters:

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

Return Value:
true if a notification was sent by Synerise, otherwise false.

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


This method verifies if a notification’s sender is Synerise and if the notification is a Simple Push campaign

Declared In:
lib/main/modules/NotificationsModule.js

Class:
NotificationsModule

Declaration:

public isSyneriseSimplePush(payload: object): boolean

Parameters:

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

Return Value:
true if a notification is a Simple Push, otherwise false.

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


This method verifies if a notification’s sender is Synerise and if the notification is a Banner campaign.

Declared In:
lib/main/modules/NotificationsModule.js

Class:
NotificationsModule

Declaration:

public isSyneriseBanner(payload: object): boolean

Parameters:

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

Return Value:
true if a notification is a Banner, otherwise false.

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


This method verifies if a notification’s sender is Synerise and if the notification is a Silent Command.

Declared In:
lib/main/modules/NotificationsModule.js

Class:
NotificationsModule

Declaration:

public isSilentCommand(payload: object): boolean

Parameters:

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

Return Value:
true if a notification is a Silent Command, otherwise false.

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


This method verifies if a notification’s sender is Synerise and if the notification is a Silent SDK Command.

Declared In:
lib/main/modules/NotificationsModule.js

Class:
NotificationsModule

Declaration:

public isSilentSDKCommand(payload: object): boolean

Parameters:

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

Return Value:
true if a notification is a Silent SDK Command, otherwise false.

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


This method verifies if a notification is encrypted.

Declared In:
lib/main/modules/NotificationsModule.js

Class:
NotificationsModule

Declaration:

public isNotificationEncrypted(payload: object): boolean

Parameters:

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

Return Value:
true if a notification is encrypted, otherwise false.

Example:

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

Decrypt push notification


This method decrypts the notification payload.

Note: If the notification is not encrypted, the method returns the raw payload.
Note: Returns nil if the crypter fails while decrypting the payload.

Declared In:
lib/main/modules/NotificationsModule.js

Class:
NotificationsModule

Declaration:

public decryptNotification(payload: object): object | null

Parameters:

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

Return Value:
Notification’s key-value data object with decrypted content

Example:

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

Handle Synerise push notification


This method handles a notification payload and starts activity.

Declared In:
lib/main/modules/NotificationsModule.js

Class:
NotificationsModule

Declaration:

public handleNotification(payload: object, actionIdentifier: string | null)

Parameters:

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

Return Value:
No value is returned.

Example:

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

Get Walkthrough


This method fetches a walkthrough.

Note: The API key must have the CAMPAIGN_BACKEND_CAMPAIGN_READ permission from the Campaign group.

Declared In:
lib/main/modules/InjectorModule.js

Class:
InjectorModule

Declaration:

public getWalkthrough()

Return Value:
No value is returned.

Show Walkthrough


This method shows a walkthrough when it is loaded.

Declared In:
lib/main/modules/InjectorModule.js

Class:
InjectorModule

Declaration:

public showWalkthrough()

Return Value:
No value is returned.

Check if Walkthrough is loaded


This method checks if a walkthrough is loaded.

Declared In:
lib/main/modules/InjectorModule.js

Class:
InjectorModule

Declaration:

public isWalkthroughLoaded(): boolean

Return Value:
true if the walkthrough is loaded, otherwise returns false.

Check if is loaded Walkthrough unique


This method checks if the walkthrough is unique compared to the previous one.

Declared In:
lib/main/modules/InjectorModule.js

Class:
InjectorModule

Declaration:

public isLoadedWalkthroughUnique(): boolean

Return Value:
true if the loaded walkthrough is unique, otherwise returns false.

Removed methods

Fetch Banners


This method fetches banners set for mobile campaigns and caches the valid ones.

Note: This method was removed in SDK version 0.12.0.

Declared In:
lib/main/modules/InjectorModule.js

Class:
InjectorModule

Declaration:

public fetchBanners(onSuccess, onError)

Parameters:

Parameter Type Mandatory Default Description
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Get Banners


This method provides valid banners directly from SDK cache.

Note: This method was removed in SDK version 0.12.0.

Declared In:
lib/main/modules/InjectorModule.js

Class:
InjectorModule

Declaration:

public getBanners()

Return Value:
No value is returned.

Show Banner


This method shows a banner immediately.

Note: This method was removed in SDK version 0.12.0.

Declared In:
lib/main/modules/InjectorModule.js

Class:
InjectorModule

Declaration:

public showBanner(banner: object, markPresented: boolean)

Parameters:

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

Return Value:
No value is returned.

😕

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