Skip to content

improvement(apollo): align tools and block with Apollo API docs#4487

Open
waleedlatif1 wants to merge 14 commits intostagingfrom
waleedlatif1/validate-apollo
Open

improvement(apollo): align tools and block with Apollo API docs#4487
waleedlatif1 wants to merge 14 commits intostagingfrom
waleedlatif1/validate-apollo

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • aligned all 25 Apollo tools and the block with the official Apollo API (verified via context7 docs)
  • fixed endpoints (account_create canonical path, task_create flat body, sequence_add response shape)
  • bulk_update tools now accept array-shaped attributes; added uniform name/owner_id for account_bulk_update
  • added documented optional fields across people/org/contact/account/opportunity search and create/update flows
  • preserved subBlock IDs for backwards compatibility via params remapping; defensive migration entries already present

Type of Change

  • Improvement

Testing

Tested manually. Lint and typecheck pass.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment May 7, 2026 4:57pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 7, 2026

PR Summary

Medium Risk
Medium risk because it changes request/response shapes and parameter mapping across many Apollo tools (including endpoint/method changes and bulk update semantics), which could break existing workflows if migrations/mappings are incomplete.

Overview
Updates Apollo docs and the Sim Apollo block/tooling to match current Apollo API behavior, adding many newly supported filters/fields across people/org/contact/account/opportunity/sequence/task operations.

Several tools change request semantics (e.g., org enrich requires domain and uses GET+query params; people enrich/bulk enrich move reveal flags/webhooks to query params; opportunity search switches to GET; bulk update tools accept *_ids + *_attributes with optional async; account bulk create adds run_dedupe/labels and returns created+existing counts).

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.

Comment thread apps/sim/blocks/blocks/apollo.ts
Comment thread apps/sim/blocks/blocks/apollo.ts Outdated
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 7, 2026

Greptile Summary

This 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 (stage_idopportunity_stage_id, close_dateclosed_date, website_urldomain), and adding documented optional parameters across all tools. Backwards-compatibility migrations and UI sub-block ID remapping are included.

  • Endpoint & request-shape fixes: organization_enrich and opportunity_search converted to GET; organization_bulk_enrich and people/bulk_match reveal flags moved to query params; sequence_add_contacts now requires send_email_from_email_account_id and accepts label_names in addition to contact_ids.
  • Bulk-operation redesign: contact_bulk_update and account_bulk_update both refactored to accept either an ID array + uniform fields, or a per-item *_attributes array; contact_bulk_update adds a full guard suite including object-form-without-ids protection, but the equivalent guard is missing from account_bulk_update.
  • Field additions: Phone fields, typed_custom_fields, label_names, sort/filter params, and enrichment identifiers added across create/update/search tools; types.ts updated to match.

Confidence Score: 4/5

Safe 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

Filename Overview
apps/sim/tools/apollo/account_bulk_update.ts Redesigned to accept account_ids+uniform fields or account_attributes array; both empty-body guards added, but the object-form account_attributes without account_ids case is unguarded (unlike the fixed contact_bulk_update.ts).
apps/sim/tools/apollo/contact_bulk_update.ts Redesigned bulk-update shape with correct validation guards for both empty-body and object-form-without-ids cases; outputs updated to reflect Apollo's async response shape.
apps/sim/tools/apollo/sequence_add_contacts.ts Replaced contact_ids-only requirement with contact_ids
apps/sim/tools/apollo/task_create.ts Aligned to Apollo's bulk task endpoint: user_id, contact_ids, priority, due_at, type, status all now required; defensive response parsing handles varying Apollo return shapes.
apps/sim/tools/apollo/opportunity_search.ts Converted from POST with body to GET with query params; removed unsupported filters and replaced with sort_by_field.
apps/sim/tools/apollo/organization_enrich.ts Converted to GET with domain as required query param; removed organization_name option and Content-Type header.
apps/sim/tools/apollo/organization_bulk_enrich.ts Moved domains to query-string params on a body-less POST; Content-Type header dropped; response parsing updated.
apps/sim/blocks/blocks/apollo.ts Extensive field additions with JSON parsing refactored into a loop; remapping logic added for task_notes and sequence_add_label_names.
apps/sim/lib/workflows/migrations/subblock-migrations.ts Added apollo migrations for close_date and stage_id renames; website_url omitted intentionally.
apps/sim/tools/apollo/types.ts Comprehensive type updates across all interfaces to match new API shapes.
apps/sim/tools/apollo/people_bulk_enrich.ts Moved reveal flags and webhook_url to query params; response renamed to matches with enrichment metadata.

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
Loading

Reviews (6): Last reviewed commit: "validate" | Re-trigger Greptile

Comment thread apps/sim/blocks/blocks/apollo.ts
Comment thread apps/sim/blocks/blocks/apollo.ts
Comment thread apps/sim/tools/apollo/contact_bulk_update.ts
Comment thread apps/sim/tools/apollo/sequence_add_contacts.ts Outdated
Comment thread apps/sim/tools/apollo/organization_bulk_enrich.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

bugbot run

Comment thread apps/sim/tools/apollo/account_bulk_update.ts
Comment thread apps/sim/tools/apollo/contact_bulk_update.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

Comment thread apps/sim/lib/workflows/migrations/subblock-migrations.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/tools/apollo/account_bulk_update.ts
Comment thread apps/sim/tools/apollo/account_bulk_update.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/tools/apollo/contact_bulk_update.ts
Comment thread apps/sim/tools/apollo/contact_bulk_update.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment on lines +92 to +96
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).'
)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 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.

Suggested change
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.'
)
}

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ 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
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ff98127. Configure here.

placeholder: '["Hot Lead", "Q4 Outreach"]',
condition: { field: 'operation', value: 'contact_bulk_create' },
mode: 'advanced',
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ff98127. Configure here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants