Skip to content

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

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

improvement(apollo): align tools and block with Apollo API docs#4487
waleedlatif1 wants to merge 15 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 7, 2026 7:34pm

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; mistakes could break existing workflows or change API behavior (bulk update semantics, enrich endpoints), but changes are largely additive/compatibility-focused.

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

This expands supported filters/fields for people/org/contact/account/opportunity operations, adjusts several endpoints and parameter conventions (notably organization enrich/bulk enrich and opportunity search), and refines response parsing to handle multiple Apollo payload shapes.

Bulk create/update flows are reworked to support dedupe/labels, uniform updates via *_ids + shared attributes, async job responses, and backward compatibility via subblock ID migrations plus improved JSON parsing/mapping in the Apollo block.

Reviewed by Cursor Bugbot for commit 69aa833. 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 block with the official Apollo API by fixing endpoints, correcting request shapes, adding documented optional fields, and preserving backwards compatibility through subblock migrations and params remapping. All issues flagged in earlier review rounds have been addressed in subsequent commits.

  • Fixed endpoint paths (account_create canonical URL, task_create flat body, sequence_add response shape) and added optional fields (search filters, phone numbers, custom fields, stage IDs) across all operations.
  • Introduced splitBulkUpdateInput to handle the legacy single-field bulk-update UI while keeping the new separate IDs / attributes sub-blocks working; added runtime guards so empty or ambiguous payloads throw a clear error before hitting Apollo.
  • Added subblock-ID migrations for renamed fields (close_date → closed_date, stage_id → opportunity_stage_id) so existing saved workflows keep their values after the upgrade.

Confidence Score: 5/5

This PR is safe to merge — all previously flagged validation gaps and remapping omissions have been resolved, and the remaining changes are additive optional fields with no breaking effect.

All runtime guards (empty bulk-update bodies, object-form attributes without target IDs, sequence add without identifiers) are now present and logically correct. The params remapping in the block correctly renames every renamed sub-block field before it reaches the underlying tool, including the previously missing task_notes → note. The subblock migration table covers the renamed opportunity fields. No new unguarded paths were introduced.

No files require special attention; the most complex logic (account_bulk_update.ts, contact_bulk_update.ts, and the apollo.ts block params function) all have correct, layered validation.

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/apollo.ts Central block definition — adds new sub-blocks for search filters, contact fields, and uniform bulk-update fields; params function correctly remaps all renamed sub-block IDs (task_notes→note, account_bulk_update_name→name, opportunity_name→name, etc.) before dispatch.
apps/sim/tools/apollo/account_bulk_update.ts Rewritten to accept separate account_ids+name/owner_id (uniform) or account_attributes array (per-account); three layered guards prevent dispatch with no targets, no update fields, or object-form attributes without account_ids.
apps/sim/tools/apollo/contact_bulk_update.ts Now requires contact_attributes (array or object); guards correctly block both missing-attributes and object-form-without-contact_ids cases before the Apollo call.
apps/sim/lib/workflows/migrations/subblock-migrations.ts Migration table updated with close_date→closed_date and stage_id→opportunity_stage_id; website_url→domain intentionally omitted to avoid corrupting the new contact_create/contact_update website_url field.
apps/sim/tools/apollo/sequence_add_contacts.ts Added runtime guard requiring either contact_ids or label_names; response normalisation handles both flat contacts array and contacts.added/skipped shapes from Apollo.
apps/sim/tools/apollo/organization_bulk_enrich.ts Switches to query-string domain params on a body-less POST; Content-Type header correctly dropped to match the no-body request.
apps/sim/tools/apollo/task_create.ts Flat body shape aligned to Apollo's bulk_create endpoint; note field correctly included in the request body (block remaps task_notes→note before dispatch).
apps/sim/tools/apollo/opportunity_create.ts Renamed stage_id→opportunity_stage_id and close_date→closed_date to match API docs; subblock migration covers legacy workflow values.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    UI["Apollo Block UI\n(sub-blocks)"] --> PM["params() remapping\n• task_notes → note\n• opportunity_name → name\n• account_name → name\n• account_bulk_update_name → name\n• sequence_add_label_names → label_names\n• contact_run_dedupe → run_dedupe"]
    PM --> SBM["splitBulkUpdateInput()\n(contacts / accounts field)"]
    SBM -->|"strings only"| IDS["→ contact_ids / account_ids"]
    SBM -->|"objects with id"| ATTRS["→ contact_attributes / account_attributes"]
    SBM -->|"both"| ATTRS
    IDS --> GUARDS
    ATTRS --> GUARDS
    subgraph GUARDS ["Runtime guards (bulk update tools)"]
        G1["No update fields? → throw"]
        G2["No target IDs and no attributes? → throw"]
        G3["Object-form attributes without IDs? → throw"]
    end
    GUARDS --> API["Apollo API"]
    subgraph MIGRATIONS ["Subblock migrations on workflow load"]
        M1["close_date → closed_date"]
        M2["stage_id → opportunity_stage_id"]
        M3["contact_ids_bulk → contacts"]
        M4["account_ids_bulk → accounts"]
    end
    MIGRATIONS -->|"value preserved"| UI
Loading

Reviews (7): Last reviewed commit: "fix(apollo): mirror bulk_update guard, p..." | 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 thread apps/sim/tools/apollo/account_bulk_update.ts
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.

Comment thread apps/sim/blocks/blocks/apollo.ts
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

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