Tech Refinement - Cross Brand
Repos that we’ll change
intl-user-service: https://github.com/rbilabs/intl-user-service
intl-packages: https://github.com/rbilabs/intl-packages
Problem
When the user accepts Iberia's terms, we must save the acceptances for both Burger King and Popeyes on Braze.
Therefore, the customer must receive email/push notifications from all Iberia markets.
Proposal of Solution
When a new user is created, we must replicate the user's acceptance settings to the other configured markets.
If the user accesses their account data and changes the email/push settings, these settings must only be applied to that market, and must not be replicated to others.
But if the modal appears informing the privacy changes and the user accepts the terms, the notification settings must be replicated to all configured markets
Technical Problem
intl-packages:
We should create a new secret (crm-events) to save settings.
Update CRM Event (mparticle) to use secrets and send message to another markets.
POC: https://github.com/rbilabs/intl-packages/pull/938/
intl-user-service:
Option 1
New User
We must add two new fields to be sent to the particle trigger.
email_subscribe
push_subscribe
Update User to call logCrmEvents
The user update routine is done via HTTP request, here we must integrate it with CRM Events, currently, it only updates in DynamoDB
Option 2
Create new lambda
Create new SQS (aws-rbi-dev-plk-rbi-user-updated-queue-cross-brand) in SNS.
POC with Lambda: https://github.com/rbilabs/intl-user-service/pull/294/files#diff-80e761f011e47bd1db134cc93f8e4ab7de2b65a64e08df2b5469e4f953f9056f
API - User Update - To test
Braze
You must update contact settings, such as send email and send user settings.
https://dashboard-02.braze.eu/users/user_search?locale=en
Tasks breakdown
intl-packages:
Task 1 - create a new secret in dev
table: rbi-account-secrets
pk: rbi/dev/plk/crm-events
{
"replicateAccount": {
"active": false,
"urls": [
"https://sqs.eu-west-3.amazonaws.com/326165771931/rbi-dev-bk-mparticle-events-queue",
"https://sqs.eu-west-3.amazonaws.com/326165771931/rbi-dev-th-mparticle-events-queue"
]
}
}
Task 2 - create a new secret in QA/Prod
Open new ticket to create secrets
Task 3 - create a new definitions secret
Should create a new definition secret to crm-events
We must check to work to all markets and not only ES and PT.
Task 4 - Change mparticle-service.ts to replicate message to mparticle
Should change
AllowedEventNames
type and added new “User Account Updated” type.This replicate should occur only when event name is “User Account Created” or “User Account Updated”
Must update the sendMParticleCustomEventToQueue function to read secrets and send messages to other markets.
DOD-LIKE
Create new secrets
Create new definition secrets to CRM Events
Update CRM Events to send more fields to mparticles
intl-user-service:
Task 1 - Add new proprieties in new user event trigger
Should add email_subscribe and push_subscribe to send to mparticle
Task 2- Update User
Should change “users-update-service” to call logCrmEvent.
Should only call logCrmEvent if the request comes from the Acceptance Agreement
DOD-LIKE
Update unit tests
Update mparticle to send more fields.
Modify users update to send CRM Events.
POCs:
intl-user-service (backend): https://github.com/rbilabs/intl-user-service/pull/294/
intl-packages: https://github.com/rbilabs/intl-packages/pull/938
More information
In the SignUp to accept the marketing to EMAIL and PUSH you need to enable this flag in Launchdarkly - Platform:
enable-push-notifications-on-signup
It is fundamental that on DynamoDB with the table rbi-account-secrets with the item rbi/dev/YOUR_BRAND/crm-events (rbi/dev/plk/crm-events) there are the valeus for this, is required there are at least one URL and the ACTIVE field must be true
In case of problems in register user, in the moment of validate OTP code, you can to see the logs of on CloudWatch AWS, the lambdas that you need to analyze are dev-plk-user-new-user and dev-plk-user-api, you need just to change the brand.
We have a feature flag to control this feature, enable-cross-brand, for work we need to enable this flag, and we can customize with the email and country, this way we have more control about this feature.