Skip to content

STRATCONN-5849 - braze_api_campaign #2947

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

monutwilio
Copy link
Contributor

@monutwilio monutwilio commented May 28, 2025

Added a new action Trigger Campaign in Braze destination. Refer this doc for more info.

Testing

  • Added unit tests for new functionality
  • Tested end-to-end using the local server
  • [Segmenters] Tested in the staging environment
  • [Segmenters] [If applicable for this change] Tested for regression with Hadron.

Testing Doc

Copy link
Contributor

github-actions bot commented May 28, 2025

New required fields detected

Warning

Your PR adds new required fields to an existing destination. Adding new required settings/mappings for a destination already in production requires updating existing customer destination configuration. Ignore this warning if this PR is for a new destination with no active customers in production.

The following required fields were added in this PR:

  • Destination: Braze Cloud Mode (Actions), Action Field(s):campaign_id,broadcast,recipients,audience

Add these new fields as optional instead and assume default values in perform or performBatch block.

Copy link

codecov bot commented May 28, 2025

Codecov Report

Attention: Patch coverage is 93.93939% with 2 lines in your changes missing coverage. Please review.

Project coverage is 77.88%. Comparing base (309b309) to head (4db8f49).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...iggerCampaign/functions/dynamic-field-functions.ts 89.47% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2947      +/-   ##
==========================================
+ Coverage   77.83%   77.88%   +0.04%     
==========================================
  Files        1077     1079       +2     
  Lines       19810    19851      +41     
  Branches     3800     3810      +10     
==========================================
+ Hits        15420    15461      +41     
  Misses       3100     3100              
  Partials     1290     1290              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@varadarajan-tw varadarajan-tw left a comment

Choose a reason for hiding this comment

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

Great work! Left a few questions.

Specifically I wonder if object within object and array within objects are rendered correctly in the UI. If not, we should consider extracting them out of recipients

Comment on lines 123 to 129
if (!payload.broadcast && !payload.recipients?.length && !payload.audience) {
throw new IntegrationError(
'One of "recipients", "broadcast" or "audience", must be provided.',
'Missing required fields',
400
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

could we try using conditionally required fields for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added the conditionally required fields, however this check is still required in case the recipients are dynamically picked from the event and turns out to be an empty array (not undefined/null).

}

// Prepare the request body with only defined fields
const requestBody: Record<string, unknown> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

All undefined fields will get removed by the request client when it does JSON.stringify. So, it is not required for us to do this check everytime. If a field doesn't support null, we can mark allowNull as false on the field definition

'@path': '$.userId'
}
},
user_alias: {
Copy link
Contributor

Choose a reason for hiding this comment

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

does this work? I wonder how object within object gets rendered in UI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, we can choose the object from the drop down event properties but can't enter manually though

Screenshot 2025-05-29 at 3 11 56 PM Screenshot 2025-05-29 at 3 12 09 PM

})

// Test with recipients array
it('with recipients array', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

could we extract these tests to a separate file like we do with all other destinations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants