This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ignore Braze frequency capping for ent emails
- Loading branch information
1 parent
20d706b
commit 8facf88
Showing
2 changed files
with
11 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
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], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters