Skip to content

improvement(instantly): validate integration against live API, add lead/campaign lifecycle tools#5448

Merged
waleedlatif1 merged 2 commits into
stagingfrom
validate-instantly-integration
Jul 6, 2026
Merged

improvement(instantly): validate integration against live API, add lead/campaign lifecycle tools#5448
waleedlatif1 merged 2 commits into
stagingfrom
validate-instantly-integration

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Ran a full validation pass on the Instantly integration against the live Instantly API v2 docs — every tool's endpoint, params, and response mapping cross-checked
  • Added 3 missing high-value tools: instantly_patch_lead (update a lead), instantly_pause_campaign, instantly_delete_campaign — campaign lifecycle previously only had activate
  • Fixed activate_campaign/pause_campaign/delete_campaign to correctly map the full campaign object the API actually returns (not just a message)
  • Confirmed list_campaigns' status/ai_sales_agent_id filters are real, documented params — kept them
  • Confirmed patch_lead correctly excludes email (immutable on that endpoint) and includes assigned_to
  • Verified no breaking changes to existing tool params/outputs — fully backwards compatible

Type of Change

  • Improvement / new tool coverage

Testing

  • bun run lint clean
  • bunx tsc --noEmit clean
  • Every tool cross-checked against Instantly's live OpenAPI v2 spec

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)

…ad/campaign lifecycle tools

- Verify all existing Instantly tools against the live API v2 spec
- Add instantly_patch_lead, instantly_pause_campaign, instantly_delete_campaign
- Fix activate_campaign response mapping to surface the full campaign object
- Restore status/ai_sales_agent_id list_campaigns filters
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 6, 2026 10:19pm

Request Review

@cursor

cursor Bot commented Jul 6, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
New DELETE campaign and PATCH lead operations can mutate live outreach data; changes are additive and follow existing Instantly tool patterns.

Overview
Extends the Instantly workflow block and tool registry with patch lead, pause campaign, and delete campaign, completing lead updates and campaign lifecycle control beyond activate-only.

The block adds matching operations, reuses create-lead field sub-blocks for patch lead via LEAD_MUTATION_FIELD_OPERATIONS, and registers the new tools. instantly_patch_lead PATCHes /api/v2/leads/{id} with optional fields (email omitted as immutable). instantly_pause_campaign and instantly_delete_campaign call the V2 pause and DELETE endpoints.

Activate, pause, and delete campaign tools now use InstantlyCampaignActionResponse and campaignActionOutputs, mapping the full campaign from the API plus an optional message via getMessage. Types add pause/delete/patch params; interest_value on interest updates is optional. Block meta gains skills for lead cleanup and pausing underperforming campaigns.

Reviewed by Cursor Bugbot for commit 154a6a8. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR validates the Instantly integration against the live v2 API and expands tool coverage with three new tools (instantly_patch_lead, instantly_pause_campaign, instantly_delete_campaign). It also fixes the activate_campaign output type to properly expose the full Campaign object alongside a message field, and tightens the update_lead_interest_status type signature by making interest_value optional.

  • New tools: patch_lead (PATCH /api/v2/leads/{id}), pause_campaign (POST /api/v2/campaigns/{id}/pause), and delete_campaign (DELETE /api/v2/campaigns/{id}) — each follows the established utils/types/block-config pattern and is registered in both index.ts and registry.ts.
  • Block UI: LEAD_MUTATION_FIELD_OPERATIONS correctly shares the mutation fields (firstName, lastName, etc.) between create_lead and patch_lead; CAMPAIGN_ID_OPERATIONS now includes pause_campaign and delete_campaign so the campaignId subBlock is required for all lifecycle actions.
  • Type correctness: InstantlyCampaignActionResponse is additive over InstantlyCampaignResponse (adds message: string | null), and the change to activate_campaign is backward-compatible.

Confidence Score: 5/5

Safe to merge — the new tools follow established patterns exactly, the activate_campaign type change is purely additive, and no existing tool contracts are broken.

All three new tools (patch_lead, pause_campaign, delete_campaign) mirror the structure of pre-existing tools (get_lead, activate_campaign) — same utils helpers, same output schema conventions, same registration pattern. The activate_campaign output type update only adds a message field and is backward-compatible. The empty-body guard added to patch_lead is a genuine correctness improvement. No logic paths are removed or altered in a way that could regress existing workflows.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/tools/instantly/patch_lead.ts New tool: PATCH /api/v2/leads/{id}. Correctly excludes email (immutable), uses compactBody + empty-guard pattern, and reuses leadOutputs/mapLead from utils.
apps/sim/tools/instantly/pause_campaign.ts New tool: POST /api/v2/campaigns/{id}/pause. Follows exact same structure as activate_campaign; uses campaignActionOutputs and getMessage helper.
apps/sim/tools/instantly/delete_campaign.ts New tool: DELETE /api/v2/campaigns/{id}. Mirrors activate/pause structure; response shape confirmed against live OpenAPI spec.
apps/sim/blocks/blocks/instantly.ts Block config updated to include new operations in the right constant groups; LEAD_MUTATION_FIELD_OPERATIONS correctly expands mutation fields to patch_lead.
apps/sim/tools/instantly/activate_campaign.ts Switched from InstantlyCampaignResponse to InstantlyCampaignActionResponse — additive change that appends message to output; backward-compatible.
apps/sim/tools/instantly/types.ts Adds InstantlyPatchLeadParams, InstantlyPauseCampaignParams, InstantlyDeleteCampaignParams, and InstantlyCampaignActionResponse; all types are consistent with existing conventions.
apps/sim/tools/instantly/utils.ts Adds campaignActionOutputs (extends campaignOutputs with message) and getMessage helper; both are simple, correct additions.
apps/sim/tools/instantly/index.ts Exports three new tools alphabetically; no issues.
apps/sim/tools/registry.ts New tools registered under their expected keys; alphabetical order maintained.
apps/sim/tools/instantly/list_campaigns.ts Only change is a description clarification for ai_sales_agent_id; no logic changes.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant UI as Block UI
    participant Block as InstantlyBlock config
    participant Registry as Tool Registry
    participant API as Instantly API v2

    UI->>Block: "operation = patch_lead, leadId, first_name, ..."
    Block->>Registry: instantly_patch_lead(leadId, first_name, ...)
    Registry->>API: "PATCH /api/v2/leads/{leadId}"
    API-->>Registry: InstantlyLead object
    Registry-->>UI: "{ lead, id, email_address, first_name, ... }"

    UI->>Block: "operation = pause_campaign, campaignId"
    Block->>Registry: instantly_pause_campaign(campaignId)
    Registry->>API: "POST /api/v2/campaigns/{campaignId}/pause"
    API-->>Registry: Campaign object + message
    Registry-->>UI: "{ campaign, id, name, status, message }"

    UI->>Block: "operation = delete_campaign, campaignId"
    Block->>Registry: instantly_delete_campaign(campaignId)
    Registry->>API: "DELETE /api/v2/campaigns/{campaignId}"
    API-->>Registry: Campaign object + message
    Registry-->>UI: "{ campaign, id, name, status, message }"
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant UI as Block UI
    participant Block as InstantlyBlock config
    participant Registry as Tool Registry
    participant API as Instantly API v2

    UI->>Block: "operation = patch_lead, leadId, first_name, ..."
    Block->>Registry: instantly_patch_lead(leadId, first_name, ...)
    Registry->>API: "PATCH /api/v2/leads/{leadId}"
    API-->>Registry: InstantlyLead object
    Registry-->>UI: "{ lead, id, email_address, first_name, ... }"

    UI->>Block: "operation = pause_campaign, campaignId"
    Block->>Registry: instantly_pause_campaign(campaignId)
    Registry->>API: "POST /api/v2/campaigns/{campaignId}/pause"
    API-->>Registry: Campaign object + message
    Registry-->>UI: "{ campaign, id, name, status, message }"

    UI->>Block: "operation = delete_campaign, campaignId"
    Block->>Registry: instantly_delete_campaign(campaignId)
    Registry->>API: "DELETE /api/v2/campaigns/{campaignId}"
    API-->>Registry: Campaign object + message
    Registry-->>UI: "{ campaign, id, name, status, message }"
Loading

Reviews (2): Last reviewed commit: "fix(instantly): guard against empty patc..." | Re-trigger Greptile

Comment thread apps/sim/tools/instantly/delete_campaign.ts
Comment thread apps/sim/tools/instantly/patch_lead.ts
Follows the same pattern used in tools/langsmith/update_run.ts.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 154a6a8. Configure here.

@waleedlatif1 waleedlatif1 merged commit 0916b19 into staging Jul 6, 2026
18 checks passed
@waleedlatif1 waleedlatif1 deleted the validate-instantly-integration branch July 6, 2026 22:34
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.

1 participant