I have been using Javascript to send simple event and attribute information to braze.
Sometimes i have had to change the outputs but using a dictionary/library but generally still sending simple string Events (event properties) and custom_attributes
However today I'm trying to send an account_opened event
Event: account_opened
Event Properties: account_number, account_type (values lets say account_a, account_b
Event and properties are all firing fine.
But i also want to update an Array with account_types_held and account_numbers_held
the future user case for this is so we don't have to keep getting a CSV list for people that hold a certain account type when we perhaps do maintenance on those account types.
it's populating the attributes each time but overwriting the old one rather than appending in a list - i believe this is because Braze is not receiving the $add
So how should this Javascript be set up?
I think it should be instead of using the identify call the direct:
// Call Braze API directly to append to array attributes const response = await fetch(`${settings.brazeEndpoint}/users/track`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${settings.brazeApiKey}` },
Any advice?
Webhook > segment > braze via source functions