Skip to content

Conversation

@bluewave41
Copy link

No description provided.

@bluewave41 bluewave41 marked this pull request as draft September 22, 2025 14:04
None,
{"email_id": token},
{
"country": update_data["country"],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A number of custom attributes are blocklisted. Some of them have columns in cTms but are blocked in Braze. We should check in and see if this is intentional as there won't be a 1 to 1 match without them.


return self._request(BrazeEndpoint.CAMPAIGNS_TRIGGER_SEND, data)

def set_subscription_status(self, email, newsletters):
Copy link
Author

@bluewave41 bluewave41 Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Braze expects subscription_group_ids for this call instead of the short key. This means we'll need to pass those along to django as well in the subscription process.

There doesn't seem to be an endpoint to get subscription group ids. I guess they'll be hardcoded or entered in the database? Too soon to be able to tell.

They're added in to basket as braze_id in the news_newsletters table.



class Newsletter(models.Model):
braze_id = models.UUIDField(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no mechanic to get a list of subscription groups from Braze so we need to store them somewhere. I think this makes the most sense.

"""
Set subscription status for the specified newsletters
https://www.braze.com/docs/api/endpoints/subscription_groups/post_update_user_subscription_group_status/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads up, you linked to v1

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads up, you linked to v1

Good catch I wouldn't have remembered that.

clara-campos referenced this pull request in clara-campos/basket Sep 25, 2025
@bluewave41 bluewave41 marked this pull request as ready for review September 28, 2025 10:24
@clara-campos
Copy link

clara-campos commented Oct 1, 2025

Reminder to myself: check that the basket_token is being recorded correctly as an attribute in braze when testing this PR (we'll need it for the news/confirm endpoint).

UPDATE: Have checked, it is.

{"email_id": new_user.get("email", {}).get("email_id")},
{
"basket_token": token,
"country": update_data["country"],
Copy link

@clara-campos clara-campos Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not exist -- only email and newsletters are required in the request. You can submit an API request without the country or the language fields, which causes the code to error out on this line (update_data won't have a country property).

"basket_token": token,
"country": update_data["country"],
"email_format": "H",
"language": update_data["lang"],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as 'country' above

}
for newsletter in Newsletter.objects.all():
newsletter.braze_id = braze_mapping.get(newsletter.slug, None)
newsletter.save(update_fields=["braze_id"])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads up, we might be replacing the values in the existing vendor_id column instead for this. Please, ping someone to find out was what was decided around that when you're back from vacation. https://silverorange.slack.com/archives/C09C0L23JG1/p1759151093820139?thread_ts=1758726117.837289&cid=C09C0L23JG1

braze.track_user(
data["email"],
None,
{"email_id": new_user.get("email", {}).get("email_id")},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking into this, I don't think this will work when we remove ctms, since the email id is coming from that ctms add. It's fine for now, just something to address later on.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That and the ctms generated ID won't work yes. We will have to come back to this later on.

@bluewave41 bluewave41 closed this Oct 6, 2025
clara-campos referenced this pull request in clara-campos/basket Oct 21, 2025
jacobpenny pushed a commit that referenced this pull request Nov 5, 2025
Pre-generate tokens/email_ids for fxa tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants