In-app message

Overview


In-app message is a banner that can be displayed when your app is running. It may have various layout variants, because it is fully customizable by HTML. The campaign is triggered and displayed depending on the configuration settings.

Read more about creating in-app messages here.

WARNING: Due to operating system differences and web engines, in-app message appearance may differ between systems or not be as expected. You should test your in-app messages.
Note: In-app messages respect safe area on iOS and display cutouts on Android.

Requirements

  • Recommended Mobile SDK version:
    • Android - 5.3.0 or newer
    • iOS - 4.12.0 or newer
    • React Native - 0.12.0 or newer
    • Flutter - 0.5.0 or newer
  • Android only: If you want to use custom fonts in in-app communication, the server that hosts the custom fonts must have the Access-Control-Allow-Origin header configured for font access.
    This is because of the CORS requirements of Android WebViews. You can learn more in MDN Web Docs and in the documentation of your server software.
  • Enable the IN_APP_DEFINITIONS_COMMUNICATION_READ (Communication) permission in the Profile (formerly Client) API key used by the mobile application so the mobile application can fetch in-app messages.
    The API key permission matrix with the in-app permission
    The API key permission matrix with the in-app permission

Configuration


In-app message campaigns are served by the Synerise backend.

Check possible available configuration options in the Settings.

Events generated by in-app messaging


For information about events generated by in-app messaging, see the event reference.

Note: You can disable sending the inApp.capping event in the SDK Settings - Enable/disable sending in-app capping event.

Setting up a global control group for in-app message


For information about global control groups in in-app messages, see the global control group article.

Handling actions from in-app messages


Handling main actions from campaigns depends on the campaign type and operating system and it is described here.

Controlling behavior and actions


You may control an incoming in-app message and decide whether to show it (the display of in-app message can be triggered by occurrence of specific events). By default, the SDK allows in-app message display.

The user interface allows selecting up to 3 trigger events, however, in Android, only for 5.8.1 SDK version (released on 28.08.2023) or higher all triggers are considered altogether. For older SDK versions in Android, only the last event from the trigger list will be considered.
These limitations don’t apply in iOS.

Also, you can be notified (in the form of events) about the campaign actions in the following cases:

  • When the in-app message is presented.
  • When the in-app message disappeared.
  • When additional context is needed to render the campaign.
  • When the customer invoked an action.

You can handle the message using:

See the following code samples:

public static OnInAppListener NULL = new OnInAppListener() {
  // This method is called after an in-app message is loaded and Synerise SDK asks for permission to show it.
  @Override
  public boolean shouldShow(InAppMessageData inAppMessageData) {
    return true;
  }

  // This method is called after an in-app message appears.
  @Override
  public void onShown(InAppMessageData inAppMessageData) {
    //...  
  }

  // This method is called after an in-app message disappears.
  @Override
  public void onDismissed(InAppMessageData inAppMessageData) {
    //...
  }

  // This method is called when a individual context for an in-app message is needed.
  @Override
  public HashMap<String, Object> onContextFromAppRequired(InAppMessageData inAppMessageData) {
    return new HashMap<>();
  }

  // This method is called when the SRInApp.openUrl(url) method is used in an in-app message.
  @Override
  public void onHandledOpenUrl(InAppMessageData inAppMessageData) {
    //...
  }

  // This method is called when the SRInApp.openDeeplink(url) method is used in an in-app message.
  @Override
  public void onHandledOpenDeepLink(InAppMessageData inAppMessageData) {
    //...
  }

  // This method is called when the
  // SRInApp.handleCustomAction(name, params) method is used in an in-app message.
  @Override
  public void onCustomAction(String identifier, HashMap<String, Object> params, InAppMessageData inAppMessageData) {
    //...
  }
};

Example


This is an in-app message campaign example with full screen presentation.

In-app message campaign example
In-app message campaign (Android)
In-app message campaign example
In-app message campaign (iOS)
😕

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