Integrating the Braze Roku SDK
Learn how to integrate and customize the Braze Roku SDK. To see our Roku sample app,checkout TorchieTV on GitHub.
Integrating the SDK
Step 1: Add files
Braze SDK files can be found in the sdk_files
directory in the Braze Roku SDK repository.
- Add
BrazeSDK.brs
to your app in thesource
directory. - Add
BrazeTask.brs
andBrazeTask.xml
to your app in thecomponents
directory.
Step 2: Add references
Add a reference to BrazeSDK.brs
in your main scene using the following script
element:
1
<script type="text/brightscript" uri="pkg:/source/BrazeSDK.brs"/>
Step 3: Configure
Within main.brs
, set the Braze configuration on the global node:
1
2
3
4
5
6
7
8
globalNode = screen.getGlobalNode()
config = {}
config_fields = BrazeConstants().BRAZE_CONFIG_FIELDS
config[config_fields.API_KEY] = {YOUR_API_KEY}
' example endpoint: "https://sdk.iad-01.braze.com/"
config[config_fields.ENDPOINT] = {YOUR_ENDPOINT}
config[config_fields.HEARTBEAT_FREQ_IN_SECONDS] = 5
globalNode.addFields({brazeConfig: config})
You can find your SDK endpoint and API key within the Braze dashboard.
Step 4: Initialize Braze
Initialize the Braze instance:
1
2
m.BrazeTask = createObject("roSGNode", "BrazeTask")
m.Braze = getBrazeInstance(m.BrazeTask)
Optional configurations
Logging
To debug your Braze integration, you can view the Roku debug console for Braze logs. Refer to Debugging code from Roku Developers to learn more.
New Stuff!