-
Notifications
You must be signed in to change notification settings - Fork 271
add phone number support to reddit-conversions-api #2834
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
base: main
Are you sure you want to change the base?
Conversation
packages/destination-actions/src/destinations/reddit-conversions-api/utils.ts
Outdated
Show resolved
Hide resolved
@akhsueh - Is this PR ready for review? |
packages/destination-actions/src/destinations/reddit-conversions-api/fields.ts
Outdated
Show resolved
Hide resolved
@@ -195,7 +195,8 @@ function getUser( | |||
user_agent: clean(user.user_agent), | |||
uuid: clean(user.uuid), | |||
data_processing_options: getDataProcessingOptions(dataProcessingOptions), | |||
screen_dimensions: getScreen(screenDimensions?.height, screenDimensions?.width) | |||
screen_dimensions: getScreen(screenDimensions?.height, screenDimensions?.width), | |||
phone_number: user.phone_number |
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.
hi @akhsueh , looks like @codeyanker indicated that phone number needs to be 'smart' hashed.
Please let me know when you add the code for this and I'll review.
I think it would be worth adding a unit test to test the outputs for multiple different phone number inputs.
I assume we'll need to implement something similar for the Pixel Destination also?
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.
function canonicalizePhoneNumber(value: string): string {
const digits = value
.trim()
.split(/[a-zA-Z]/)[0]
.replace(/\D/g, '');
return digits ? `+${digits}` : ''
}
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.
phone_number: processHashing(
user.phone_number ?? '',
'sha256', 'hex',
features,
'actions-reddit-conversions-api',
canonicalizePhoneNumber
)
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.
Hi @joe-ayoub-segment , thanks for taking a look here. I connected internally with the team and we're OK without implementing the phone number hashing piece if Segment is OK with it too. Our API will always defensively hash - so if it sees a request that has an unhashed value being passed in the phone number field, it will automatically hash it before we process it and store it anywhere.
If hashing before the request is required by Segment though, we can add that function in there. Is this something you typically require to implement or is it OK to rely on our API to hash the values automatically?
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.
Hi @akhsueh , I think it would be better to smart-hash it on the Segment side so that the field behaves the same as other related fields. It's possible our docs already indicate that smart-hashing occurs, so it's simpler to just do it here.
We will need to test it though, but that can be done locally using the testing tool. Is this something you are comfortable doing? We can get on a call to do it if that works best for you? Here is my Calendly: https://calendly.com/joe_ayoub
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.
Hi @joe-ayoub-segment , thanks for touching base on this in the call the other day. I updated this to include the cleaning function and smart-hash function to the phone numbers before sending. Also updated the tests for it.
Co-authored-by: Joe Ayoub <[email protected]>
…on (segmentio#2827) * Initial commit on branch * Delete packages/destination-actions/src/destinations/twilio-messaging-omnichannel/__tests__/index.test.ts * Delete packages/destination-actions/src/destinations/twilio-messaging-omnichannel/__tests__/snapshot.test.ts * Delete packages/destination-actions/src/destinations/twilio-messaging-omnichannel/sendMessage/__tests__/snapshot.test.ts * Delete packages/destination-actions/src/destinations/twilio-messaging-omnichannel/sendMessage/__tests__/index.test.ts
* WIP * Adds stats around CSV generation. Counts the number of columns and rows. Counts the number of actual values and number of nulls for the whole CSV. Unit tests included * Log out the CSV stats after the job is created to ensure the jobID is a defined tag
…entio#2816) * [STRATCONN-5603] - Format timestamp fields without miliiseconds * Revert type changes * Revert type changes * [GEC] Simplify convertTimestamp Regex * Revert unintended change
…le action in Klaviyo (segmentio#2814) * add subscription object support for unsubscribeProfile action in Klaviyo * update snapshots * add tests * add tests * fix comments
Co-authored-by: Gaurav Kochar <[email protected]>
…segmentio#2771) * [Criteo] Audience Destination: set enable_batching to true by default * Criteo Audience Destination: make 'Enable Batching' optional * Criteo Audience Destination: updated generated types --------- Co-authored-by: m.dillar <[email protected]>
* deprecate Product Added * update conversion presets * fix
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Passes on the InputField min and max properties to JSONSchema for validation * Adds unit tests and updated comment descriptions for string field min/max
…mentio#2826) * Scaffolds new v2 actions * Hook Definition and fields from the original branch * dataExtensionV2 action filled out with the action definition from original branch * contactdataExtensionV2 action filled out with the action definition from original branch * Generates types * Fixes build. Introduces an upsertRowsV2 function for the new actions * Declares keys and values fields as dynamic only in the V2 actions to ensure no new behavior for the existing actions * Adds a little (V2) suffix to the titles for the new actions * Improves error message when users encounter auth issues for data extension id dynamic field * When a user doesn't have auth permission to lookup a data extension, use the ID they provide without verifying it. Provide improved error messaging * Throw an error if no data extension is connected to the mapping
* Passes on the InputField min and max properties to JSONSchema for validation * [required-field-check] Run yarn install after switching to main branch (segmentio#2801) * [required-field-check] Run install after switching to main branch * Add more comments * Eventbridge cosmetic changes (segmentio#2807) * Description changes * Description changes * additional enhancements * eventbridge enhancements * eventbridge enhancements * changed Error to IntegrationError --------- Co-authored-by: Nick Aguilar <[email protected]> Co-authored-by: Varadarajan V <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This reverts commit dda2c53.
* Test * Test * update types * final * identify * pr comments * utils https * add thread_id * fix tests --------- Co-authored-by: Jeff Kayne <[email protected]>
…ort audience fanout for Liveramp Audiences (segmentio#2786) * [STRATCONN-5473] Add destinationInstanceID and subscriptionId to support audience fanout * Revert Tradesk Changes * handle file path edge cases * handle file path edge cases * Add Tests
* support for multi-status response * changed title of action Send to SendV2 * added feature flag code check
* Add library field to Podscribe destination * Handle case when payload.library is undefined * Remove format validation from email field * Update test snapshots * Add library field to Podscribe destination * Handle case when payload.library is undefined * Update test snapshots * feat(podscribe) add hashed_email properties field and user_id settings field * fix(sergment) add hashed email * fix(podscribe) clean up * fix(podscribe) update test snapshot * fix(podscribe) re-generate types
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* added sales type objects to SUPPORTED_HUBSPOT_OBJECT_TYPES * added product * removed quotes and leads
…egmentio#2893) Co-authored-by: Austin Hsueh <[email protected]>
* cleanup for smart hashing * Update fb test to use processHashing. * Use processHashing instead of old hashing util
* [STRATCONN-5489] - Add batch_keys to Klaviyo actions * Fix build * UpsertProfile - add override_list_id to batch keys * Add stats to measure grouping * handle undefined statsclient * Fix tests * Add snapshot tests for batch keys * Remove unused stat
…entio#2878) * [STRATCONN-5657] - Add batch keys to webhook action destination * Add stats * Use histogram * Add test for batch keys
…ents (segmentio#2792) * Added contact properties to Send event action * Type for contactProperties * Type for full payload * Update generated-types.ts
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…2860) * Add smart hashing documentation in readme * Update smart hashing documentation * update heading * update docs * Update smart hashing documentation
…pto module (segmentio#2861) * Add eslint rule to limit usage of createHash from crypto module * Update error message
* cleanup for smart hashing * cleanup for smart hashing
* cleanup for smart hashing * Remove createHash from test file
* cleanup for smart hashing * Update reddit conversions test case
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…inations for Journeys V2 (segmentio#2894) * Update subscription presets and action descriptions * Update the sync destination's description * Change 'Journeys Step Transition Track' to 'Journeys Step Entered'
@@ -167,3 +168,31 @@ const smartHash = (value: string | undefined, cleaningFunction?: (value: string) | |||
if (value === undefined) return | |||
return processHashingV2(value, 'sha256', 'hex', cleaningFunction) | |||
} | |||
|
|||
function cleanPhoneNumber(phoneNumber: string): string { | |||
// if (!phoneNumber) return undefined |
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.
hi @akhsueh I'm thinking we should actually leave this in, and update the signature of the function to an optional phoneNumber string value or undefined value. We would then also return undefined if there is no phone number.
What do you think ?
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.
Hi @joe-ayoub-segment sounds good, I added that back into the latest commit and changed the smartHash a bit to try to resolve an error when I inserted that line back into cleanPhoneNumber.
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.
Thanks for getting this done @akhsueh . I only had one query about the clearPhoneNumber function. Wonder if it should handle when a null or undefined value is passed in.
A summary of your pull request, including the what change you're making and why.
Adding the support of passing phone numbers into the Reddit Conversions API destination (destinations/actions-reddit-conversions-api).
We have configured it to the following default mapping, please let us know if this is not the correct default value from Segment that we should use:
Testing