In-App Message Delivery
Our in-app message product allows you to trigger an in-app message display as a result of several different event types:
Push Click. Furthermore,
Specific Purchase and
Custom Event triggers can contain robust property filters.
Triggered in-app messages only work with custom events logged through the SDK and not through the REST APIs. If you’re working with Android, please check out how to log custom events here.
All in-app messages that a user is eligible for are delivered to the user’s device on the session start. For more information about the SDK’s session start semantics, see our session lifecycle documentation. Upon delivery, the SDK will pre-fetch assets so that they are available immediately at trigger time, minimizing display latency.
When a trigger event has more than one eligible in-app message associated with it, only the in-app message with the highest priority will be delivered.
For in-app messages that display immediately on delivery (i.e., session start, push click) there can be some latency due to assets not being prefetched.
Minimum Time Interval Between Triggers
By default, we rate limit in-app messages to once every 30 seconds to ensure a quality user experience.
To override this value, set
com_appboy_trigger_action_minimum_time_interval_seconds in your
appboy.xml. An example can be found in our sample application’s
Server-side Event Triggering
By default, in-app messages are triggered by custom events logged by the SDK. If you would like to trigger in-app messages by server sent events you are also able to achieve this.
To enable this feature, a silent push is sent to the device which allows a custom push receiver to log an SDK based event. This SDK event will subsequently trigger the user-facing in-app message.
Step 1: Register a Custom Broadcast Receiver to Log Custom Event
Register your custom
BroadcastReceiver to listen for a specific silent push within your AndroidManifest.xml. For more information on how to register a custom
BroadcastReceiver please review Braze’s push documentation.
Step 2: Create your BroadcastReceiver
Your receiver will handle the intent broadcast by the silent push and log an SDK event. Starting in SDK 2.0.0, events can be logged in the background without issue. All clients implementing this solution must be on SDK v2.0.0+.
It will subclass
BroadcastReceiver and override
onReceive(). For a detailed example, please see our EventBroadcastReceiver.java in the linked list.
Two events will be logged for the in-app message to be delivered, one by the server and one from within your custom
BroadcastReceiver. To ensure the same event is not duplicated, the event logged from within your
BroadcastReceivershould be given a generic naming convention, for example, “in-app message trigger event,” and not the same name as the server sent event. If this is not done segmentation and user data may be affected by duplicate events being logged for a single user action.
For further details on custom handling push receipts, opens, and key-value pairs please visit this section of our Documentation.
Step 3: Create a Push Campaign
Create a silent push campaign which is triggered via the server sent event. For details on how to create a silent push campaign please review this section of our User Guide.
The push campaign must include key-value pair extras which indicate that this push campaign is sent with the intention to log an SDK custom event. This event will be used to trigger the in-app message.
The EventBroadcastReceiver.java recognizes the key-value pairs and logs the appropriate SDK custom event.
Should you want to include any event properties to attach to your ‘In-App Message Trigger’ event, you can achieve this by passing these in the key-value pairs of the push payload. In the example above the campaign name of the subsequent in-app message has been included. Your custom
BroadcastReceiver can then pass the value as the parameter of the event property when logging the custom event.
Step 4: Create an In-App Message Campaign
Create your user-visible in-app message campaign from within Braze’s dashboard. This campaign should have an Action Based delivery, and be triggered from the custom event logged from within the custom EventBroadcastReceiver.java.
In the example below the specific in-app message to be triggered has been configured by sending the event property as part of the initial silent push.
If a server sent event is logged whilst the app is not in the foreground, the event will log but the in-app message will not be displayed. Should you want the event to be delayed until the application is in the foreground, a check must be included in your custom push receiver to dismiss or delay the event until the app has entered the foreground.
Local In-App Messages
In-app messages can be created within the app and displayed locally in real-time. All customization options available on the dashboard are also available locally. This is particularly useful for displaying messages that you wish to trigger within the app in real-time.
1 2 3 // Initializes a new slideup type in-app message and specifies its message. InAppMessageSlideup inAppMessage = new InAppMessageSlideup(); inAppMessage.setMessage("Welcome to Braze! This is a slideup in-app message.");
1 2 3 // Initializes a new slideup type in-app message and specifies its message. val inAppMessage = InAppMessageSlideup() inAppMessage.message = "Welcome to Braze! This is a slideup in-app message."
Do not display in-app messages when the soft keyboard is displayed on screen, as rendering is undefined in this circumstance.
Manually Triggering In-App Message Display
The following method will manually display your in-app message.
InAppMessageTesterFragment.java in the DroidBoy sample app for example usage.