Skip to content

Conversation

joe-ayoub-segment
Copy link
Contributor

WIP - TicTok CRM

Testing

TBD

@@ -159,3 +358,17 @@ function validateRequestPage(payload: Payload) {

return requestPage
}

function validateRequestLead(payload: Payload) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please define a return type.

description:
'Lead source of TikTok leads. Please set this field to the name of your CRM system, such as HubSpot or Salesforce.',
type: 'string',
default: { '@path': '$.properties.lead_event_source' }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend adding this

required: {
  conditions: [
    { 
      fieldKey: 'event_source',
      operator: 'is',
      value: 'crm'
    }
  ]
}

Copy link
Contributor Author

@joe-ayoub-segment joe-ayoub-segment Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also

depends_on: {
  conditions: [
    { 
      fieldKey: 'event_source',
      operator: 'is',
      value: 'crm'
    }
  ]
}

This will hide the field if event_source is not crm

label: 'State of the Vehicle',
type: 'string',
description: 'Vehicle status. Supported values: "New", "Used", "CPO".',
default: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think about removing the default.

{ value: 'CPO', label: 'CPO' }
]
},
mileage: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split this into mileage_value and mileage_unit fields.

Comment on lines 659 to 661
default: {
'@path': '$.properties.transmission'
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove defaults.

Comment on lines 674 to 676
default: {
'@path': '$.properties.body_style'
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove defaults.

body_style: {
label: 'Body Type of the Vehicle',
type: 'string',
description:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to enumerate

fuel_type: {
label: 'Fuel Type of the Vehicle',
type: 'string',
description: 'Vehicle fuel type. Supported values: "Diesel", "Electric", "Flex", "Gasoline", "Hybrid", "Other".',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to enumerate in the description

{ value: 'Other', label: 'Other' }
]
},
preferred_price_range: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split into preferred_price_range_min and preferred_price_range_max

lead_id?: string
lead_event_source?: string
}

export interface TikTokConversionsProperties {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

define types for vehicle and travel fields.
define types for crm and web payloads.

Update util logic to ensure the correct types.

},
mileage: {
label: 'Milage of the Vehicle',
travel_fields: {
Copy link
Contributor

@jae-rhee-tiktok jae-rhee-tiktok Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as lead_fields where types were not generated

},
preferred_price_range: {
label: 'Preferred Price Range of the Vehicle',
auto_fields: {
Copy link
Contributor

@jae-rhee-tiktok jae-rhee-tiktok Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as lead_fields where types were not generated

const baseRequestProperties: TikTokConversionsProperties = buildBaseRequestProperties(payload)

if (payload.event_source === 'web') {
if (payload.travel_fields) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I check for travel & auto fields this way to build the properties objects?

Or do i need to check if the actual variables exist (i.e. payload.travel_fields?.city)?

@joe-ayoub-segment
Copy link
Contributor Author

Hi @jae-rhee-tiktok I moved the PR to this internally raised PR #3133

I also did a lot of refactoring.

Shall we schedule a call to finish this off?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants