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
  • By Synerise backend, which means that the campaign is retrieved by SDK through API:

    • In-app messages

    You can create each campaign type in the Synerise app. Full documentation is available at this link.

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>>
    }
  }
}
{
  "aps": {
    <<Apple params for iOS notification>>
  },    
  "issuer": "Synerise",
  "message-type": "static-content",
  "content-type": "simple-push",
  "content": {
    <<campaign content>>
  }
}
  • issuer - in Synerise notifications, the issuer is always Synerise. If you want to handle notifications with your own methods, remember to change the issuer field. If issuer is set to Synerise, 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.
Method Description
Synerise.isSyneriseNotification Returns 'true' if the notification comes from Synerise.
It is validated by checking if the issuer of the push is Synerise.
Synerise.isSyneriseSimplePush Checks if the notification payload contains a Simple Push campaign.
Injector.isSyneriseBanner
Synerise.isSilentCommand Checks if the notification payload contains a Silent Command campaign.
Synerise.isSyneriseSilentSDKCommand Checks if the notification payload contains a Silent SDK Command campaign.
Method Description
Synerise.Notificationsl.isSyneriseNotification Returns 'true' if the notification comes from Synerise.
It is validated by checking if the issuer of the push is Synerise.
Synerise.Notificationsl.isSyneriseSimplePush Checks if the notification payload contains a Simple Push campaign.
Injector.isSyneriseBanner
Synerise.Notificationsl.isSyneriseSilentCommand Checks if the notification payload contains a Silent Command campaign.
Synerise.Notificationsl.isSyneriseSilentSDKCommand Checks if the notification payload contains a Silent SDK Command campaign.
Method Description
Synerise.notifications.isSyneriseNotification Returns 'true' if the notification comes from Synerise.
It is validated by checking if the issuer of the push is Synerise.
Synerise.notifications.isSyneriseSimplePush Checks if the notification payload contains a Simple Push campaign.
Synerise.notifications.isSyneriseBanner Checks if the notification payload contains a Banner campaign.
Synerise.notifications.isSilentCommand Checks if the notification payload contains a Silent Command campaign.
Synerise.notifications.isSyneriseSilentSDKCommand Checks if the notification payload contains a Silent SDK Command campaign.

Localizations in campaigns


This feature is currently available only for iOS SDK, React Native (iOS), and Flutter SDK (iOS).

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!"
    ];
    
    SNRSynerise.settings.sdk.localizable = @[
      SNR_LOCALIZABLE_STRING_KEY_OK: @"Go in!",
      SNR_LOCALIZABLE_STRING_KEY_CANCEL: @"Go out!"
    ];
    
    Synerise.Settings.sdk.localizable = {
      LocalizableStringKeyOK: "Go in!",
      LocalizableStringKeyCancel: "Go out!"
    };
    
    Synerise.settings.sdk.localizable = {
      Localizable.localizableStringKeyOk: "Go in!", 
      Localizable.localizableStringKeyCancel: "Go out!"
    };
    

Blocking campaigns


This feature is available only for iOS SDK.

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 {

}
@interface SampleViewController: UIViewController <SNRSyneriseActivityNotAllowed>

@end

When View Controller implements that protocol and Synerise tries to run an activity, the activity is skipped.

Canonical URL: https://hub.synerise.com/developers/mobile-sdk/campaigns/basics