Skip to content

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

Merged
waleedlatif1 merged 25 commits intostagingfrom
waleedlatif1/validate-apollo
May 8, 2026
Merged

improvement(apollo): align tools and block with Apollo API docs#4487
waleedlatif1 merged 25 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 2:23am

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 7, 2026

PR Summary

Medium Risk
Touches many Apollo tool request/response shapes and block parameter mappings; misalignment could break existing workflows despite added migrations and defensive parsing.

Overview
Updates the Apollo integration to match current Apollo API behavior across docs, UI block config, and tool implementations.

This expands supported filters/fields for people/org/contact/account/opportunity/sequence/task operations, adjusts endpoints and payload formats (notably bulk create/update, people enrich phone reveal via webhook_url, and opportunities search as a GET with query params), and makes responses more defensive/consistent (nullable outputs, updated bulk enrich/bulk create counts, sequence add returns added/skipped).

Adds Apollo-specific subblock ID migrations and block-side JSON parsing/mapping to preserve backwards compatibility while introducing new inputs like uniform bulk-update (*_ids + attributes) and dedupe/label options.

Reviewed by Cursor Bugbot for commit ae40b0e. 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 documentation, fixing endpoints, request shapes, and field names across the full tool suite. All previously-flagged issues from iterative review rounds have been resolved in follow-up commits.

  • Endpoint & method corrections: opportunity_search migrated from POST with body to GET with query params; organization_bulk_enrich now uses a JSON body instead of domain query params on a POST; account_create canonical path corrected; task_create uses a flat body.
  • Bulk-update guard hardening: Both contact_bulk_update and account_bulk_update now carry multi-stage validation guards that prevent empty-body requests, object-form attributes without target IDs, and conflicting *_ids/array-attributes combinations.
  • Subblock migration table: Entries added for all renamed subblocks (close_date → closed_date, stage_id → opportunity_stage_id, note → task_notes) and removed fields marked _removed_*; the problematic account_ids blanket-rename entry that would have corrupted account_bulk_update state was dropped.

Confidence Score: 5/5

Safe to merge — all previously-identified issues have been resolved in follow-up commits and the current code is consistent across tools, block, and migration table.

The bulk-update guard logic in both contact and account tools now covers every invalid input combination. The subblock migration table is complete with no dangerous blanket renames. Endpoint changes are internally consistent and the block params function correctly remaps all renamed subblock IDs before dispatching to tools.

No files require special attention — the most sensitive areas (bulk-update guards and migration table) were reviewed thoroughly and are correct.

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/apollo.ts Comprehensive block rewrite adding new optional fields, fixing subblock conditions, and adding all necessary params remappings (task_notes→note, account_bulk_update_name→name, etc.).
apps/sim/lib/workflows/migrations/subblock-migrations.ts Apollo migration table completed: close_date→closed_date, stage_id→opportunity_stage_id, note→task_notes added; account_ids blanket-rename dropped to avoid corrupting account_bulk_update state.
apps/sim/tools/apollo/account_bulk_update.ts Rewrites bulk-update body builder with four layered guards covering all invalid input combinations; async flag forwarded correctly after guards pass.
apps/sim/tools/apollo/contact_bulk_update.ts Parallel guard structure to account_bulk_update; requires contact_attributes, blocks object-form without contact_ids, and blocks mixing array attrs with contact_ids.
apps/sim/tools/apollo/sequence_add_contacts.ts Runtime guard added requiring at least one of contact_ids or label_names; response shape handling covers both flat and wrapped Apollo response variants.
apps/sim/tools/apollo/opportunity_search.ts Migrated from POST with body to GET with query params, removing unsupported filter fields; response extraction now uses null-coalescing operators.
apps/sim/tools/apollo/organization_bulk_enrich.ts Changed from domain query params on POST to organizations JSON body; Content-Type header kept which is now correct since a body is present.
apps/sim/tools/apollo/task_create.ts Flat body structure aligned with Apollo bulk_create endpoint; note field accepted directly as params.note (block remaps task_notes → note upstream).
apps/sim/tools/apollo/account_create.ts Renamed website_url → domain, added account_stage_id, raw_address, typed_custom_fields; URL corrected to /api/v1/accounts.
apps/sim/tools/apollo/types.ts Type definitions updated across all 25 tools to reflect new fields, renamed params, and corrected response shapes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[account_bulk_update call] --> B{account_ids provided?}
    B -- yes --> C[body.account_ids = ids]
    B -- no --> D[body.account_ids empty]
    C --> E{name / owner_id provided?}
    D --> E
    E -- yes --> F[add name/owner_id to body]
    E -- no --> G[skip]
    F --> H{account_attributes provided?}
    G --> H
    H -- array form --> I[body.account_attributes = array]
    H -- object form --> J[body.account_attributes = object]
    H -- absent --> K[skip]
    I --> L{hasUpdateFields?}
    J --> L
    K --> L
    L -- no --> M[throw: no update fields]
    L -- yes --> N{account_ids AND account_attributes absent?}
    N -- yes --> O[throw: need ids or attributes]
    N -- no --> P{object-form attrs WITHOUT account_ids?}
    P -- yes --> Q[throw: object attrs require account_ids]
    P -- no --> R{account_ids AND array-form attrs?}
    R -- yes --> S[throw: cannot combine]
    R -- no --> T[dispatch to Apollo]
Loading

Reviews (17): Last reviewed commit: "fix(apollo): reject ambiguous account/co..." | 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
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

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/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/tools/apollo/account_bulk_update.ts
@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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit ae40b0e. Configure here.

@waleedlatif1 waleedlatif1 merged commit 6a00685 into staging May 8, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/validate-apollo branch May 8, 2026 02:39
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