Campaigns

Set Notification delegate


This method sets an object for simple push campaigns delegate methods.

Declared In:
Headers/SNRSynerise.h

Related To:
NotificationDelegate

Class:
Synerise

Declaration:

static func setNotificationDelegate(_ delegate: NotificationDelegate)

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

Set Walkthrough delegate


This method sets an object for walkthrough campaigns delegate methods.

Declared In:
Headers/SNRInjector.h

Related To:
InjectorWalkthroughDelegate

Class:
Injector

Declaration:

static func setWalkthroughDelegate(_ delegate: InjectorWalkthroughDelegate)

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

Set Banner delegate


This method sets an object for banner campaigns delegate methods.

Declared In:
Headers/SNRInjector.h

Related To:
InjectorBannerDelegate

Class:
Injector

Declaration:

static func setBannerDelegate(_ delegate: InjectorBannerDelegate)

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

Set In-App Message delegate


This method sets an object for in-app message campaigns delegate methods.

Declared In:
Headers/SNRInjector.h

Related To:
InjectorInAppMessageDelegate

Class:
Injector

Declaration:

static func setInAppMessageDelegate(_ delegate: InjectorInAppMessageDelegate)

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

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:
Headers/SNRClient.h

Class:
Client

Declaration:

static func registerForPush(registrationToken: String, mobilePushAgreement: Bool, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters:

Parameter Type Mandatory Default Description
registrationToken String yes - Firebase Token
mobilePushAgreement Bool yes - Agreement (consent) for mobile push campaigns
success ((Bool) -> Void) yes - Closure/Block to be executed when the operation is completed successfully
failure ((ApiError) -> Void) yes - Closure/Block to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
	Client.registerForPush(registrationToken: fcmToken, mobilePushAgreement: true, success: { (_) in
	  // success
	}, failure: { (error) in
	  // failure
	})
}

Register for push notifications without agreement


This method passes the Firebase Token to Synerise for notifications and doesn’t update the agreement of the profile.

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:
Headers/SNRClient.h

Class:
Client

Declaration:

static func registerForPush(registrationToken: String, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters:

Parameter Type Mandatory Default Description
registrationToken String yes - Firebase Token
success ((Bool) -> Void) yes - Closure/Block to be executed when the operation is completed successfully
failure ((ApiError) -> Void) yes - Closure/Block to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
	Client.registerForPush(registrationToken: fcmToken, success: { (_) in
	  // success
	}, failure: { (error) in
	  // failure
	})
}

Check if push notification is from Synerise


This method verifies if a notification was sent by Synerise.

Declared In:
Headers/SNRSynerise.h

Class:
Synerise

Declaration:

static func isSyneriseNotification(_ userInfo: [AnyHashable: Any]) -> Bool

Parameters:

Parameter Type Mandatory Default Description
userInfo [AnyHashable: Any] yes - Key-Value map of data

Return Value:
true if the notification is provided by Synerise, otherwise returns false.

Example:

//MARK: - UNUserNotificationCenterDelegate
extension NotificationService: UNUserNotificationCenterDelegate {
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        let userInfo = response.notification.request.content.userInfolet isSyneriseNotification = Synerise.isSyneriseNotification(userInfo)
        if isSyneriseNotification == true {
            // notification is from Synerise
        }
    }
}

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:
Headers/SNRSynerise.h

Class:
Synerise

Declaration:

static func isSyneriseSimplePush(_ userInfo: [AnyHashable: Any]) -> Bool

Parameters:

Parameter Type Mandatory Default Description
userInfo [AnyHashable: Any] yes - Key-Value map of data

Return Value:
true if the notification is Synerise Simple Push provided by Synerise, otherwise returns false.

Example:

//MARK: - UNUserNotificationCenterDelegateextension NotificationService: UNUserNotificationCenterDelegate {
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        let userInfo = response.notification.request.content.userInfolet isSyneriseNotification = Synerise.isSyneriseNotification(userInfo)
       	if isSyneriseNotification == true {
			// notification is from Synerise			let isSyneriseSimplePush = Synerise.isSyneriseSimplePush(userInfo)
			if isSyneriseSimplePush == true {
				// notification is Synerise Simple Push Campaign
			}
		}
    }
}

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:
Headers/SNRSynerise.h

