-
Notifications
You must be signed in to change notification settings - Fork 256
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
Add phone number as identifier #2186
Conversation
packages/destination-actions/src/destinations/klaviyo/removeProfile/index.ts
Show resolved
Hide resolved
...s/destination-actions/src/destinations/klaviyo/removeProfileFromList/__tests__/index.test.ts
Outdated
Show resolved
Hide resolved
packages/destination-actions/src/destinations/klaviyo/removeProfile/__tests__/index.test.ts
Outdated
Show resolved
Hide resolved
packages/destination-actions/src/destinations/klaviyo/functions.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Left a few questions. Nothing major.
packages/destination-actions/src/destinations/klaviyo/addProfileToList/__tests__/index.test.ts
Outdated
Show resolved
Hide resolved
packages/destination-actions/src/destinations/klaviyo/addProfileToList/__tests__/index.test.ts
Outdated
Show resolved
Hide resolved
@@ -5,6 +5,10 @@ export interface Payload { | |||
* The user's email to send to Klavio. | |||
*/ | |||
email?: string | |||
/** | |||
* Individual's phone number in E.164 format. If SMS is not enabled and if you use Phone Number as identifier, then you have to provide one of Email or External ID. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would Klaviyo throw an error if the phone number is not E.164 format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should do a validation on our end? Would Klaviyo reject the entire batch if one event fails E.164 check?
@@ -163,17 +166,26 @@ export async function getProfiles( | |||
const response = await request(`${API_URL}/profiles/?filter=any(${filterId})`, { | |||
method: 'GET' | |||
}) | |||
const data: GetProfileResponse = await response.json() | |||
profileIds.push(...data.data.map((profile: Profile) => profile.id)) | |||
const res: GetProfileResponse = await response.json() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/destination-actions/src/destinations/klaviyo/removeProfile/__tests__/index.test.ts
Show resolved
Hide resolved
...s/destination-actions/src/destinations/klaviyo/removeProfileFromList/__tests__/index.test.ts
Outdated
Show resolved
Hide resolved
...s/destination-actions/src/destinations/klaviyo/removeProfileFromList/__tests__/index.test.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR looks very good. Test doc also looks very good.
if (profile.phone_number && !validatePhoneNumber(profile.phone_number)) { | ||
return false | ||
} | ||
return profile.email || profile.phone_number || profile.external_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a nit: you could probably do something like this and move the undefined check to validatePhoneNumber
if (profile.phone_number && !validatePhoneNumber(profile.phone_number)) { | |
return false | |
} | |
return profile.email || profile.phone_number || profile.external_id | |
return profile.email || validatePhoneNumber(profile.phone_number) || profile.external_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will keep the profiles which have invalid phone number but also has either email or external_id, we want to filter those out as well since Klaviyo will throw error for those too.
hi @harsh-joshi99 this PR has been deployed. |
* Add phone number as identifier in add profile to list and remove profile from list * add phone number for remove profile action * Update snapshot * Update tests * Fix test descriptions * Add E.164 validation in all actions, update test cases, update snapshots * Revert non engage actions changes to original state (splitting large PR) * Add removeProfile actions changes * Update snapshots
* Add phone number as identifier in add profile to list and remove profile from list * add phone number for remove profile action * Update snapshot * Update tests * Fix test descriptions * Add E.164 validation in all actions, update test cases, update snapshots * Revert non engage actions changes to original state (splitting large PR) * Add removeProfile actions changes * Update snapshots
Add phone number as identifier in
add profile to list
,remove profile from list
andremove profile
actions.JIRA -> STRATCONN-3866
Testing
Tested successfully in local and staging env.
Testing doc -> https://docs.google.com/document/d/1tlUdTiNfkiXF86yvW2faTpV8UGjI4sVzOqQ_2mzak0g/edit?usp=sharing
Add to list

Remove Profile

Include any additional information about the testing you have completed to
ensure your changes behave as expected. For a speedy review, please check
any of the tasks you completed below during your testing.