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.
Close In-App message
Closes an in-app message and sends an inApp.discard event. This is useful for closing a message from another place in the app, for example to close a bottom or top bar message from another place on the screen.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Introduced in: | 5.7.0 | 6.7.0 | 1.5.0 | 2.5.0 |
Declared In:
lib/main/modules/InjectorModule.js
Class:
InjectorModule
Declaration:
public closeInAppMessage(campaignHash: string)Parameters:
| Parameter | Type | Mandatory | Default | Description |
|---|---|---|---|---|
| campaignHash | string | yes | - | Unique identifier of the in-app campaign |
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.
- You should call this method every time the user changes the system or application consent for notifications.
- The API key must have the
API_PERSONAL_DEVICE_CLIENT_UPDATEpermission from the Client group. - 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): booleanParameters:
| 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): booleanParameters:
| 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 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): booleanParameters:
| 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): booleanParameters:
| 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): booleanParameters:
| 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.
Declared In:
lib/main/modules/NotificationsModule.js
Class:
NotificationsModule
Declaration:
public decryptNotification(payload: object): object | nullParameters:
| 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
});
Removed 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.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Removed in: | 5.0.0 | 6.0.0 | 1.0.0 | n/a |
Declared In:
lib/main/modules/NotificationsModule.js
Class:
NotificationsModule
Declaration:
public isSyneriseBanner(payload: object): booleanParameters:
| 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
});
Fetch Banners
This method fetches banners set for mobile campaigns and caches the valid ones.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Removed in: | 4.6.0 | 4.7.0 | 0.12.0 | n/a |
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.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Removed in: | 4.6.0 | 4.7.0 | 0.12.0 | n/a |
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.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Removed in: | 4.6.0 | 4.7.0 | 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.
Get Walkthrough
This method fetches a walkthrough.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Removed in: | 5.0.0 | 6.0.0 | 1.0.0 | 2.0.0 |
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.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Removed in: | 5.0.0 | 6.0.0 | 1.0.0 | 2.0.0 |
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.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Removed in: | 5.0.0 | 6.0.0 | 1.0.0 | 2.0.0 |
Declared In:
lib/main/modules/InjectorModule.js
Class:
InjectorModule
Declaration:
public isWalkthroughLoaded(): booleanReturn 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.
| iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
|---|---|---|---|---|
| Removed in: | 5.0.0 | 6.0.0 | 1.0.0 | 2.0.0 |
Declared In:
lib/main/modules/InjectorModule.js
Class:
InjectorModule
Declaration:
public isLoadedWalkthroughUnique(): booleanReturn Value:
true if the loaded walkthrough is unique, otherwise returns false.