Skip to content
Menu

Migration

Braze API mapping

Markdown version

Braze SDK calls and the Herald calls that replace them, in Swift and Kotlin, with the calls that have no equivalent.

Use these tables to replace Braze SDK calls with Herald calls during a migration. Every Herald call listed exists in version 0.2.0; full signatures are on iOS API and Android API. Where a Braze call has no equivalent, the table says so.

Herald has no instance to keep: call Herald.shared on iOS and the Herald object on Android.

Swift

AreaBrazeHerald
SetupBraze(configuration: Braze.Configuration(apiKey:endpoint:))Herald.configure(appKey:endpoint:options:)
Setupconfiguration.sessionTimeoutoptions.foregroundSessionTimeout and options.backgroundSessionTimeout
Setupconfiguration.triggerMinimumTimeIntervaloptions.inAppMinimumInterval
Setupconfiguration.logger.leveloptions.logLevel
Identitybraze.changeUser(userId:)identify(userId:traits:)
Identitybraze.set(sdkAuthenticationSignature:)setUserToken(_:)
Identitybraze.user.add(alias:label:)No equivalent
Attributesbraze.user.setCustomAttribute(key:value:)setAttribute(_:_:) or setAttributes(_:)
Attributesbraze.user.set(firstName:) and other standard fieldssetAttribute("first_name", ...) with a key you choose
Attributesbraze.user.set(email:)setEmail(_:)
Attributesbraze.user.set(phoneNumber:)setPhone(_:) (E.164)
Attributesbraze.user.unsetCustomAttribute(key:)setAttribute(key, nil) stores an explicit null
Attributesbraze.user.incrementCustomUserAttribute(key:by:)No equivalent; send the new value
Attributesbraze.user.addToCustomAttributeArray(key:value:)No equivalent; send the full array
Attributesbraze.user.setLastKnownLocation(latitude:longitude:)setLocation(latitude:longitude:)
Subscriptionsbraze.user.set(emailSubscriptionState:)setSubscription(.email, _:)
Subscriptionsbraze.user.set(pushNotificationSubscriptionState:)setSubscription(.push, _:)
Eventsbraze.logCustomEvent(name:properties:)track(_:properties:)
Eventsbraze.logPurchase(productID:currency:price:quantity:properties:)trackPurchase(productId:price:currency:quantity:properties:)
Pushbraze.notifications.register(deviceToken:)setPushToken(_:)
Pushbraze.notifications.handleUserNotification(response:withCompletionHandler:)handleNotificationResponse(_:), then call the completion handler yourself
PushBraze.Notifications.categoriesregisterPushCategories(_:) with your own HeraldPushCategory values
PushBrazeNotificationService.NotificationService subclass in a notification service extensionHeraldNotificationService
Content cardsbraze.contentCards.requestRefresh()refreshContentCards()
Content cardsbraze.contentCards.cardscontentCards.cards
Content cardscard.context?.logImpression()logImpression(card)
Content cardscard.context?.logClick()logClick(card)
Content cardscard.context?.logDismissed()logDismissal(card)
Content cardsBrazeContentCardUI.ViewController(braze:)ContentCardFeed() (SwiftUI)
In-appbraze.inAppMessagePresenter = BrazeInAppMessageUI()Herald.useDefaultInAppUI()
In-appBrazeInAppMessageUIDelegate.inAppMessage(_:displayChoiceForMessage:)InAppMessageDelegate.shouldDisplay(_:)
In-app.now, .reenqueue, .discard.display, .later, .discard
Data controlbraze.enabled = falsesetEnabled(false)
Data controlbraze.wipeData()wipeData()
Data controlbraze.requestImmediateDataFlush()flush()
Sign-outchangeUser to another IDreset() returns the device to anonymous

Kotlin

AreaBrazeHerald
SetupBraze.configure(context, BrazeConfig) or braze.xmlHerald.configure(context, appKey, endpoint, options)
SetupBrazeActivityLifecycleCallbackListenerNot needed; configure registers its own lifecycle callbacks
IdentityBraze.getInstance(context).changeUser(userId)Herald.identify(userId, traits)
IdentitychangeUser(userId, sdkAuthSignature) or setSdkAuthenticationSignature(signature)Herald.identify(userId) then Herald.setUserToken(token)
AttributescurrentUser?.setCustomUserAttribute(key, value)Herald.setAttribute(key, value)
AttributescurrentUser?.setEmail(email)Herald.setEmail(email)
AttributescurrentUser?.setPhoneNumber(phone)Herald.setPhone(phone) (E.164)
AttributescurrentUser?.incrementCustomUserAttribute(key, by)No equivalent; send the new value
AttributescurrentUser?.addToCustomAttributeArray(key, value)No equivalent; send the full list
AttributescurrentUser?.setLastKnownLocation(latitude, longitude, altitude, accuracy)Herald.setLocation(latitude, longitude)
SubscriptionscurrentUser?.setEmailNotificationSubscriptionType(type)Herald.setSubscription(SubscriptionChannel.EMAIL, state)
SubscriptionscurrentUser?.setPushNotificationSubscriptionType(type)Herald.setSubscription(SubscriptionChannel.PUSH, state)
EventslogCustomEvent(name, properties)Herald.track(name, properties)
EventslogPurchase(productId, currencyCode, price, quantity)Herald.trackPurchase(productId, price, currency, quantity)
PushBrazeFirebaseMessagingServiceHeraldMessagingService (registered by herald-fcm)
PushBrazeFirebaseMessagingService.handleBrazeRemoteMessage(context, message)HeraldNotifications.handleRemoteMessage(context, message)
PushregisteredPushToken = tokenHerald.setPushToken(token) (herald-fcm does it for you)
PushNotification open handlingHerald.handleNotificationIntent(intent) in onCreate and onNewIntent
Content cardsrequestContentCardsRefresh()Herald.refreshContentCards()
Content cardssubscribeToContentCardsUpdates(subscriber)Collect Herald.contentCards (a StateFlow)
Content cardscard.logImpression(), card.logClick()Herald.logImpression(card), Herald.logClick(card)
Content cardscard.isDismissed = trueHerald.logDismissal(card)
Content cardsContentCardsFragment or the Compose ContentCardsListContentCardFeed() (Compose)
In-appBrazeInAppMessageManager default displayHeraldInAppPresenter.install()
In-appIInAppMessageManagerListener.beforeInAppMessageDisplayedInAppMessageDelegate.shouldDisplay
In-appDISPLAY_NOW, DISPLAY_LATER, DISCARDDISPLAY, LATER, DISCARD
Data controlBraze.disableSdk(context), Braze.enableSdk(context)Herald.setEnabled(false), Herald.setEnabled(true)
Data controlBraze.wipeData(context)Herald.wipeData()
Data controlrequestImmediateDataFlush()Herald.flush()
Sign-outchangeUser to another IDHerald.reset()

Behavior differences to check

  • Token order. Call identify first, then setUserToken. Identifying a different user clears the previous token.
  • Verification is on by default. A new connection requires a user token for every request that names a user. Plan the backend route before you ship.
  • Push permission. requestPushAuthorization on both platforms shows the prompt and records the subscription, so you do not set the subscription yourself after the prompt.
  • In-app timing. A message that cannot show at once is kept and shown later, and the delegate is asked each time it is about to appear. See Triggers and delivery rules.
  • Properties. iOS properties are HeraldValue literals. Android properties are a Map<String, Any?>.

Next

See Herald decide live →