Skip to content

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

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

improvement(apollo): align tools and block with Apollo API docs#4487
waleedlatif1 wants to merge 22 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.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 8, 2026 1:45am

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 7, 2026

PR Summary

Medium Risk
Moderate risk because multiple Apollo tool request/response shapes and parameter requirements changed (bulk update semantics, sequence/task endpoints, enrich inputs), which could break existing workflows if migrations/mappings miss edge cases.

Overview
Aligns the Apollo docs, block UI, and tool implementations with Apollo’s current API by expanding supported filters/fields across people/org/contact/account/opportunity operations and updating parameter names/types (e.g., opportunity_stage_id, closed_date, richer search sorting/filters).

Updates several tool endpoints and payload/response handling: people enrich/bulk enrich now pass reveal flags via querystring and return richer enrichment stats; org enrich now requires domain and org bulk enrich switches to organizations payload; sequence add supports label-based adds, requires email account ID, and normalizes varied response shapes; task create becomes bulk-create per contact_ids with required task metadata.

Improves robustness and backward compatibility by trimming IDs in URLs, normalizing outputs to arrays/nullables, adding dedupe/label options for bulk creates, revising account/contact bulk update inputs (IDs vs attributes + async), and adding Apollo-specific subblock param migrations/remapping plus safer JSON parsing in the block.

Reviewed by Cursor Bugbot for commit 4521402. 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 Apollo block with the official Apollo API, fixing endpoint paths, field names, body shapes, and adding documented optional fields across search, create, and update operations. Several correctness issues surfaced in prior review rounds have been resolved, including missing sub-block migrations, silent param drops, empty-body guard gaps, and a query-param POST with no body.

  • Endpoint & schema fixes: account_create uses /accounts POST, task_create moves to bulk_create, opportunity_create/update rename close_date→closed_date and stage_id→opportunity_stage_id, account_create/update rename website_url→domain; migrations cover all three renames.
  • Bulk-update hardening: Both contact_bulk_update and account_bulk_update now validate that array-form attributes carry embedded IDs and object-form attributes must be paired with explicit ID lists, preventing silent 4xx from Apollo.
  • Migration table: All renamed subblock IDs have entries; the account_ids collision (would have wiped the new account_bulk_update field on every load) was dropped.

Confidence Score: 5/5

Safe to merge — all identified correctness issues from prior rounds are resolved and the new validation guards are complete.