Class:
Synerise

Declaration:

static func isSyneriseBanner(_ userInfo: [AnyHashable: Any]) -> Bool

Parameters:

Parameter Type Mandatory Default Description
userInfo [AnyHashable: Any] yes - Key-Value map of data

Return Value:
true if the notification is Synerise Banner provided by Synerise, otherwise returns false.

Example:

//MARK: - UNUserNotificationCenterDelegateextension NotificationService: UNUserNotificationCenterDelegate {
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        let userInfo = response.notification.request.content.userInfolet isSyneriseNotification = Synerise.isSyneriseNotification(userInfo)
       	if isSyneriseNotification == true {
			// notification is from Synerise			let isSyneriseBanner = Synerise.isSyneriseBanner(userInfo)
			if isSyneriseBanner == true {
				// notification is Synerise Banner Campaign
			}
		}
    }
}

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:
Headers/SNRSynerise.h

Class:
Synerise

Declaration:

static func isSyneriseSilentCommand(_ userInfo: [AnyHashable: Any]) -> Bool

Parameters:

Parameter Type Mandatory Default Description
userInfo [AnyHashable: Any] yes - Key-Value map of data

Return Value:
true if the notification is Synerise Silent Command provided by Synerise, otherwise returns false.

Example:

//MARK: - UNUserNotificationCenterDelegateextension NotificationService: UNUserNotificationCenterDelegate {
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        let userInfo = response.notification.request.content.userInfolet isSyneriseNotification = Synerise.isSyneriseNotification(userInfo)
       	if isSyneriseNotification == true {
			// notification is from Synerise			let isSyneriseSilentCommand = Synerise.isSyneriseSilentCommand(userInfo)
			if isSyneriseSilentCommand == true {
				// notification is Synerise Silent Command
			}
		}
    }
}

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:
Headers/SNRSynerise.h

Class:
Synerise

Declaration:

static func isSyneriseSilentSDKCommand(_ userInfo: [AnyHashable: Any]) -> Bool

Parameters:

Parameter Type Mandatory Default Description
userInfo [AnyHashable: Any] yes - Key-Value map of data

Return Value:
true if the notification is Synerise Silent SDK Command provided by Synerise, otherwise returns false.

Example:

//MARK: - UNUserNotificationCenterDelegate
extension NotificationService: UNUserNotificationCenterDelegate {
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        let userInfo = response.notification.request.content.userInfo
        let isSyneriseNotification = Synerise.isSyneriseNotification(userInfo)
       	if isSyneriseNotification == true {
			// notification is from Synerise			let isSyneriseSilentSDKCommand = Synerise.isSyneriseSilentSDKCommand(userInfo)
			if isSyneriseSilentSDKCommand == true {
				// notification is Synerise Silent SDK Command
			}
		}
    }
}

Check if push notification is encrypted


This method verifies if a notification is encrypted.

Declared In:
Headers/SNRSynerise.h

Class:
Synerise

Declaration:

static func isNotificationEncrypted(_ userInfo: [AnyHashable: Any]) -> Bool

Parameters:

Parameter Type Mandatory Default Description
userInfo [AnyHashable: Any] yes - Key-Value map of data

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

Example:

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
	let isSyneriseNotification = Synerise.isSyneriseNotification(userInfo)
	if isSyneriseNotification == false {
		let isNotificationEncrypted = Synerise.isNotificationEncrypted(userInfo)
		if isNotificationEncrypted == true {
			// Notification is encrypted by Synerise
		}
	}
	//...
}

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:
Headers/SNRSynerise.h

Class:
Synerise

Declaration:

static func decryptNotification(_ userInfo: [AnyHashable: Any]) -> Void

Parameters:

Parameter Type Mandatory Default Description
userInfo [AnyHashable: Any] yes - Key-Value map of data

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

