improvement(apollo): align tools and block with Apollo API docs#4487
improvement(apollo): align tools and block with Apollo API docs#4487waleedlatif1 wants to merge 14 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Several tools change request semantics (e.g., org enrich requires The Apollo block UI is expanded/reworked to expose the new params, improve JSON parsing/validation, remap legacy field names for backwards compatibility, and includes a migration map for renamed/changed Apollo subblock parameters. Reviewed by Cursor Bugbot for commit ff98127. Configure here. |
Greptile SummaryThis PR aligns all 25 Apollo tools and the unified block with the official Apollo API by correcting endpoints, fixing request shapes (POST→GET for opportunity/org search, query-string params for bulk enrich), renaming fields (
Confidence Score: 4/5Safe to merge after addressing the missing object-form guard in account_bulk_update.ts; all other endpoint and field changes look correct and well-validated. The account_bulk_update body builder accepts a non-array account_attributes object without account_ids and forwards the resulting body to Apollo without error, mirroring the exact defect that was already fixed in contact_bulk_update.ts. A user or LLM passing a single object instead of an array would receive a cryptic Apollo API rejection rather than a clear validation message. apps/sim/tools/apollo/account_bulk_update.ts — the object-form account_attributes without account_ids path is unguarded. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Apollo Block UI] -->|params function| B{operation?}
B -->|account_bulk_update| C[extract account_ids from accounts array]
C --> D[remap account_bulk_update_name to name]
D --> E[account_bulk_update.ts body fn]
E --> F{account_ids present?}
F -->|yes| G{name or owner_id?}
G -->|yes| H[body: account_ids + name/owner_id]
G -->|no| I[guard: throw - no update fields]
F -->|no| J{account_attributes present?}
J -->|array| K[body: account_attributes array]
J -->|object| L[body: account_attributes object - missing account_ids guard]
J -->|no| M[guard: throw - no ids or attrs]
H --> N[POST /accounts/bulk_update]
K --> N
L --> N
N -->|response| O[message + account_ids output]
B -->|contact_bulk_update| P[contact_bulk_update.ts body fn]
P --> Q{contact_attributes present?}
Q -->|no| R[guard: throw - contact_attributes required]
Q -->|array| S[body: contact_attributes array]
Q -->|object| T{contact_ids present?}
T -->|no| U[guard: throw - object-form requires contact_ids]
T -->|yes| V[body: contact_ids + contact_attributes object]
S --> W[POST /contacts/bulk_update]
V --> W
Reviews (6): Last reviewed commit: "validate" | Re-trigger Greptile |
e59ab46 to
7447852
Compare
|
@greptile |
|
@cursor review |
|
bugbot run |
|
@cursor review |
|
@greptile |
|
@greptile |
|
@cursor review |
|
@greptile |
|
@cursor review |
|
@greptile |
|
@cursor review |
| if (!body.account_ids && !body.account_attributes) { | ||
| throw new Error( | ||
| 'Apollo account bulk update requires account_ids (with name/owner_id) or account_attributes (with embedded ids).' | ||
| ) | ||
| } |
There was a problem hiding this comment.
The second guard at line 92 only blocks the case where both
account_ids and account_attributes are absent. When account_attributes is a non-empty plain object (not an array) and account_ids is absent, body.account_attributes is truthy so both guards pass, and the request is dispatched to Apollo as { account_attributes: {...} } with no targets. Apollo will reject it with a cryptic error. The parallel fix was applied to contact_bulk_update.ts (if (!Array.isArray(body.contact_attributes) && !body.contact_ids)) but not mirrored here.
| if (!body.account_ids && !body.account_attributes) { | |
| throw new Error( | |
| 'Apollo account bulk update requires account_ids (with name/owner_id) or account_attributes (with embedded ids).' | |
| ) | |
| } | |
| if (!body.account_ids && !body.account_attributes) { | |
| throw new Error( | |
| 'Apollo account bulk update requires account_ids (with name/owner_id) or account_attributes (with embedded ids).' | |
| ) | |
| } | |
| if (!Array.isArray(body.account_attributes) && body.account_attributes && !body.account_ids) { | |
| throw new Error( | |
| 'Apollo account bulk update with object-form account_attributes requires account_ids to identify which accounts to update.' | |
| ) | |
| } |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ff98127. Configure here.
| const ids = extractIds(parsedParams.contacts) | ||
| if (ids) parsedParams.contact_ids = ids | ||
| parsedParams.contacts = undefined | ||
| } |
There was a problem hiding this comment.
Bulk update migration silently drops update fields from old workflows
High Severity
The extractIds remapping for contact_bulk_update and account_bulk_update extracts only the id fields from old-format arrays (e.g., [{"id":"con1","first_name":"John","title":"VP"}]) and discards the rest of each object. The extracted IDs populate contact_ids/account_ids, but the update fields (first_name, title, etc.) are never carried over to contact_attributes/account_attributes. Old saved workflows that stored full update objects in the contacts/accounts subBlock will lose all update data, and the tool's body validation will throw because contact_attributes/account_attributes is missing.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit ff98127. Configure here.
| placeholder: '["Hot Lead", "Q4 Outreach"]', | ||
| condition: { field: 'operation', value: 'contact_bulk_create' }, | ||
| mode: 'advanced', | ||
| }, |
There was a problem hiding this comment.
Account bulk create UI missing new tool parameters
Medium Severity
The account_bulk_create tool adds append_label_names (with visibility: 'user-only') and run_dedupe, but no corresponding subBlocks exist in the block definition for account_bulk_create. The run_dedupe and append_label_names subBlocks only have condition contact_bulk_create. Since append_label_names is user-only, it cannot be set by an LLM either, making the parameter completely inaccessible for account bulk creation.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit ff98127. Configure here.


Summary
Type of Change
Testing
Tested manually. Lint and typecheck pass.
Checklist