The changes are well-scoped API alignment work: field renames, endpoint corrections, guard additions, and migration entries. All gaps flagged in previous review rounds (missing remaps, silent param drops, empty-body paths, migration collisions) have been addressed in subsequent commits. The bulk-update guard logic in both contact and account tools has been verified across every combination of inputs. Sub-block migrations are consistent with the renamed fields.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/apollo.ts Major refactor: new subBlocks for 25 operations, consolidated JSON-parse loop, task_notes→note remap, splitBulkUpdateInput helper, account/contact bulk-update routing, and sequence/opportunity/task remapping all present
apps/sim/lib/workflows/migrations/subblock-migrations.ts Apollo migration table now covers close_date→closed_date, stage_id→opportunity_stage_id, note→task_notes; account_ids collision entry dropped; description/stage_ids/owner_ids tombstoned
apps/sim/tools/apollo/account_bulk_update.ts Restructured to accept account_ids+name/owner_id OR array/object-form account_attributes; three-layer guard prevents empty-body requests and object-form attributes without target IDs
apps/sim/tools/apollo/contact_bulk_update.ts Replaced single contacts param with contact_ids + contact_attributes; guards correctly block missing attributes and object-form attributes without contact_ids
apps/sim/tools/apollo/sequence_add_contacts.ts Added 11 optional sequence flag params; runtime guard throws when neither contact_ids nor label_names is provided; response handling covers both flat and nested contacts shapes
apps/sim/tools/apollo/organization_bulk_enrich.ts Switched from query-param POST to proper JSON body sending organizations array; Content-Type header correctly retained alongside the body
apps/sim/tools/apollo/task_create.ts Endpoint changed to bulk_create, note field properly named (matches block's task_notes→note remap), body cleaned up from any to Record<string, unknown>
apps/sim/tools/apollo/account_create.ts website_url renamed to domain per Apollo spec; added account_stage_id, raw_address, typed_custom_fields; response normalised to handle flat-id shape
apps/sim/tools/apollo/people_bulk_enrich.ts Optional reveal params moved to query string; body now uses details key per bulk_match spec; added webhook_url for async phone delivery
apps/sim/tools/apollo/types.ts Extensive type additions across all 25 Apollo tool param/response interfaces, aligning with the updated tool implementations

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Apollo Block params fn] --> B{operation?}
    B -->|contact_bulk_update| C[splitBulkUpdateInput contacts]
    B -->|account_bulk_update| D[splitBulkUpdateInput accounts]
    B -->|task_create| E[remap task_notes → note]
    B -->|opportunity_create/update| F[remap opportunity_name → name]
    B -->|sequence_add| G[remap sequence_add_label_names → label_names]

    C --> C1{attributes present?}
    C1 -->|yes| C2[merge ids into attributes array → contact_attributes]
    C1 -->|no| C3[ids → contact_ids]

    D --> D1{attributes present?}
    D1 -->|yes| D2[merge ids into attributes array → account_attributes]
    D1 -->|no| D3[ids → account_ids]

    C2 --> T[Tool body fn]
    C3 --> T
    D2 --> T
    D3 --> T
    E --> T
    F --> T
    G --> T

    T --> V{Validation guards}
    V -->|contact: no contact_attributes| ERR1[throw - missing attributes]
    V -->|contact: object attrs + no ids| ERR2[throw - need contact_ids]
    V -->|account: no update fields| ERR3[throw - missing update fields]
    V -->|account: object attrs + no ids| ERR4[throw - need account_ids]
    V -->|sequence: no ids + no labels| ERR5[throw - need identifier]
    V -->|pass| API[Apollo API call]
Loading

Reviews (14): Last reviewed commit: "fix(apollo): drop colliding account_ids ..." | 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 Outdated
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 and others added 2 commits May 7, 2026 14:36
Final pass over the Apollo integration after a per-tool forensic audit
against Apollo.io docs. Notable fixes:

- organization_enrich: GET+querystring -> POST+JSON body (canonical, non
  master-key)
- organization_bulk_enrich: ?domains[]= -> JSON body { organizations }
- people_search: declare/forward organization_num_employees_ranges; fix
  contact_email_status placeholder ("likely to engage", with spaces)
- account_bulk_create: surface failed_accounts and failed count
- contact_bulk_create: expand documented per-contact fields (CRM IDs,
  phone_numbers, contact_emails, typed_custom_fields, etc.)
- sequence_add_contacts: surface remaining documented filter params
- task_create: confirm wire field name (note) and remap from task_notes
- types: tighten params/responses for the above

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

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

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

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/lib/workflows/migrations/subblock-migrations.ts
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

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/tools/apollo/people_enrich.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 Outdated
Comment thread apps/sim/tools/apollo/contact_bulk_update.ts Outdated
Comment thread apps/sim/blocks/blocks/apollo.ts Outdated
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

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 1 potential issue.

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 4521402. Configure here.

if (Array.isArray(params.account_attributes)) {
if (params.account_attributes.length > 0) {
body.account_attributes = params.account_attributes
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing array size limit on account_attributes in bulk update

Medium Severity

The array-form account_attributes is sent to Apollo without any .slice() cap, while account_ids is capped at 1000 (line 70) and contact_attributes in the sibling contact_bulk_update tool is capped at 100 (line 62). The tool description states a 1000-account limit, so exceeding it could cause Apollo API errors or unexpected behavior.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4521402. 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