Skip to content

Commit e59ab46

Browse files
committed
fix(apollo): address PR review comments
1 parent bf20878 commit e59ab46

4 files changed

Lines changed: 22 additions & 4 deletions

File tree

apps/sim/blocks/blocks/apollo.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export const ApolloBlock: BlockConfig<ApolloResponse> = {
178178
},
179179
required: {
180180
field: 'operation',
181-
value: ['organization_enrich', 'account_create'],
181+
value: 'organization_enrich',
182182
},
183183
},
184184
{
@@ -1024,6 +1024,13 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
10241024
parsedParams.sequence_add_label_names = undefined
10251025
}
10261026

1027+
if (params.operation === 'task_create') {
1028+
if (rest.task_notes !== undefined) {
1029+
parsedParams.note = rest.task_notes
1030+
}
1031+
parsedParams.task_notes = undefined
1032+
}
1033+
10271034
if (
10281035
params.operation === 'opportunity_create' ||
10291036
params.operation === 'opportunity_update'

apps/sim/tools/apollo/contact_bulk_update.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ export const apolloContactBulkUpdateTool: ToolConfig<
6868
body.contact_attributes = params.contact_attributes
6969
}
7070
}
71+
if (!body.contact_ids && !body.contact_attributes) {
72+
throw new Error(
73+
'Apollo bulk update requires either contact_ids or contact_attributes to be provided'
74+
)
75+
}
7176
if (params.async !== undefined) body.async = params.async
7277
return body
7378
},

apps/sim/tools/apollo/organization_bulk_enrich.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export const apolloOrganizationBulkEnrichTool: ToolConfig<
3939
},
4040
method: 'POST',
4141
headers: (params: ApolloOrganizationBulkEnrichParams) => ({
42-
'Content-Type': 'application/json',
4342
'Cache-Control': 'no-cache',
4443
'X-Api-Key': params.apiKey,
4544
}),

apps/sim/tools/apollo/sequence_add_contacts.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,19 @@ export const apolloSequenceAddContactsTool: ToolConfig<
9595
'X-Api-Key': params.apiKey,
9696
}),
9797
body: (params: ApolloSequenceAddContactsParams) => {
98+
const hasContactIds = !!params.contact_ids?.length
99+
const hasLabelNames = !!params.label_names?.length
100+
if (!hasContactIds && !hasLabelNames) {
101+
throw new Error(
102+
'Apollo sequence add requires either contact_ids or label_names to be provided'
103+
)
104+
}
98105
const body: Record<string, unknown> = {
99106
emailer_campaign_id: params.sequence_id,
100107
send_email_from_email_account_id: params.send_email_from_email_account_id,
101108
}
102-
if (params.contact_ids?.length) body.contact_ids = params.contact_ids
103-
if (params.label_names?.length) body.label_names = params.label_names
109+
if (hasContactIds) body.contact_ids = params.contact_ids
110+
if (hasLabelNames) body.label_names = params.label_names
104111
if (params.send_email_from_email_address) {
105112
body.send_email_from_email_address = params.send_email_from_email_address
106113
}

0 commit comments

Comments
 (0)