Skip to content

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

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

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

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 parameter mappings; integration behavior may change if workflows relied on previous (incorrect) payloads, despite added migration remaps and more defensive parsing.

Overview
Aligns the Apollo integration (docs + SIM block + tool implementations) with current Apollo API behavior by expanding supported filters/fields, fixing required/optional parameters, and correcting several request payloads.

Notable behavior changes include: revamped bulk update inputs for contacts/accounts (supporting *_ids + *_attributes and async), updated people/org/account/contact search/create/update parameters, stricter org enrich requiring domain, and multiple endpoint/response-shape fixes (e.g., opportunities search now GET with query params, sequence add contacts accepts labels and parses varied responses, task create uses bulk-create semantics).

Adds more robust JSON parsing and backward-compatible subblock parameter migrations/remaps, and updates output handling to tolerate Apollo’s varying response schemas.

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

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

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