In-App Messaging
In-App Message Types
There are four types of in-app messages: slideup, modal, full, and custom HTML. All in-app messages implement Appboy.Models.IInAppMessage.cs
, and modal and full in-app messages additionally implement Appboy.Models.IInAppMessageImmersive.cs
. These interfaces provide ways in which you can interact with or customize Braze’s in-app messages.
For more information, see Appboy.Models.InAppMessageBase
and Appboy.Models.InAppMessageImmersiveBase
.
Customization
Custom in-app messages can be handled in Unity via Braze’s InAppMessage models.
Logging Clicks and Impressions
In-App Message Body
Clicks and impressions must be manually logged for in-app messages handled in Unity. You can use the LogClicked()
and LogImpression()
methods defined in Appboy.Models.IInAppMessage
.
In-App Message Buttons
Button clicks can be logged by calling the LogButtonClicked(buttonID(int))
method in Appboy.Models.IInAppMessageImmersive
. The ButtonID
can be retrieved from Appboy.Models.InAppMessageButton
.
For more information, refer to Appboy.Models.InAppMessageImmersiveBase
.
Customizing Display Behavior
Dismissal Behavior
You can customize in-app message dismissal behavior by setting the in-app message’s InAppDismissType
property to either DismissType.AUTO_DISMISS
or DismissType.SWIPE
.
For more information, see Appboy.Models.InAppMessage.IInAppMessage
and Appboy.Models.DismissType
.
Slideup Behavior
For slideup in-app messages, you can set in-app messages to slide from the top or bottom by setting the in-app message’s SlideupAnchor
property to SlideFrom.TOP
or SlideFrom.BOTTOM
.
For more information, see Appboy.Models.InAppMessage.InAppMessageSlideup
and Appboy.Models.SlideFrom
.
Customizing Click Behavior
In-App Messages
To set the in-app click action, you can call SetInAppClickAction()
and pass in ClickAction.NEWS_FEED
or ClickAction.NONE
, which will redirect to the News Feed or do nothing, respectively.
Alternatively, you can set the click action to redirect to a URI by calling
1
SetInAppClickAction(ClickAction.URI, "https://www.braze.com");
For more information, see Appboy.Models.InAppMessage.IInAppMessage
and Appboy.Models.ClickAction
.
In-App Message Buttons
You can also set the click action on an in-app message button via the SetButtonClickAction()
methods on Appboy.Models.InAppMessageButton
:
1
2
3
SetButtonClickAction(ClickAction.NEWS_FEED);
SetButtonClickAction(ClickAction.URI, "https://www.braze.com");
Customizing Appearance
Custom in-app messages should be handled in Unity, using Braze’s in-app message models.
Sample Code
For sample implementation code, refer to the InAppMessageReceivedCallback()
method in BrazeBindingTester.cs.