Skip to content

feat: Braze SDK integration [GE-107] cp-7.72.0#27881

Merged
Montoya merged 21 commits into
mainfrom
feat/braze-sdk-integration
Mar 31, 2026
Merged

feat: Braze SDK integration [GE-107] cp-7.72.0#27881
Montoya merged 21 commits into
mainfrom
feat/braze-sdk-integration

Conversation

@baptiste-marchand

@baptiste-marchand baptiste-marchand commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Description

This PR is the first part of Braze integration. It's currently only creating Braze users based on their profile id, and registering their FCM/APN tokens to start filling up Braze database with tokens.

Changelog

CHANGELOG entry: Added Braze SDK to enhance push notifications capabilities

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/GE-107

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Adds a new third-party push/engagement SDK and changes native push handling/initialization on both iOS and Android, which could affect notification delivery and app startup. Build tooling changes (Kotlin forcing + patched dependency) also increase risk of platform-specific build regressions.

Overview
Introduces Braze as a new mobile dependency and wires it into both native platforms to start registering push tokens and supporting Braze-driven notifications.

On Android, adds Braze API key/endpoint injection via Gradle resources, registers BrazeFirebaseMessagingService as the primary FCM handler with a fallback to the existing RN Firebase service, and initializes Braze lifecycle callbacks; it also pins Kotlin/serialization versions and patches @braze/react-native-sdk to keep builds compatible with Kotlin 1.9.

On iOS, adds Braze keys to Info.plists and initializes a shared Braze instance in AppDelegate using build-injected credentials, enabling Braze push automation while preserving the existing permission flow.

On the JS side, adds a small app/core/Braze layer plus useBrazeIdentity hooked into useIdentityEffects to call Braze.changeUser(profileId) on sign-in (skipped in E2E), along with Jest mocks/tests and new build/CI env vars for Braze secrets (examples, build.sh, workflow, and config verification).

Written by Cursor Bugbot for commit 29b58cd. This will update automatically on new commits. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@baptiste-marchand baptiste-marchand changed the title feat: Braze SDK integration feat: Braze SDK integration [GE-107] Mar 24, 2026
@socket-security

socket-security Bot commented Mar 24, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​braze/​react-native-sdk@​19.1.01001001009280

View full report

@baptiste-marchand baptiste-marchand force-pushed the feat/braze-sdk-integration branch from 1311099 to a258957 Compare March 26, 2026 15:54
@baptiste-marchand baptiste-marchand marked this pull request as ready for review March 26, 2026 15:58
@baptiste-marchand baptiste-marchand requested review from a team as code owners March 26, 2026 15:58
Comment thread app/core/Braze/useBrazeIdentity.ts
Comment thread ios/MetaMask/AppDelegate.m Outdated
@baptiste-marchand baptiste-marchand added no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed and removed no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed labels Mar 26, 2026
Comment thread app/components/Views/Root/index.tsx Outdated
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 26, 2026
Comment thread android/app/src/main/java/io/metamask/MainApplication.kt

@gantunesr gantunesr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good fro Accounts files. Will approve once it's approved by the author's team

Montoya
Montoya previously approved these changes Mar 26, 2026
@Montoya

Montoya commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Thanks for looking @gantunesr. We actually need a pass from someone on mobile platform, since the Engagement team does not have another mobile engineer to validate.

gantunesr
gantunesr previously approved these changes Mar 26, 2026
@Montoya Montoya enabled auto-merge March 26, 2026 20:16
@Montoya Montoya changed the title feat: Braze SDK integration [GE-107] feat: Braze SDK integration [GE-107] cp-7.72.0 Mar 26, 2026

@joaoloureirop joaoloureirop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How's the app performance with the introduction of this SDK, more specifically the app start times?

I'm looking for these specific measurements to assess the impact:

  • First app cold start. Measure the time it takes to show the onboarding screen.
  • Cold start after wallet import / creation. Measure the time it takes to land on the lockscreen after killing the app.
  • Warm starts. Measure the time it takes to show the app lockscreen after a couple of minutes with the app in the background & the phone with the screen off.

Keep in mind that both platforms need to be tested and that simulators are not accurate when measuring app performance.

Also left two non-blocking comment / questions.

