Skip to content

Commit 2ffc63e

Browse files
Forward user metadata is_fragments_user to hubspot (#663)
This pr forwards the is_fragments_user metadata field to our hubspot integration in new_user edge function
1 parent 9513b6c commit 2ffc63e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

supabase/functions/new_user/index.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ function sendToLoops(body: any) {
3636
})
3737
}
3838

39-
4039
function createHubspotContact(userData: {
4140
id: string
4241
email: string
4342
raw_user_meta_data?: {
4443
full_name?: string
4544
name?: string
45+
is_fragments_user?: boolean
4646
}
4747
}) {
4848
const name =
@@ -62,13 +62,19 @@ function createHubspotContact(userData: {
6262
}
6363
}
6464

65+
// For HubSpot checkbox fields, we need to pass "true" or "false" as strings
66+
const isFragmentsUser = userData.raw_user_meta_data?.is_fragments_user
67+
? 'true'
68+
: 'false'
69+
6570
// Map Supabase user data to HubSpot properties
6671
const hubspotContactData = {
6772
properties: {
68-
db_user_id: userData.id,
6973
email: userData.email,
7074
firstname: firstName,
7175
lastname: lastName,
76+
db_user_id: userData.id,
77+
db_is_fragments_user: isFragmentsUser,
7278
},
7379
}
7480

0 commit comments

Comments
 (0)