-
Notifications
You must be signed in to change notification settings - Fork 35
fix: ignore Braze frequency capping for ent emails #157
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -300,6 +300,11 @@ def send_message( # pylint: disable=dangerous-default-value | |
): | ||
""" | ||
Sends the message via Braze Rest API /messages/send | ||
The "override_frequency_capping" key in the request payload is important; | ||
it tells Braze to ignore the global campaign message frequency cap | ||
for the message we're sending in this method. Since this is a transactional | ||
message, we'd like the recipient to receive it regardless of what/how-many | ||
other campaign messages they have received. | ||
|
||
Arguments: | ||
email_ids (list): e.g. ['[email protected]', '[email protected]'] | ||
|
@@ -318,6 +323,7 @@ def send_message( # pylint: disable=dangerous-default-value | |
{ | ||
"external_user_ids": [ "[email protected]", "[email protected]" ], | ||
"campaign_id": "some-campaign-identifier", | ||
"override_frequency_capping": true, | ||
"messages": { | ||
"email": { | ||
"app_id": "99999999-9999-9999-9999-999999999999", | ||
|
@@ -374,12 +380,15 @@ def send_message( # pylint: disable=dangerous-default-value | |
message = { | ||
'user_aliases': user_aliases, | ||
'external_user_ids': external_ids, | ||
'campaign_id': campaign_id, | ||
'recipient_subscription_state': 'all', | ||
'messages': { | ||
'email': email | ||
} | ||
} | ||
if campaign_id: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might not matter in the context of ecommerce-worker since all messages are probably transactional, but should override_frequency_capping be passed in rather than rely on the existence of campaign_id? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, IDK. To me, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually, I guess the docstring already states this pretty clearly. |
||
message['campaign_id'] = campaign_id | ||
message['override_frequency_capping'] = True | ||
|
||
# Scrub the app_id from the log message | ||
cleaned_message = copy.deepcopy(message) | ||
cleaned_app_id = '{}...{}'.format(cleaned_message['messages']['email']['app_id'][0:4], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: an extra space here