Comment thread app/core/Braze/index.ts Outdated
@baptiste-marchand baptiste-marchand dismissed stale reviews from gantunesr and Montoya via 7554e82 March 27, 2026 08:23
@baptiste-marchand baptiste-marchand requested a review from a team as a code owner March 27, 2026 08:23
@baptiste-marchand baptiste-marchand force-pushed the feat/braze-sdk-integration branch from c523d0e to 71df478 Compare March 30, 2026 09:57
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 30, 2026
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeIdentity, SmokeAccounts, SmokeWalletPlatform
  • Selected Performance tags: @PerformanceLaunch, @PerformanceLogin
  • Risk Level: medium
  • AI Confidence: 78%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR introduces a new Braze SDK integration for push notification/marketing identity management. Key impacts:

  1. useIdentityEffects hook modified: The useBrazeIdentity() hook is now called inside useIdentityEffects, which is used in app/components/Nav/Main/index.js (the main navigation component). This is a critical path change that runs on every app session where a user is signed in.

  2. Identity/sign-in flow: useBrazeIdentity reacts to selectIsSignedIn state changes and calls setBrazeUser() which uses AuthenticationController.getSessionProfile(). This directly touches the identity/authentication pipeline tested by SmokeIdentity.

  3. E2E guard exists: setBrazeUser() has an isE2E guard that skips Braze calls during E2E tests, reducing direct test interference. However, the hook itself still runs and the native SDK is initialized at app startup regardless.

  4. Native SDK initialization: Both iOS (AppDelegate.m) and Android (MainApplication.kt) now initialize the Braze SDK at app startup. This is a new native dependency that could affect app startup behavior.

  5. Account syncing pipeline: Since useIdentityEffects orchestrates account syncing, contact syncing, auto sign-in/out, AND now Braze identity — any regression in this hook could affect SmokeIdentity (account sync, sign-in flows) and SmokeAccounts (multi-SRP, account management).

  6. SmokeWalletPlatform: Selected because multi-SRP architecture and wallet lifecycle are tested here, and the identity effects hook is central to wallet session management.

Tags NOT selected:

  • SmokeConfirmations, SmokeTrade, SmokeNetworkExpansion, etc.: These are not directly affected by Braze identity integration
  • FlaskBuildTests: No Snaps-related changes
  • SmokeRamps, SmokeCard, SmokePerps, SmokePredictions: No direct impact on these trading/financial flows

Performance Test Selection:
The Braze SDK is now initialized at app startup in both iOS AppDelegate and Android MainApplication, adding a new native SDK initialization step to the cold start path. This could impact app launch time (@PerformanceLaunch). Additionally, the useBrazeIdentity hook fires on sign-in state changes, and setBrazeUser() makes an async call to AuthenticationController.getSessionProfile() — this could add latency to the login/unlock flow (@PerformanceLogin). These are the two most directly impacted performance test areas.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
17 value mismatches detected (expected — fixture represents an existing user).
View details

@joaoloureirop joaoloureirop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my performance tests didn't reveal any impact on performance when testing on real Android and iOS devices. For example on Android:

Braze Build (#4421):

* Fresh install until onboarding screen: 4.883s, 4.919s, 5.333s

* Cold start until lock screen : 2.758s

* Warm start until password request: almost instant (can't measure)

RC build (#4415):

* Fresh install until onboarding screen: 5.156s, 4.812s, 5.260s

* Cold start until lock screen : 2.981s

* Warm start until password request: almost instant (can't measure)

The Braze SDK does everything in the background, and isn't doing much for now. There's no UI rendering, nor any UI package installed.

Also, the impact on bundle size seems to be between 1 and 3 MB

Thank you for measuring the app start performance @baptiste-marchand. It does look that Braze SDK does not introduce a lot of overhead to the native modules. That is great to know.

Approved

Comment thread android/app/build.gradle
manifestPlaceholders.MM_BRANCH_KEY_LIVE = "$System.env.MM_BRANCH_KEY_LIVE"

// Braze SDK credentials — names match .android.env / build.sh exports
resValue "string", "com_braze_api_key", "${System.env.MM_BRAZE_API_KEY_ANDROID ?: ''}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the app work with an empty string?

If not we need to update documentation on how to create one to build, but the best path would be this secret not be mandatory

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it works. The consequence is that Braze SDK does nothing

@baptiste-marchand baptiste-marchand removed the request for review from andrepimenta March 30, 2026 21:44

@Cal-L Cal-L left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Montoya Montoya enabled auto-merge March 31, 2026 04:15

@ccharly ccharly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for accounts

@Montoya Montoya added this pull request to the merge queue Mar 31, 2026
Merged via the queue into main with commit 952a1bf Mar 31, 2026
110 checks passed
@Montoya Montoya deleted the feat/braze-sdk-integration branch March 31, 2026 09:00
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 31, 2026
@weitingsun weitingsun added release-7.73.0 Issue or pull request that will be included in release 7.73.0 and removed release-100.10.0 labels Mar 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.73.0 Issue or pull request that will be included in release 7.73.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-M team-engagement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants