From ce3c0820fa3a600f040f02543f5f760bfa49cf7b Mon Sep 17 00:00:00 2001 From: maryamsharif <99763167+maryamsharif@users.noreply.github.com> Date: Wed, 29 Nov 2023 03:43:21 -0800 Subject: [PATCH] [STRATCONN-3376] Add phone number to TikTok Audiences (#1730) * Add phone number * Fix unit tests * Hide enable batching field + adjust names --- .../addToAudience/__tests__/index.test.ts | 62 ++++++++++++++++--- .../addToAudience/generated-types.ts | 8 +++ .../tiktok-audiences/addToAudience/index.ts | 4 ++ .../addUser/__tests__/index.test.ts | 55 ++++++++++++++-- .../addUser/generated-types.ts | 8 +++ .../tiktok-audiences/addUser/index.ts | 4 ++ .../tiktok-audiences/functions.ts | 22 ++++++- .../tiktok-audiences/properties.ts | 35 +++++++++-- .../__tests__/index.test.ts | 14 +++-- .../removeFromAudience/generated-types.ts | 8 +++ .../removeFromAudience/index.ts | 4 ++ .../removeUser/__tests__/index.test.ts | 14 +++-- .../removeUser/generated-types.ts | 8 +++ .../tiktok-audiences/removeUser/index.ts | 4 ++ 14 files changed, 221 insertions(+), 29 deletions(-) diff --git a/packages/destination-actions/src/destinations/tiktok-audiences/addToAudience/__tests__/index.test.ts b/packages/destination-actions/src/destinations/tiktok-audiences/addToAudience/__tests__/index.test.ts index 503a7e35c0..38f40cc656 100644 --- a/packages/destination-actions/src/destinations/tiktok-audiences/addToAudience/__tests__/index.test.ts +++ b/packages/destination-actions/src/destinations/tiktok-audiences/addToAudience/__tests__/index.test.ts @@ -29,7 +29,8 @@ const event = createTestEvent({ advertisingId: ADVERTISING_ID }, traits: { - email: 'testing@testing.com' + email: 'testing@testing.com', + phone: '1234567890' }, personas: { audience_settings: { @@ -42,7 +43,7 @@ const event = createTestEvent({ }) const updateUsersRequestBody = { - id_schema: ['EMAIL_SHA256', 'IDFA_SHA256'], + id_schema: ['EMAIL_SHA256', 'PHONE_SHA256', 'IDFA_SHA256'], advertiser_ids: [ADVERTISER_ID], action: 'add', batch_data: [ @@ -51,6 +52,10 @@ const updateUsersRequestBody = { id: '584c4423c421df49955759498a71495aba49b8780eb9387dff333b6f0982c777', audience_ids: [EXTERNAL_AUDIENCE_ID] }, + { + id: 'c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646', + audience_ids: [EXTERNAL_AUDIENCE_ID] + }, { id: '0315b4020af3eccab7706679580ac87a710d82970733b8719e70af9b57e7b9e6', audience_ids: [EXTERNAL_AUDIENCE_ID] @@ -74,6 +79,9 @@ describe('TiktokAudiences.addToAudience', () => { }) expect(r[0].status).toEqual(200) + expect(r[0].options.body).toMatchInlineSnapshot( + `"{\\"advertiser_ids\\":[\\"123\\"],\\"action\\":\\"add\\",\\"id_schema\\":[\\"EMAIL_SHA256\\",\\"PHONE_SHA256\\",\\"IDFA_SHA256\\"],\\"batch_data\\":[[{\\"id\\":\\"584c4423c421df49955759498a71495aba49b8780eb9387dff333b6f0982c777\\",\\"audience_ids\\":[\\"12345\\"]},{\\"id\\":\\"c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646\\",\\"audience_ids\\":[\\"12345\\"]},{\\"id\\":\\"0315b4020af3eccab7706679580ac87a710d82970733b8719e70af9b57e7b9e6\\",\\"audience_ids\\":[\\"12345\\"]}]]}"` + ) }) it('should normalize and hash emails correctly', async () => { @@ -101,7 +109,8 @@ describe('TiktokAudiences.addToAudience', () => { useDefaultMappings: true, auth, mapping: { - send_advertising_id: false + send_advertising_id: false, + send_phone: false } }) @@ -110,6 +119,39 @@ describe('TiktokAudiences.addToAudience', () => { ) }) + it('should normalize and hash phone correctly', async () => { + nock(`${BASE_URL}${TIKTOK_API_VERSION}`) + .post('/segment/mapping/', { + advertiser_ids: ['123'], + action: 'add', + id_schema: ['PHONE_SHA256'], + batch_data: [ + [ + { + id: 'c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646', + audience_ids: [EXTERNAL_AUDIENCE_ID] + } + ] + ] + }) + .reply(200) + + const responses = await testDestination.testAction('addToAudience', { + event, + settings: { + advertiser_ids: ['123'] + }, + useDefaultMappings: true, + auth, + mapping: { + send_advertising_id: false, + send_email: false + } + }) + + expect(responses[0].options.body).toMatchInlineSnapshot() + }) + it('should fail if an audience id is invalid', async () => { const anotherEvent = createTestEvent({ event: 'Audience Entered', @@ -122,7 +164,8 @@ describe('TiktokAudiences.addToAudience', () => { advertisingId: ADVERTISING_ID }, traits: { - email: 'testing@testing.com' + email: 'testing@testing.com', + phone: '1234567890' }, personas: { audience_settings: { @@ -136,7 +179,7 @@ describe('TiktokAudiences.addToAudience', () => { nock(`${BASE_URL}${TIKTOK_API_VERSION}/segment/mapping/`) .post(/.*/, { - id_schema: ['EMAIL_SHA256', 'IDFA_SHA256'], + id_schema: ['EMAIL_SHA256', 'PHONE_SHA256', 'IDFA_SHA256'], advertiser_ids: [ADVERTISER_ID], action: 'add', batch_data: [ @@ -145,6 +188,10 @@ describe('TiktokAudiences.addToAudience', () => { id: '584c4423c421df49955759498a71495aba49b8780eb9387dff333b6f0982c777', audience_ids: ['THIS_ISNT_REAL'] }, + { + id: 'c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646', + audience_ids: ['THIS_ISNT_REAL'] + }, { id: '0315b4020af3eccab7706679580ac87a710d82970733b8719e70af9b57e7b9e6', audience_ids: ['THIS_ISNT_REAL'] @@ -182,10 +229,11 @@ describe('TiktokAudiences.addToAudience', () => { selected_advertiser_id: '123', audience_id: '123456', send_email: false, - send_advertising_id: false + send_advertising_id: false, + send_phone: false } }) - ).rejects.toThrow('At least one of `Send Email`, or `Send Advertising ID` must be set to `true`.') + ).rejects.toThrow('At least one of `Send Email`, `Send Phone` or `Send Advertising ID` must be set to `true`.') }) it('should fail if email and/or advertising_id is not in the payload', async () => { nock(`${BASE_URL}${TIKTOK_API_VERSION}/segment/mapping/`).post(/.*/, updateUsersRequestBody).reply(400) diff --git a/packages/destination-actions/src/destinations/tiktok-audiences/addToAudience/generated-types.ts b/packages/destination-actions/src/destinations/tiktok-audiences/addToAudience/generated-types.ts index 87e5448708..df0e8160a2 100644 --- a/packages/destination-actions/src/destinations/tiktok-audiences/addToAudience/generated-types.ts +++ b/packages/destination-actions/src/destinations/tiktok-audiences/addToAudience/generated-types.ts @@ -5,6 +5,10 @@ export interface Payload { * The user's email address to send to TikTok. */ email?: string + /** + * The user's phone number to send to TikTok. + */ + phone?: string /** * The user's mobile advertising ID to send to TikTok. This could be a GAID, IDFA, or AAID */ @@ -13,6 +17,10 @@ export interface Payload { * Send email to TikTok. Segment will hash this value before sending */ send_email?: boolean + /** + * Send phone number to TikTok. Segment will hash this value before sending + */ + send_phone?: boolean /** * Send mobile advertising ID (IDFA, AAID or GAID) to TikTok. Segment will hash this value before sending. */ diff --git a/packages/destination-actions/src/destinations/tiktok-audiences/addToAudience/index.ts b/packages/destination-actions/src/destinations/tiktok-audiences/addToAudience/index.ts index c387e45d8c..0b778a611c 100644 --- a/packages/destination-actions/src/destinations/tiktok-audiences/addToAudience/index.ts +++ b/packages/destination-actions/src/destinations/tiktok-audiences/addToAudience/index.ts @@ -5,7 +5,9 @@ import { processPayload } from '../functions' import { email, advertising_id, + phone, send_email, + send_phone, send_advertising_id, event_name, enable_batching, @@ -19,8 +21,10 @@ const action: ActionDefinition = { defaultSubscription: 'event = "Audience Entered"', fields: { email: { ...email }, + phone: { ...phone }, advertising_id: { ...advertising_id }, send_email: { ...send_email }, + send_phone: { ...send_phone }, send_advertising_id: { ...send_advertising_id }, event_name: { ...event_name }, enable_batching: { ...enable_batching }, diff --git a/packages/destination-actions/src/destinations/tiktok-audiences/addUser/__tests__/index.test.ts b/packages/destination-actions/src/destinations/tiktok-audiences/addUser/__tests__/index.test.ts index c93fcd9720..6b220836a9 100644 --- a/packages/destination-actions/src/destinations/tiktok-audiences/addUser/__tests__/index.test.ts +++ b/packages/destination-actions/src/destinations/tiktok-audiences/addUser/__tests__/index.test.ts @@ -26,7 +26,8 @@ const event = createTestEvent({ advertisingId: '123' }, traits: { - email: 'testing@testing.com' + email: 'testing@testing.com', + phone: '1234567890' } } }) @@ -34,13 +35,17 @@ const event = createTestEvent({ const updateUsersRequestBody = { advertiser_ids: ['123'], action: 'add', - id_schema: ['EMAIL_SHA256', 'IDFA_SHA256'], + id_schema: ['EMAIL_SHA256', 'PHONE_SHA256', 'IDFA_SHA256'], batch_data: [ [ { id: '584c4423c421df49955759498a71495aba49b8780eb9387dff333b6f0982c777', audience_ids: ['1234345'] }, + { + id: 'c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646', + audience_ids: ['1234345'] + }, { id: 'a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3', audience_ids: ['1234345'] @@ -94,7 +99,8 @@ describe('TiktokAudiences.addUser', () => { mapping: { selected_advertiser_id: '123', audience_id: '1234345', - send_advertising_id: false + send_advertising_id: false, + send_phone: false } }) expect(responses[0].options.body).toMatchInlineSnapshot( @@ -102,6 +108,41 @@ describe('TiktokAudiences.addUser', () => { ) }) + it('should normalize and hash phone correctly', async () => { + nock(`${BASE_URL}${TIKTOK_API_VERSION}/segment/mapping/`) + .post(/.*/, { + advertiser_ids: ['123'], + action: 'add', + id_schema: ['PHONE_SHA256'], + batch_data: [ + [ + { + id: 'c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646', + audience_ids: ['1234345'] + } + ] + ] + }) + .reply(200) + const responses = await testDestination.testAction('addUser', { + event, + settings: { + advertiser_ids: ['123'] + }, + useDefaultMappings: true, + auth, + mapping: { + selected_advertiser_id: '123', + audience_id: '1234345', + send_advertising_id: false, + send_email: false + } + }) + expect(responses[0].options.body).toMatchInlineSnapshot( + `"{\\"advertiser_ids\\":[\\"123\\"],\\"action\\":\\"add\\",\\"id_schema\\":[\\"PHONE_SHA256\\"],\\"batch_data\\":[[{\\"id\\":\\"c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646\\",\\"audience_ids\\":[\\"1234345\\"]}]]}"` + ) + }) + it('should fail if an audience id is invalid', async () => { nock(`${BASE_URL}${TIKTOK_API_VERSION}/segment/mapping/`).post(/.*/, updateUsersRequestBody).reply(400) @@ -136,10 +177,11 @@ describe('TiktokAudiences.addUser', () => { selected_advertiser_id: '123', audience_id: '123456', send_email: false, - send_advertising_id: false + send_advertising_id: false, + send_phone: false } }) - ).rejects.toThrow('At least one of `Send Email`, or `Send Advertising ID` must be set to `true`.') + ).rejects.toThrow('At least one of `Send Email`, `Send Phone` or `Send Advertising ID` must be set to `true`.') }) it('should fail if email and/or advertising_id is not in the payload', async () => { nock(`${BASE_URL}${TIKTOK_API_VERSION}/segment/mapping/`).post(/.*/, updateUsersRequestBody).reply(400) @@ -159,7 +201,8 @@ describe('TiktokAudiences.addUser', () => { selected_advertiser_id: '123', audience_id: 'personas_test_audience', send_email: true, - send_advertising_id: true + send_advertising_id: true, + send_phone: true } }) ).rejects.toThrowError('At least one of Email Id or Advertising ID must be provided.') diff --git a/packages/destination-actions/src/destinations/tiktok-audiences/addUser/generated-types.ts b/packages/destination-actions/src/destinations/tiktok-audiences/addUser/generated-types.ts index ac0bb830f7..444db36fe4 100644 --- a/packages/destination-actions/src/destinations/tiktok-audiences/addUser/generated-types.ts +++ b/packages/destination-actions/src/destinations/tiktok-audiences/addUser/generated-types.ts @@ -13,6 +13,10 @@ export interface Payload { * The user's email address to send to TikTok. */ email?: string + /** + * The user's phone number to send to TikTok. + */ + phone?: string /** * The user's mobile advertising ID to send to TikTok. This could be a GAID, IDFA, or AAID */ @@ -21,6 +25,10 @@ export interface Payload { * Send email to TikTok. Segment will hash this value before sending */ send_email?: boolean + /** + * Send phone number to TikTok. Segment will hash this value before sending + */ + send_phone?: boolean /** * Send mobile advertising ID (IDFA, AAID or GAID) to TikTok. Segment will hash this value before sending. */ diff --git a/packages/destination-actions/src/destinations/tiktok-audiences/addUser/index.ts b/packages/destination-actions/src/destinations/tiktok-audiences/addUser/index.ts index 444c236f46..21597bb459 100644 --- a/packages/destination-actions/src/destinations/tiktok-audiences/addUser/index.ts +++ b/packages/destination-actions/src/destinations/tiktok-audiences/addUser/index.ts @@ -6,8 +6,10 @@ import { selected_advertiser_id, audience_id, email, + phone, advertising_id, send_email, + send_phone, send_advertising_id, event_name, enable_batching @@ -26,8 +28,10 @@ const action: ActionDefinition = { selected_advertiser_id: { ...selected_advertiser_id }, audience_id: { ...audience_id }, email: { ...email }, + phone: { ...phone }, advertising_id: { ...advertising_id }, send_email: { ...send_email }, + send_phone: { ...send_phone }, send_advertising_id: { ...send_advertising_id }, event_name: { ...event_name }, enable_batching: { ...enable_batching } diff --git a/packages/destination-actions/src/destinations/tiktok-audiences/functions.ts b/packages/destination-actions/src/destinations/tiktok-audiences/functions.ts index 25d3934522..b71fa61b1d 100644 --- a/packages/destination-actions/src/destinations/tiktok-audiences/functions.ts +++ b/packages/destination-actions/src/destinations/tiktok-audiences/functions.ts @@ -69,9 +69,13 @@ export async function createAudience( } export function validate(payloads: GenericPayload[]): void { - if (payloads[0].send_email === false && payloads[0].send_advertising_id === false) { + if ( + payloads[0].send_email === false && + payloads[0].send_advertising_id === false && + payloads[0].send_phone === false + ) { throw new IntegrationError( - 'At least one of `Send Email`, or `Send Advertising ID` must be set to `true`.', + 'At least one of `Send Email`, `Send Phone` or `Send Advertising ID` must be set to `true`.', 'INVALID_SETTINGS', 400 ) @@ -85,6 +89,9 @@ export function getIDSchema(payload: GenericPayload): string[] { if (payload.send_email === true) { id_schema.push('EMAIL_SHA256') } + if (payload.send_phone === true) { + id_schema.push('PHONE_SHA256') + } if (payload.send_advertising_id === true) { id_schema.push('IDFA_SHA256') } @@ -127,6 +134,17 @@ export function extractUsers(payloads: GenericPayload[]): {}[][] { user_ids.push(email_id) } + if (payload.send_phone === true) { + let phone_id = {} + if (payload.phone) { + phone_id = { + id: createHash('sha256').update(payload.phone).digest('hex'), + audience_ids: [external_audience_id] + } + } + user_ids.push(phone_id) + } + if (payload.send_advertising_id === true) { let advertising_id = {} if (payload.advertising_id) { diff --git a/packages/destination-actions/src/destinations/tiktok-audiences/properties.ts b/packages/destination-actions/src/destinations/tiktok-audiences/properties.ts index 74391c115b..c8697360f9 100644 --- a/packages/destination-actions/src/destinations/tiktok-audiences/properties.ts +++ b/packages/destination-actions/src/destinations/tiktok-audiences/properties.ts @@ -43,31 +43,53 @@ export const email: InputField = { label: 'User Email', description: "The user's email address to send to TikTok.", type: 'string', - unsafe_hidden: true, // This field is hidden from customers because the desired value always appears at path '$.context.traits.email' in Personas events. default: { - '@path': '$.context.traits.email' + '@if': { + exists: { '@path': '$.context.traits.email' }, + then: { '@path': '$.context.traits.email' }, + else: { '@path': '$.properties.email' } + } } } export const send_email: InputField = { - label: 'Send Email', + label: 'Send Email?', description: 'Send email to TikTok. Segment will hash this value before sending', type: 'boolean', default: true } +export const phone: InputField = { + label: 'User Phone Number', + description: "The user's phone number to send to TikTok.", + type: 'string', + default: { + '@if': { + exists: { '@path': '$.context.traits.phone' }, + then: { '@path': '$.context.traits.phone' }, + else: { '@path': '$.properties.phone' } + } + } +} + +export const send_phone: InputField = { + label: 'Send Phone Number?', + description: 'Send phone number to TikTok. Segment will hash this value before sending', + type: 'boolean', + default: true +} + export const advertising_id: InputField = { label: 'User Advertising ID', description: "The user's mobile advertising ID to send to TikTok. This could be a GAID, IDFA, or AAID", type: 'string', - unsafe_hidden: true, // This field is hidden from customers because the desired value always appears at path '$.context.device.advertisingId' in Personas events. default: { '@path': '$.context.device.advertisingId' } } export const send_advertising_id: InputField = { - label: 'Send Mobile Advertising ID', + label: 'Send Mobile Advertising ID?', description: 'Send mobile advertising ID (IDFA, AAID or GAID) to TikTok. Segment will hash this value before sending.', type: 'boolean', @@ -88,7 +110,8 @@ export const enable_batching: InputField = { label: 'Enable Batching', description: 'Enable batching of requests to the TikTok Audiences.', type: 'boolean', - default: true + default: true, + unsafe_hidden: true } export const external_audience_id: InputField = { diff --git a/packages/destination-actions/src/destinations/tiktok-audiences/removeFromAudience/__tests__/index.test.ts b/packages/destination-actions/src/destinations/tiktok-audiences/removeFromAudience/__tests__/index.test.ts index d797860d9f..89b33a36d4 100644 --- a/packages/destination-actions/src/destinations/tiktok-audiences/removeFromAudience/__tests__/index.test.ts +++ b/packages/destination-actions/src/destinations/tiktok-audiences/removeFromAudience/__tests__/index.test.ts @@ -29,7 +29,8 @@ const event = createTestEvent({ advertisingId: ADVERTISING_ID }, traits: { - email: 'testing@testing.com' + email: 'testing@testing.com', + phone: '1234567890' }, personas: { audience_settings: { @@ -42,7 +43,7 @@ const event = createTestEvent({ }) const updateUsersRequestBody = { - id_schema: ['EMAIL_SHA256', 'IDFA_SHA256'], + id_schema: ['EMAIL_SHA256', 'PHONE_SHA256', 'IDFA_SHA256'], advertiser_ids: [ADVERTISER_ID], action: 'delete', batch_data: [ @@ -51,6 +52,10 @@ const updateUsersRequestBody = { id: '584c4423c421df49955759498a71495aba49b8780eb9387dff333b6f0982c777', audience_ids: [EXTERNAL_AUDIENCE_ID] }, + { + id: 'c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646', + audience_ids: [EXTERNAL_AUDIENCE_ID] + }, { id: '0315b4020af3eccab7706679580ac87a710d82970733b8719e70af9b57e7b9e6', audience_ids: [EXTERNAL_AUDIENCE_ID] @@ -154,9 +159,10 @@ describe('TiktokAudiences.removeFromAudience', () => { selected_advertiser_id: '123', audience_id: '123456', send_email: false, - send_advertising_id: false + send_advertising_id: false, + send_phone: false } }) - ).rejects.toThrow('At least one of `Send Email`, or `Send Advertising ID` must be set to `true`.') + ).rejects.toThrow('At least one of `Send Email`, `Send Phone` or `Send Advertising ID` must be set to `true`.') }) }) diff --git a/packages/destination-actions/src/destinations/tiktok-audiences/removeFromAudience/generated-types.ts b/packages/destination-actions/src/destinations/tiktok-audiences/removeFromAudience/generated-types.ts index 87e5448708..df0e8160a2 100644 --- a/packages/destination-actions/src/destinations/tiktok-audiences/removeFromAudience/generated-types.ts +++ b/packages/destination-actions/src/destinations/tiktok-audiences/removeFromAudience/generated-types.ts @@ -5,6 +5,10 @@ export interface Payload { * The user's email address to send to TikTok. */ email?: string + /** + * The user's phone number to send to TikTok. + */ + phone?: string /** * The user's mobile advertising ID to send to TikTok. This could be a GAID, IDFA, or AAID */ @@ -13,6 +17,10 @@ export interface Payload { * Send email to TikTok. Segment will hash this value before sending */ send_email?: boolean + /** + * Send phone number to TikTok. Segment will hash this value before sending + */ + send_phone?: boolean /** * Send mobile advertising ID (IDFA, AAID or GAID) to TikTok. Segment will hash this value before sending. */ diff --git a/packages/destination-actions/src/destinations/tiktok-audiences/removeFromAudience/index.ts b/packages/destination-actions/src/destinations/tiktok-audiences/removeFromAudience/index.ts index 09f6f9ac73..077222e2e1 100644 --- a/packages/destination-actions/src/destinations/tiktok-audiences/removeFromAudience/index.ts +++ b/packages/destination-actions/src/destinations/tiktok-audiences/removeFromAudience/index.ts @@ -4,7 +4,9 @@ import type { Payload } from './generated-types' import { processPayload } from '../functions' import { email, + phone, send_email, + send_phone, send_advertising_id, advertising_id, event_name, @@ -19,8 +21,10 @@ const action: ActionDefinition = { defaultSubscription: 'event = "Audience Exited"', fields: { email: { ...email }, + phone: { ...phone }, advertising_id: { ...advertising_id }, send_email: { ...send_email }, + send_phone: { ...send_phone }, send_advertising_id: { ...send_advertising_id }, event_name: { ...event_name }, enable_batching: { ...enable_batching }, diff --git a/packages/destination-actions/src/destinations/tiktok-audiences/removeUser/__tests__/index.test.ts b/packages/destination-actions/src/destinations/tiktok-audiences/removeUser/__tests__/index.test.ts index 114ad04c54..9edc219614 100644 --- a/packages/destination-actions/src/destinations/tiktok-audiences/removeUser/__tests__/index.test.ts +++ b/packages/destination-actions/src/destinations/tiktok-audiences/removeUser/__tests__/index.test.ts @@ -26,7 +26,8 @@ const event = createTestEvent({ advertisingId: '123' }, traits: { - email: 'testing@testing.com' + email: 'testing@testing.com', + phone: '1234567890' } } }) @@ -34,13 +35,17 @@ const event = createTestEvent({ const updateUsersRequestBody = { advertiser_ids: ['123'], action: 'delete', - id_schema: ['EMAIL_SHA256', 'IDFA_SHA256'], + id_schema: ['EMAIL_SHA256', 'PHONE_SHA256', 'IDFA_SHA256'], batch_data: [ [ { id: '584c4423c421df49955759498a71495aba49b8780eb9387dff333b6f0982c777', audience_ids: ['1234345'] }, + { + id: 'c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646', + audience_ids: ['1234345'] + }, { id: 'a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3', audience_ids: ['1234345'] @@ -103,9 +108,10 @@ describe('TiktokAudiences.removeUser', () => { selected_advertiser_id: '123', audience_id: '123456', send_email: false, - send_advertising_id: false + send_advertising_id: false, + send_phone: false } }) - ).rejects.toThrow('At least one of `Send Email`, or `Send Advertising ID` must be set to `true`.') + ).rejects.toThrow('At least one of `Send Email`, `Send Phone` or `Send Advertising ID` must be set to `true`.') }) }) diff --git a/packages/destination-actions/src/destinations/tiktok-audiences/removeUser/generated-types.ts b/packages/destination-actions/src/destinations/tiktok-audiences/removeUser/generated-types.ts index ac0bb830f7..444db36fe4 100644 --- a/packages/destination-actions/src/destinations/tiktok-audiences/removeUser/generated-types.ts +++ b/packages/destination-actions/src/destinations/tiktok-audiences/removeUser/generated-types.ts @@ -13,6 +13,10 @@ export interface Payload { * The user's email address to send to TikTok. */ email?: string + /** + * The user's phone number to send to TikTok. + */ + phone?: string /** * The user's mobile advertising ID to send to TikTok. This could be a GAID, IDFA, or AAID */ @@ -21,6 +25,10 @@ export interface Payload { * Send email to TikTok. Segment will hash this value before sending */ send_email?: boolean + /** + * Send phone number to TikTok. Segment will hash this value before sending + */ + send_phone?: boolean /** * Send mobile advertising ID (IDFA, AAID or GAID) to TikTok. Segment will hash this value before sending. */ diff --git a/packages/destination-actions/src/destinations/tiktok-audiences/removeUser/index.ts b/packages/destination-actions/src/destinations/tiktok-audiences/removeUser/index.ts index 131ef737da..dd64a7b6a9 100644 --- a/packages/destination-actions/src/destinations/tiktok-audiences/removeUser/index.ts +++ b/packages/destination-actions/src/destinations/tiktok-audiences/removeUser/index.ts @@ -6,7 +6,9 @@ import { selected_advertiser_id, audience_id, email, + phone, send_email, + send_phone, send_advertising_id, advertising_id, event_name, @@ -26,8 +28,10 @@ const action: ActionDefinition = { selected_advertiser_id: { ...selected_advertiser_id }, audience_id: { ...audience_id }, email: { ...email }, + phone: { ...phone }, advertising_id: { ...advertising_id }, send_email: { ...send_email }, + send_phone: { ...send_phone }, send_advertising_id: { ...send_advertising_id }, event_name: { ...event_name }, enable_batching: { ...enable_batching }