forked from mozmeao/basket
-
Notifications
You must be signed in to change notification settings - Fork 2
Switch backend from cTms to Braze #13
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
jacobpenny
wants to merge
172
commits into
main
Choose a base branch
from
development
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or 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
Vendor parsing
Add fxa_id alias to migration command
Implement Admin DSAR Unsubscribe and DSAR Get Info, update tests
Update unsub command
Add Braze-CTMS shim to support token/fxa_id lookups prior to migrations
Create a second braze instance to be used for tx emails only
7c4d300 to
96c7954
Compare
Adjust comment
Add sentry exception parameter where missing
c8a777c to
adb0ead
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
New environment variables
This PR adds five settings/environment variables which allow switching Basket's backend from cTms to Braze in a gradual way. They are:
BRAZE_PARALLEL_WRITE_ENABLEWhen
TrueBasket will send write operations (newsletter subscriptions, etc.) to both cTms and Braze. Side-effects such as sending confirmation emails will only occur once.BRAZE_READ_WITH_FALLBACK_ENABLEWhen
TrueBasket will first send read operations (get user info, etc.) to Braze and will fall back to cTms if an error occured.BRAZE_ONLY_WRITE_ENABLEWhen
TrueBasket will only send write operations to Braze (and not to cTms at all).BRAZE_ONLY_READ_ENABLEWhen
TrueBasket will only read from Braze (and not from cTms at all).BRAZE_CTMS_SHIM_ENABLEIf a request only provides a
tokenorfxa_idwe are unable to look up a user in Braze until thetoken/fxa_idmigration is complete. WhenTrueBasket will use a shim to fetch a user's email from cTms when in this situation. This email is then used to look up and/or update the user in Braze.Implementation Details
Care was taken to modify the existing Basket logic as little as possible. In order to accomplish this a
Brazeclass with the same interface as theCTMSclass was created to be used as a near drop-in replacement.In order to facilitate the gradual switch to Braze (which calls for an initial phase where we write to both backends), the above settings were introduced and endpoint logic was parametized to allow us to choose which backend to use (via a
use_braze_backendoption). Although this PR's diff is large most endpoint changes were fairly systematic.