Skip to content

In-app message integration

This implementation guide covers in-app message code considerations and accompanying code snippets. While we provide sample integration code, you will need to add logic to handle and display triggered messages within your desired UI.

Because your code will be unique to your app, you do not need to handle all situations listed if not relevant to your use case. For example, if you don’t use delayed display of in-app messages, you will not need to implement that logic and edge cases.

SDK requirements

In-app messages will only be sent to Roku devices running the minimum supported SDK version:

In-app message setup

To process in-app messages, you can add an observer on BrazeTask.BrazeInAppMessage:

1
m.BrazeTask.observeField("BrazeInAppMessage", "onInAppMessageReceived")

Then within your handler, you have access to the highest in-app message that your campaigns have triggered:

1
2
3
4
sub onInAppMessageReceived()
  in_app_message = m.BrazeTask.BrazeInAppMessage
  ...
end sub

In-app message fields

The following lists the fields you will need to handle your in-app messages:

Styling fields

There are also various styling fields that you could choose to use from the dashboard:

Alternatively, you could implement the in-app message and style it within your Roku application using a standard palette:

Button fields

Handling interactions

You will need to make sure certain functions are called to handle the analytics for your campaign.

When a message is displayed

When a message is displayed or seen, log an impression:

1
LogInAppMessageImpression(in_app_message.id, brazetask)
When a user clicks on a message

Once a user clicks on the message, log a click and then process in_app_message.click_action:

1
LogInAppMessageClick(in_app_message.id, brazetask)
When a user clicks a button

If the user clicks on a button, log the button click and then process inappmessage.buttons[selected].click_action:

1
LogInAppMessageButtonClick(inappmessage.id, inappmessage.buttons[selected].id, brazetask)
After processing an in-app message

After processing an in-app message, you should clear the field:

1
m.BrazeTask.BrazeInAppMessage = invalid
HOW HELPFUL WAS THIS PAGE?
New Stuff!