Example:

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
	let isSyneriseNotification = Synerise.isSyneriseNotification(userInfo)
	if isSyneriseNotification == false {
		let isNotificationEncrypted = Synerise.isNotificationEncrypted(userInfo)
		if isNotificationEncrypted == true {
			// Notification is encrypted by Synerise
			if let userDataDecrypted = Synerise.decryptNotification(userInfo) {
				// Notification decryption process was successful
			}
		}
	}
	//...
}

Handle Synerise push notification


This method handles a notification payload and starts activity.

Declared In:
Headers/SNRSynerise.h

Class:
Synerise

Declaration:

static func handleNotification(_ userInfo: [AnyHashable: Any]) -> Void

Parameters:

Parameter Type Mandatory Default Description
userInfo [AnyHashable: Any] yes - Key-Value map of data

Return Value:
No value is returned.

Example:

//MARK: - UNUserNotificationCenterDelegate
extension NotificationService: UNUserNotificationCenterDelegate {
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        let userInfo = response.notification.request.content.userInfo
        let isSyneriseNotification = Synerise.isSyneriseNotification(userInfo)
       	if isSyneriseNotification == true {
			// notification is from Synerise			Synerise.handleNotification(userInfo)
		}
    }
}

Handle Synerise push notification with action


This method handles a notification payload with a user interaction and starts activity.

Declared In:
Headers/SNRSynerise.h

Class:
Synerise

Declaration:

static func handleNotification(_ userInfo: [AnyHashable: Any], actionIdentifier: String?) -> Void

Parameters:

Parameter Type Mandatory Default Description
userInfo [AnyHashable: Any] yes - Key-Value map of data
actionIdentifier String no - Identifier of action received from the notification response

Return Value:
No value is returned.

Example:

//MARK: - UNUserNotificationCenterDelegate
extension NotificationService: UNUserNotificationCenterDelegate {
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        let userInfo = response.notification.request.content.userInfolet actionIdentifier = response.actionIdentifier
        let isSyneriseNotification = Synerise.isSyneriseNotification(userInfo)
       	if isSyneriseNotification == true {
			// notification is from Synerise			Synerise.handleNotification(userInfo, actionIdentifier: actionIdentifier)
		}
    }
}

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:
Headers/SNRInjector.h

Class:
Injector

Declaration:

static func getWalkthrough() -> Void

Return Value:
No value is returned.

Show Walkthrough


This method shows a walkthrough when it is loaded.

Declared In:
Headers/SNRInjector.h

Class:
Injector

Declaration:

static func showWalkthrough() -> Void

Return Value:
No value is returned.

Check if Walkthrough is loaded


This method checks if a walkthrough is loaded.

Declared In:
Headers/SNRInjector.h

Class:
Injector

Declaration:

static func isWalkthroughLoaded() -> Bool

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:
Headers/SNRInjector.h

Class:
Injector

Declaration:

static func isLoadedWalkthroughUnique() -> Bool

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

Get pushes


This method fetches Push Notifications set for mobile campaigns.

Note: The API key must have the CAMPAIGN_BACKEND_COLLECTOR_READ permission from the Collector group.

Declared In:
Headers/SNRInjector.h

Class:
Injector

Declaration:

static func getPushes(success: (([[AnyHashable: Any]]) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters:

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

Return Value:
No value is returned.

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 4.6.0.

Declared In:
Headers/SNRInjector.h

Class:
Injector

Declaration:

static func fetchBanners(success: (([[AnyHashable: Any]]) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters:

Parameter Type Mandatory Default Description
success (([[AnyHashable: Any]]) -> Void) yes - Closure/Block to be executed when the operation is completed successfully
failure ((ApiError) -> Void) yes - Closure/Block 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 4.6.0.

Declared In:
Headers/SNRInjector.h

Class:
Injector

Declaration:

static func getBanners() -> [[AnyHashable: Any]]

Return Value:
List of structures that represents cached Banners.

Show Banner


This method shows a banner immediately.

Note: This method was removed in SDK version 4.6.0.

Declared In:
Headers/SNRInjector.h

Class:
Injector

Declaration:

static func showBanner(_: [AnyHashable: Any], markPresented: Bool) -> Void

Parameters:

Parameter Type Mandatory Default Description
bannerDictionary [AnyHashable: Any] yes - Dictionary representation of a banner
markPresented Bool 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