SDKs and APIs
53 TopicsStrategy to Identify Duplicate Profiles
We needed to identify and merge duplicate Braze profiles (same email, different user IDs) across our entire user base. We evaluated two solutions. Solution 1: Identify duplicate profiles via /users/export/ids and attach a custom attribute for segmentation Export each profile, identify duplicates externally, then update profiles with a custom attribute is_duplicated=true and capture them via a segment. {% connected_content https://rest.au-01.braze.com/users/export/ids :method post :headers { "Authorization": "Bearer XXXX" } :body {"email_address":"{{${email_address}}}"} :content_type application/json :no_cache :save result %} {% if result.users.size == 1 %} {% abort_message('User is unique.') %} {% endif %} { "attributes" : [ { "braze_id" : "{{${braze_id}}}", "is_duplicated": true, "_update_existing_only" : true } ] } One caveat with this solution is that we need to export the entire user base, and it will take a couple of days to identify the duplicates. Solution 2: Identify the duplicate profiles via a Segment extension Key Assumptions: Every profile in Braze has at least one entry in USERS_BEHAVIORS_SUBSCRIPTION_GLOBALSTATECHANGE_SHARED (i.e., all profiles have a subscription state change event) Every deleted profile appears in USERS_USERDELETEREQUEST_SHARED Here's the query we're using: -- Purpose: Identify duplicate Braze profiles (same email, different user IDs) for merging via /users/merge endpoint -- Excludes deleted/orphaned users and only returns duplicates where 2+ active profiles remain WITH active_users AS ( -- Get unique user/email pairs, excluding deleted/orphaned users SELECT u.USER_ID, u.EMAIL_ADDRESS FROM USERS_BEHAVIORS_SUBSCRIPTION_GLOBALSTATECHANGE_SHARED u LEFT JOIN USERS_USERDELETEREQUEST_SHARED d ON u.USER_ID = d.USER_ID WHERE u.EMAIL_ADDRESS IS NOT NULL AND d.USER_ID IS NULL -- Exclude deleted/orphaned users GROUP BY u.USER_ID, u.EMAIL_ADDRESS -- Dedupe since source table contains multiple events per user ) SELECT DISTINCT a.USER_ID FROM active_users a INNER JOIN ( -- Find emails with more than one active user profile SELECT EMAIL_ADDRESS FROM active_users GROUP BY EMAIL_ADDRESS HAVING COUNT(*) > 1 ) dup ON a.EMAIL_ADDRESS = dup.EMAIL_ADDRESS; Key findings: This query only takes a couple of minutes to identify duplicates USERS_USERDELETEREQUEST_SHARED contains both explicitly deleted users AND users orphaned via /users/merge - this means the query automatically excludes already-merged profiles. Looks like Braze prunes orphaned profiles after /users/merge is performed. Has anyone else taken this approach? Curious if there are edge cases we should watch out for.62Views0likes2CommentsRace Condition Issue between API-trigger and mail execution during Registration
Hello people, I have this interesting case which looking for a proper solution that wont affect the UX during onboarding. When user completes the registration process, we send a service mail with a verification link that users can verify their email addresses. Service mail is set as API-triggered campaign and we have this race problem that sometimes the API call is prior to mail execution which gives an error: "User can't found" Our campaign flow for user creation process on Braze contains 2 steps: 1- API call to create a ghost user (using alias and email address attribute only) to create user profile 2- API call to find the user profile and trigger the email send 3- when user clicks and verify mail --> actual user profile is created with all attributes. 4- API call to merge these user profiles. Between step 1 and 2, API call to find user data for executing email fails. Any user case or solution with this issue above? Support suggesting to add more delay between API calls to not face race condition, however registering a service and wait 3-4 minutes of 1st email for verification is not match with our UX flow. Thanks in advance263Views0likes5Comments5000 product_id limit
Hi all, We are using Braze’s purchase object with dynamic product_id values based on travel routes. The docs mention a 5,000 product_id limit in the dashboard. What happens when this limit is reached? Are older product_ids automatically removed, or will new ones be rejected? Any insights on the behaviour would help us plan product naming better. Thanks!34Views0likes1CommentBraze SDK: Logged Out/In States & Push States
Hey Bonfire! How did your devs configure the Braze SDK behaviour for Logged Out users in cross-device states? There are some concerns at play here and looking to make a call that is future-proof but also not overly complex on handling edge cases. Context: - EU app - Cross-device app and (potentially edge-case) multi-user per device - Team leaning towards not manually updating Push Subscription status to Unsubscribed when users opt-out due to complexity in handling all edge cases and also not wanting to Unsubscribe someone from multiple devices when they only opted-out in one Outstanding question is when a user logs out whether it's best to: 1. Stop the SDK from running altogether to ensure the user is not being tracked by accident while logged out (thinking GDPR/Privacy compliance here); 2. De-register the push token, and re-register later upon new login; 3. Create an anonymous user (which will have the previous push tokens) and later merge the profiles upon new login --> I'm not sure this is possible since the external_id will already be assigned so it's not really anonymous. In short, what is the best practice to ensure that if Logged Out: - No Push Notifications are sent to the device - We can easily recognise and recover the push preference after a re-Login? ... while keeping the config. as simple as possible Thanks!Solved150Views0likes6CommentsHow to tell a recipient's bounce status in an export?
I am using the Braze export API to pull down recently added users, and want to check if any of them are marked as hard bounce, or have already accumulated any soft bounces (and if so, in what time period). Similarly, I'd like to be able to tell if a user has marked as spam. Is there an attribute capturing this information that I'm overlooking? Or is the best/only solution to create segments for those attributes and make multiple requests. Thanks!42Views0likes3CommentsSegment Users with Generalized Interactions
I can see how to segment for Users who have opened an email from or clicked a link in a specific campaign. Is there a way to see Users who have received / clicked for any campaigns, either in general or within a given date range? Thanks!Solved22Views0likes2CommentsExport Email Template rendered for User?
Within Braze's Email Template Preview, you can preview for either a random, specified, or custom user, to see and download the rendered email template. I know about the API endpoint for "See email template information" GET /templates/email/info - however, it only appears to support retrieving the raw template, without a means to render. Is there an API for retrieving a rendered email template; ideally for a specified or customized user? Thanks!Solved52Views0likes1CommentTracking Users' Post Click
Hi Braze Community, I am scratching my head a bit trying to understand how the Braze SDK does not have an out-of-box feature that automatically associates a session with a specific user post email/sms campaign click. From what I am reading, even after having clicked through a campaign, if a user comes in a private browser or is not cookied Braze will not recognize them until they log in or put their email somewhere onsite. This is hugely challenging for us, and I assume others as we want all email/sms traffic post-click automatically identified to help fuel abandonment flows. The only solution that we have found is surfacing the external id in every campaign URL and calling changeuser once they hit the site referencing their external id in the URL to tie their session to the correct profile. Is this truly the only option or am I misinterpreting this workflow? How have others dealt with this issue?115Views0likes5CommentsiOS Braze SDK and Content Card Data Questions
Hello there! Quite a newbie here in Braze Bonfire. Hopefully someone knows something about the question I have: We have an iOS mobile app created using Swift and we are in the process of implementing content cards via Braze SDK. What we noticed is Braze SDK didn't have the content card data on our first call to Braze SDK even when I already called the cancellable stated in this documentation. Only when we do further calls to requestRefresh() it is only then we are able to get content card data. Has anyone experienced this before and is there a way to do it in such a way that when you do a first call to SDK and a first call to requestRefresh() will have the content card data ready for fetching? Thanks!99Views0likes3CommentsNeed to export Opted In date. Any ideas?
Hi all We are linking our Braze instance to some internal tooling and it is a non-negotiable requirement that we share the opted in date for each user we pass, so they know how old the opt in is. I can see the date exists inside Braze but it does not look like the API passes this date. Has anyone had a similar problem or know of a workaround? Thanks!148Views0likes5Comments