Campaigns

Register for Push Notifications


Registers the customer for Push Notifications.

Declared In

SNRClient.h

Class Name

Client

Method Name

registerForPush(registrationToken:mobilePushAgreement:success:failure:)

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 finishes successfully
failure ((ApiError) -> Void) yes - Closure/Block to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

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


Checks if a notification’s sender is Synerise.

Declared In

SNRSynerise.h

Class Name

Synerise

Method Name

isSyneriseNotification(_:)

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.

Examples

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


Checks if a notification’s sender is Synerise and its kind is Simple Push.

Declared In

SNRSynerise.h

Class Name

Synerise

Method Name

isSyneriseSimplePush(_:)

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.

Examples

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


Checks if a notification’s sender is Synerise and its kind is Banner.

Declared In

SNRSynerise.h

Class Name

Synerise

Method Name

isSyneriseBanner(_:)

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.

Examples

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


Checks if a notification’s sender is Synerise and its kind is Silent Command.

Declared In

SNRSynerise.h

Class Name

Synerise

Method Name

isSyneriseSilentCommand(_:)

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.

Examples

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


Checks if a notification’s sender is Synerise and its kind is Silent SDK Command.

Declared In

SNRSynerise.h

Class Name

Synerise

Method Name

isSyneriseSilentSDKCommand(_:)

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.

Examples

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


Checks if the notification payload is encrypted by Synerise.

Declared In

SNRSynerise.h

Class Name

Synerise

Method Name

isNotificationEncrypted(_:)

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

There is no return value.

Examples

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


Decrypts a notification payload.

Note: If the notification is not encrypted, the method returns the raw payload.
Note:

If the notification is not decrypted successfully, the method returns nil.

Note:

Declared In

SNRSynerise.h

Class Name

Synerise

Method Name

decryptNotification(_:)

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

There is no return value.

Examples

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


Handles a notification payload and starts activity.

Declared In

SNRSynerise.h

Class Name

Synerise

Method Name

handleNotification(_:)

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

There is no return value.

Examples

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


Handles a notification payload with an action and starts activity.

Declared In

SNRSynerise.h

Class Name

Synerise

Method Name

handleNotification(_:actionIdentifier:)

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

There is no return value.

Examples

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


Fetches a walkthrough.

Declared In

SNRInjector.h

Class Name

Injector

Method Name

getWalkthrough()

Declaration

static func getWalkthrough() -> Void

Return Value

There is no return value.

Show Walkthrough


Shows a walkthrough when it is loaded.

Declared In

SNRInjector.h

Class Name

Injector

Method Name

showWalkthrough()

Declaration

static func showWalkthrough() -> Void

Return Value

There is no return value.

Check if Walkthrough is loaded


Checks if a walkthrough is loaded.

Declared In

SNRInjector.h

Class Name

Injector

Method Name

isWalkthroughLoaded

Declaration

static func isWalkthroughLoaded() -> Bool

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

SNRInjector.h

Class Name

Injector

Method Name

isLoadedWalkthroughUnique()

Declaration

static func isLoadedWalkthroughUnique() -> Bool

Return Value

true if the walkthrough is unique, otherwise returns false.

Fetch Banners


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

Note: This method was removed in SDK version 4.6.0.

Declared In

SNRInjector.h

Class Name

Injector

Method Name

fetchBanners(success:failure:)

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

Note: This method was removed in SDK version 4.6.0.

Declared In

SNRInjector.h

Class Name

Injector

Method Name

getBanners()

Declaration

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

Return Value

List of structures that represents cached Banners.

Show Banner


Shows a banner immediately.

Note: This method was removed in SDK version 4.6.0.

Declared In

SNRInjector.h

Class Name

Injector

Method Name

showBanner(_:markPresented:)

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

There is no return value.

Get pushes


Fetches Push Notifications set for mobile campaigns.

Declared In

SNRInjector.h

Class Name

Injector

Method Name

getPushes(success:failure:)

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 finishes successfully
failure ((ApiError) -> Void) yes - Closure/Block to be executed when the operation finishes unsuccessfully

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