Basics
Prerequisites
Only for campaigns served by push notifications: Configure push notifications.
Overview
Synerise campaigns are served in two ways:
-
By Push Notifications, which means that the campaigns are delivered as a push notification:
- Simple push
- Silent push
- Banner
- Mandatory upgrade
- First run message
-
By Synerise backend, which means that the campaign is retrieved by SDK through API:
- In-app messages
- Walkthrough
Synerise push notification structure
Each notification follows this basic structure corresponding to the operating system:
{
"data": {
"issuer": "Synerise",
"message-type": "static-content",
"content-type": "simple-push",
"content": {
<<campaign content>>
}
}
}
issuer
- in Synerise notifications, the issuer is alwaysSynerise
. If you want to handle notifications with your own methods, remember to change theissuer
field. Ifissuer
is set toSynerise
, the payload is always handled by the Synerise SDK.message-type
- specifies if the content is static or dynamic.content-type
- specifies the type of content in the payload.content
- the content of the message.
You can also react to Synerise push notifications in your own way, using the payloads presented earlier in this article.
Checking push campaign type
You may need to know whether an incoming push notification comes from Synerise.
Method | Description |
---|---|
Injector.isSynerisePush |
Returns ’true’ if the notification comes from Synerise. It is validated by checking if the issuer of the push is Synerise . |
Injector.isSyneriseSimplePush |
Checks if the notification payload contains a Simple Push campaign. |
Injector.isSyneriseBanner |
Checks if the notification payload contains a Banner campaign. |
Injector.isSyneriseSilentCommand |
Checks if the notification payload contains a Silent Command campaign. |
Injector.isSilentSdkCommand |
Checks if the notification payload contains a Silent SDK Command campaign. |
Localizations in campaigns
You may set your localization to support different languages in your application - see “Localize some strings occurring in the SDK” in the SDK Settings.
Available keys:
- CTA button in the in-app alert of the Simple Push campaign.
- dismiss button in the in-app alert of the Simple Push campaign.
Synerise.settings.sdk.localizable = [
SNR_LOCALIZABLE_STRING_KEY_OK: "Go in!",
SNR_LOCALIZABLE_STRING_KEY_CANCEL: "Go out!"
];
Blocking campaigns
If you don’t want to show any of the Synerise campaigns somewhere in your application or if there are View Controllers that should never be covered by Synerise activity (for example, banners), you can block the Synerise elements.
To do this, add the SyneriseActivityNotAllowed protocol in your View Controller declaration.
For example:
class SampleViewController: UIViewController, SyneriseActivityNotAllowed {
}
When View Controller implements that protocol and Synerise tries to run an activity, the activity is skipped.