Skip to content

Commit

Permalink
feat: AA-1127: Adds ability to override Braze frequency caps when sen…
Browse files Browse the repository at this point in the history
…ding emails (#123)

Braze API based campaigns are still subject to the global capping
rules defined in Braze. In order to get around this, you can specifically state
the email will override those rules. Now edx-ace supports that capability.
  • Loading branch information
Dillon-Dumesnil authored Dec 6, 2021
1 parent bd77478 commit 462483a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ Change Log
Unreleased
~~~~~~~~~~

[1.4.1] - 2021-12-06
~~~~~~~~~~~~~~~~~~~~

* Adds in the ability to override frequency caps for Braze emails. Can be accessed via
Message options using the key ``override_frequency_capping``. All emails containing the
``transactional`` Message option will also override frequency caps.

[1.4.0] - 2021-11-08
~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion edx_ace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .recipient import Recipient
from .recipient_resolver import RecipientResolver

__version__ = '1.4.0'
__version__ = '1.4.1'

default_app_config = 'edx_ace.apps.EdxAceConfig'

Expand Down
2 changes: 2 additions & 0 deletions edx_ace/channel/braze.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def deliver(self, message, rendered_message):
return

transactional = message.options.get('transactional', False)
override_frequency_capping = message.options.get('override_frequency_capping', transactional)
body_html = self.make_simple_html_template(rendered_message.head_html, rendered_message.body_html)

# Allow our settings to override the from address, because Braze requires specific configured from addresses,
Expand All @@ -141,6 +142,7 @@ def deliver(self, message, rendered_message):
'external_user_ids': [str(message.recipient.lms_user_id)],
'recipient_subscription_state': 'all' if transactional else 'subscribed',
'campaign_id': self._campaign_id(message.name),
'override_frequency_capping': override_frequency_capping,
'messages': {
'email': {
'app_id': getattr(settings, self._APP_ID_SETTING),
Expand Down
2 changes: 2 additions & 0 deletions edx_ace/tests/channel/test_braze.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def test_happy_path(self):
'external_user_ids': ['123'],
'recipient_subscription_state': 'subscribed',
'campaign_id': None,
'override_frequency_capping': False,
'messages': {
'email': {
'app_id': 'test-app-id',
Expand Down Expand Up @@ -116,6 +117,7 @@ def test_transactional(self):
"""Transactional emails have different subscriber settings"""
mock_post = self.deliver_email(options={'transactional': True})
assert mock_post.call_args[1]['json']['recipient_subscription_state'] == 'all'
assert mock_post.call_args[1]['json']['override_frequency_capping']

def test_get_action_links_omit_unsubscribe_link(self):
"""Some emails use a setting that omits the unsubscribe action link"""
Expand Down

0 comments on commit 462483a

Please sign in to comment.