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.
feat: Include a Braze campaign id in code/offer emails.
- Loading branch information
1 parent
a37ae9c
commit c0eef8e
Showing
5 changed files
with
39 additions
and
9 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 |
---|---|---|
|
@@ -85,6 +85,10 @@ | |
'CAMPAIGN_SEND_ENDPOINT': '/campaigns/trigger/send', | ||
'FROM_EMAIL': '<[email protected]>', | ||
'ENTERPRISE_CAMPAIGN_ID': '', | ||
'ENTERPRISE_CODE_ASSIGNMENT_CAMPAIGN_ID': '', | ||
'ENTERPRISE_CODE_UPDATE_CAMPAIGN_ID': '', | ||
'ENTERPRISE_CODE_USAGE_CAMPAIGN_ID': '', | ||
'ENTERPRISE_CODE_NUDGE_CAMPAIGN_ID': '', | ||
# Retry settings for Braze celery tasks | ||
'BRAZE_RETRY_SECONDS': 3600, | ||
'BRAZE_RETRY_ATTEMPTS': 6, | ||
|
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 |
---|---|---|
|
@@ -295,6 +295,7 @@ def send_message( # pylint: disable=dangerous-default-value | |
sender_alias='EdX Support Team', | ||
reply_to='', | ||
attachments=[], | ||
campaign_id='', | ||
): | ||
""" | ||
Sends the message via Braze Rest API /messages/send | ||
|
@@ -306,13 +307,15 @@ def send_message( # pylint: disable=dangerous-default-value | |
sender_alias (str): sender alias for email e.g. edX Support Team | ||
reply_to (str): Enterprise Customer reply to address for email reply | ||
attachments (list): list of dicts with filename and url keys | ||
campaign_id (str): The id of the campaign this email is associated with | ||
Request message format: | ||
Content-Type: application/json | ||
Authorization: Bearer {{api_key}} | ||
Body: | ||
{ | ||
"external_user_ids": [ "[email protected]", "[email protected]" ], | ||
"campaign_id": "some-campaign-identifier", | ||
"messages": { | ||
"email": { | ||
"app_id": "99999999-9999-9999-9999-999999999999", | ||
|
@@ -366,6 +369,7 @@ 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 | ||
|
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
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 |
---|---|---|
|
@@ -50,6 +50,10 @@ class SendEmailsViaBrazeTests(TestCase): | |
'EXPORT_ID_ENDPOINT': '/users/export/ids', | ||
'CAMPAIGN_SEND_ENDPOINT': '/campaigns/trigger/send', | ||
'ENTERPRISE_CAMPAIGN_ID': '', | ||
'ENTERPRISE_CODE_ASSIGNMENT_CAMPAIGN_ID': 'the-code-assignment-campaign-id', | ||
'ENTERPRISE_CODE_UPDATE_CAMPAIGN_ID': 'the-code-update-campaign-id', | ||
'ENTERPRISE_CODE_USAGE_CAMPAIGN_ID': 'the-code-usage-campaign-id', | ||
'ENTERPRISE_CODE_NUDGE_CAMPAIGN_ID': '', # cover case where a `campaign_id` kwarg is falsey. | ||
'FROM_EMAIL': '<[email protected]>', | ||
'BRAZE_RETRY_SECONDS': 3600, | ||
'BRAZE_RETRY_ATTEMPTS': 6, | ||
|
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