Complete Instantly integration skill pack with 24 skills covering cold email, outreach automation, and lead generation. Flagship tier vendor pack.
Installation
Open Claude Code and run this command:
/plugin install instantly-pack@claude-code-plugins-plus
Use --global to install for all projects, or --project for current project only.
Skills (24)
Configure CI/CD pipelines for Instantly.
Instantly CI Integration
Overview
Set up CI/CD pipelines for Instantly API v2 integrations. Covers GitHub Actions workflows for testing against the Instantly mock server, validating API key scopes, and deploying webhook receivers. Uses the mock server at https://developer.instantly.ai/_mock/api/v2/ so CI runs don't send real emails or consume production API limits.
Prerequisites
- GitHub repository with Instantly integration code
INSTANTLYAPIKEYsecret in GitHub repo settings (for production tests)- Node.js 18+ or Python 3.10+ in the project
Instructions
Step 1: GitHub Actions Workflow
# .github/workflows/instantly-ci.yml
name: Instantly Integration CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
env:
INSTANTLY_USE_MOCK: "true"
INSTANTLY_BASE_URL: "https://developer.instantly.ai/_mock/api/v2"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- run: npm ci
- name: Type check
run: npx tsc --noEmit
- name: Lint
run: npx eslint src/ --ext .ts
- name: Unit tests (mock server)
run: npx vitest run --reporter=verbose
env:
INSTANTLY_API_KEY: "mock-key-for-ci"
INSTANTLY_USE_MOCK: "true"
- name: Validate API client types
run: npx tsx scripts/validate-types.ts
integration-test:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- run: npm ci
- name: Integration tests (live API, read-only)
run: npx vitest run tests/integration/ --reporter=verbose
env:
INSTANTLY_API_KEY: ${{ secrets.INSTANTLY_API_KEY }}
INSTANTLY_BASE_URL: "https://api.instantly.ai/api/v2"
Step 2: API Scope Validation Script
// scripts/validate-types.ts
// Verifies the API client types match expected Instantly v2 schema
import { InstantlyClient } from "../src/instantly/client";
async function validateApiAccess() {
const client = new InstantlyClient();
// Validate read-only operations work
const campaigns = await client.getCampaigns({ limit: 1 });
console.log("campaigns: OK");
const accounts = await client.getAccounts({ limit: 1 });
console.log("accounts: OK");
console.log("All API validations passed");
}
validateApiAccess().catch((err) => {
console.error("Validation failed:", err.message);
process.exit(1);
});
<Diagnose and fix Instantly.
Instantly Common Errors
Overview
Diagnostic reference for Instantly API v2 errors. Covers HTTP status codes, campaign state errors, account health issues, lead operation failures, and webhook delivery problems.
Prerequisites
- Completed
instantly-install-authsetup - Access to Instantly dashboard for verification
- API key with appropriate scopes
HTTP Status Codes
| Status | Meaning | Common Cause | Fix |
|---|---|---|---|
400 |
Bad Request | Malformed JSON, invalid field values | Validate request body against schema |
401 |
Unauthorized | Invalid, expired, or revoked API key | Regenerate key in Settings > Integrations |
403 |
Forbidden | API key missing required scope | Create key with correct scope (e.g., campaigns:all) |
404 |
Not Found | Invalid campaign/lead/account ID | Verify resource exists with a GET call first |
422 |
Unprocessable Entity | Business logic violation (duplicate lead, invalid state) | Check error body for details |
429 |
Too Many Requests | Rate limit exceeded | Implement exponential backoff (see below) |
500 |
Internal Server Error | Instantly server issue | Retry with backoff; check status.instantly.ai |
Campaign Errors
Campaign Won't Activate (Stuck in Draft)
// Diagnosis: check campaign requirements
async function diagnoseCampaign(campaignId: string) {
const campaign = await instantly<Campaign>(`/campaigns/${campaignId}`);
const issues: string[] = [];
// Check sequences
if (!campaign.sequences?.length || !campaign.sequences[0]?.steps?.length) {
issues.push("No email sequences — add at least one step with subject + body");
}
// Check schedule
if (!campaign.campaign_schedule?.schedules?.length) {
issues.push("No sending schedule — add schedule with timing and days");
}
// Check sending accounts
const mappings = await instantly(`/account-campaign-mappings/${campaignId}`);
if (!Array.isArray(mappings) || mappings.length === 0) {
issues.push("No sending accounts assigned — add via PATCH /campaigns/{id} with email_list");
}
// Check for leads
const leads = await instantly<Lead[]>("/leads/list", {
method: "POST",
body: JSON.stringify({ campaign: campaignId, limit: 1 }),
});
if (leads.length === 0) {
issues.push("No leads — add leads via POST /leads");
}
if (issues.length === 0) {
console.log("Campaign looks reBuild and launch an Instantly.
Instantly Core Workflow A: Campaign Launch Pipeline
Overview
Build the core Instantly outreach pipeline: create a campaign with email sequences, add leads with personalization, assign sending accounts, and launch. This is the primary money-path workflow for cold email outreach via Instantly API v2.
Prerequisites
- Completed
instantly-install-authsetup - At least one warmed-up email account in Instantly
- Lead data (CSV or programmatic) with email + first name at minimum
- API key with
campaigns:allandleads:allscopes
Instructions
Step 1: Create a Campaign with Sequences
import { instantly } from "./src/instantly";
interface CreateCampaignPayload {
name: string;
campaign_schedule: {
start_date: string;
end_date?: string;
schedules: Array<{
name: string;
timing: { from: string; to: string };
days: Record<string, boolean>;
timezone: string;
}>;
};
sequences: Array<{
steps: Array<{
type: "email";
delay: number;
delay_unit?: "minutes" | "hours" | "days";
variants: Array<{ subject: string; body: string }>;
}>;
}>;
daily_limit?: number;
stop_on_reply?: boolean;
stop_on_auto_reply?: boolean;
email_gap?: number;
link_tracking?: boolean;
open_tracking?: boolean;
}
async function createCampaign() {
const payload: CreateCampaignPayload = {
name: "Q1 Outbound — Decision Makers",
campaign_schedule: {
start_date: "2026-04-01",
schedules: [
{
name: "Business Hours",
timing: { from: "09:00", to: "17:00" },
days: { "1": true, "2": true, "3": true, "4": true, "5": true, "0": false, "6": false },
timezone: "America/New_York",
},
],
},
// sequences array takes ONE element — add steps inside it
sequences: [
{
steps: [
{
type: "email",
delay: 0, // first email — no delay
variants: [
{
subject: "{{firstName}}, quick question about {{companyName}}",
body: `Hi {{firstName}},\n\nI noticed {{companyName}} is scaling its outbound — we help teams like yours book 3x more meetings without adding headcount.\n\nWorth a 15-min call this week?\n\nBest,\n{{senderName}}`,
},
{
subject: "Idea for {{companyName}}",
body: `Hey {{firstName}},\n\nSaw that {{companyName}} is growing fast. We helped [similar company] increase reply rates by 40%.\n\nOpen to a quick chat?\n\n{{senderName}}`,
},
],
},
Manage Instantly.
Instantly Core Workflow B: Warmup & Analytics Pipeline
Overview
Manage the email account warmup lifecycle and campaign analytics. Warmup builds sender reputation through controlled email exchanges across Instantly's 4.2M+ account network before you start cold outreach. This workflow covers enabling warmup, monitoring warmup health, pulling campaign analytics, and daily send tracking.
Prerequisites
- Completed
instantly-install-authsetup - Email accounts connected in Instantly (IMAP/SMTP or Google/Microsoft OAuth)
- API key with
accounts:updateandcampaigns:readscopes
Instructions
Step 1: Enable Warmup on Email Accounts
import { instantly } from "./src/instantly";
// Enable warmup — triggers a background job
async function enableWarmup(emails: string[]) {
const job = await instantly<{ id: string; status: string }>(
"/accounts/warmup/enable",
{
method: "POST",
body: JSON.stringify({ emails }),
}
);
console.log(`Warmup enable job started: ${job.id} (status: ${job.status})`);
// Poll background job until complete
let result = job;
while (result.status !== "completed" && result.status !== "failed") {
await new Promise((r) => setTimeout(r, 2000));
result = await instantly<{ id: string; status: string }>(
`/background-jobs/${job.id}`
);
}
console.log(`Warmup job ${result.status}`);
return result;
}
// Enable for specific accounts
await enableWarmup(["outreach1@yourdomain.com", "outreach2@yourdomain.com"]);
// Or enable for ALL accounts at once
await instantly("/accounts/warmup/enable", {
method: "POST",
body: JSON.stringify({ include_all_emails: true }),
});
Step 2: Configure Warmup Settings
// PATCH account to tune warmup parameters
async function configureWarmup(email: string) {
await instantly(`/accounts/${encodeURIComponent(email)}`, {
method: "PATCH",
body: JSON.stringify({
warmup: {
limit: 40, // max warmup emails per day
increment: "2", // daily limit increment (0-4 or "disabled")
advanced: {
open_rate: 0.95, // target open rate for warmup
reply_rate: 0.1, // target reply rate
spam_save_rate: 0.02, // rate of rescuing from spam
read_emulation: true, // simulate reading behavior
weekday_only: true, // warmup only on weekdays
warm_ctd: false, // custom tracking domain warmup
},
},
daily_limit: 50, // max campaign emails per day
enable_slow_ramp: true,
}),
});
console.log(`Warmup configured for ${email}`);
}
Step 3: Monitor Warmup He
Optimize Instantly.
Instantly Cost Tuning
Overview
Optimize Instantly.ai costs by choosing the right plan, managing email account utilization, monitoring campaign efficiency, and reducing wasted sends. Instantly's pricing is based on sending accounts and features, not per-email — so the key to cost efficiency is maximizing the value per account.
Instantly Pricing Tiers (2026)
| Plan | Monthly | Annual (per mo) | Email Accounts | Warmup | API Access | Webhooks |
|---|---|---|---|---|---|---|
| Growth | $30 | $24 | 5 | Included | v2 (limited) | No |
| Hypergrowth | $97.95 | $77.60 | 25 | Included | v2 (full) | Yes |
| Light Speed | $358.30 | $286.30 | 500+ | Included | v2 (full) | Yes |
Key cost decision: You need Hypergrowth ($97.95/mo) minimum for full API v2 access and webhooks.
Instructions
Step 1: Audit Current Account Utilization
import { instantly } from "./src/instantly";
async function auditAccountUtilization() {
// Get all accounts
const accounts = await instantly<Array<{
email: string;
status: number;
daily_limit: number | null;
warmup_status: string;
}>>("/accounts?limit=200");
// Get daily analytics for the last 7 days
const endDate = new Date().toISOString().split("T")[0];
const startDate = new Date(Date.now() - 7 * 86400000).toISOString().split("T")[0];
const dailyAnalytics = await instantly<Array<{
email: string;
date: string;
emails_sent: number;
}>>(`/accounts/analytics/daily?start_date=${startDate}&end_date=${endDate}&emails=${accounts.map(a => a.email).join(",")}`);
// Calculate utilization
console.log("=== Account Utilization Audit ===\n");
let totalCapacity = 0;
let totalSent = 0;
const underutilized: string[] = [];
for (const account of accounts) {
const sent = dailyAnalytics
.filter((d) => d.email === account.email)
.reduce((sum, d) => sum + d.emails_sent, 0);
const dailyAvg = sent / 7;
const capacity = account.daily_limit || 50;
const utilization = (dailyAvg / capacity) * 100;
totalCapacity += capacity * 7;
totalSent += sent;
if (utilization < 20) {
underutilized.push(account.email);
}
console.log(`${account.email}: ${dailyAvg.toFixed(0)}/day of ${capacity} limit (${utilization.toFixed(0)}% utilized)`);
}
console.log(`\nOverall: ${totalSent} sent of ${totalCapacity} capacity (${((totalSent / totalCapacity) * 100).toFixed(0)}%)`);
console.log(`Underutilized accounts (<20%): ${underutilized.length}`);
if (underutilized.length > 0) {
consoleImplement Instantly.
Instantly Data Handling
Overview
Manage leads, lead lists, block lists, and regulatory compliance in Instantly API v2. Covers lead CRUD operations, list management, bulk import patterns, unsubscribe handling, GDPR right-to-deletion, CAN-SPAM compliance, and block list automation. Cold email has specific legal requirements — this skill ensures your integrations are compliant.
Prerequisites
- Completed
instantly-install-authsetup - API key with
leads:allscope - Understanding of CAN-SPAM / GDPR requirements for cold outreach
Instructions
Step 1: Lead List Management
import { InstantlyClient } from "./src/instantly/client";
const client = new InstantlyClient();
// Create a lead list (container for leads outside campaigns)
async function createLeadList(name: string) {
const list = await client.request<{ id: string; name: string }>("/lead-lists", {
method: "POST",
body: JSON.stringify({
name,
has_enrichment_task: false,
}),
});
console.log(`Created list: ${list.name} (${list.id})`);
return list;
}
// List all lead lists
async function getLeadLists() {
return client.request<Array<{
id: string; name: string; timestamp_created: string;
}>>("/lead-lists?limit=50");
}
// Delete a lead list
async function deleteLeadList(listId: string) {
await client.request(`/lead-lists/${listId}`, { method: "DELETE" });
}
Step 2: Lead Import with Validation
interface LeadImport {
email: string;
first_name?: string;
last_name?: string;
company_name?: string;
website?: string;
phone?: string;
custom_variables?: Record<string, string>;
}
async function importLeads(
campaignId: string,
leads: LeadImport[],
options = { skipDuplicates: true, verifyEmails: true }
) {
const results = { added: 0, skipped: 0, failed: 0, errors: [] as string[] };
for (const lead of leads) {
try {
// Validate email format
if (!lead.email || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(lead.email)) {
results.failed++;
results.errors.push(`Invalid email: ${lead.email}`);
continue;
}
// Check against block list patterns
const domain = lead.email.split("@")[1];
if (BLOCKED_PATTERNS.some((p) => domain.includes(p))) {
results.skipped++;
continue;
}
await client.request("/leads", {
method: "POST",
body: JSON.stringify({
campaign: campaignId,
email: lead.email,
first_name: lead.first_name,
last_name: lead.last_name,
company_name: lead.company_name,
website: lead.website,
phone: lead.phone,
custom_variables: lead.custom_variables,
skip_if_in_workspCollect Instantly.
Instantly Debug Bundle
Overview
Collect a comprehensive debug bundle from your Instantly workspace: campaign state, account health, warmup metrics, lead stats, webhook delivery status, and recent errors. Output is a JSON report suitable for support tickets or internal audits.
Prerequisites
- Completed
instantly-install-authsetup - API key with
all:readscope (or individual read scopes for each resource)
Instructions
Step 1: Collect Full Debug Bundle
import { instantly } from "./src/instantly";
import { writeFileSync } from "fs";
interface DebugBundle {
timestamp: string;
workspace: unknown;
campaigns: unknown[];
accounts: unknown[];
warmup_analytics: unknown[];
webhooks: unknown[];
webhook_event_summary: unknown;
background_jobs: unknown[];
lead_count_by_campaign: Record<string, number>;
errors: string[];
}
async function collectDebugBundle(): Promise<DebugBundle> {
const bundle: DebugBundle = {
timestamp: new Date().toISOString(),
workspace: null,
campaigns: [],
accounts: [],
warmup_analytics: [],
webhooks: [],
webhook_event_summary: null,
background_jobs: [],
lead_count_by_campaign: {},
errors: [],
};
// Workspace info
try {
bundle.workspace = await instantly("/workspaces/current");
} catch (e: any) {
bundle.errors.push(`workspace: ${e.message}`);
}
// All campaigns with status
try {
bundle.campaigns = await instantly("/campaigns?limit=100");
} catch (e: any) {
bundle.errors.push(`campaigns: ${e.message}`);
}
// All email accounts
try {
bundle.accounts = await instantly("/accounts?limit=100");
} catch (e: any) {
bundle.errors.push(`accounts: ${e.message}`);
}
// Warmup analytics for all accounts
try {
const accounts = bundle.accounts as Array<{ email: string }>;
if (accounts.length > 0) {
bundle.warmup_analytics = await instantly("/accounts/warmup-analytics", {
method: "POST",
body: JSON.stringify({ emails: accounts.map((a) => a.email) }),
});
}
} catch (e: any) {
bundle.errors.push(`warmup_analytics: ${e.message}`);
}
// Webhooks
try {
bundle.webhooks = await instantly("/webhooks?limit=50");
} catch (e: any) {
bundle.errors.push(`webhooks: ${e.message}`);
}
// Webhook event delivery summary
try {
bundle.webhook_event_summary = await instantly("/webhook-events/summary");
} catch (e: any) {
bundle.errors.push(`webhook_events: ${e.message}`);
}
// Recent background jobs
try {
bundle.background_jobs = await instantly("/background-jobs?limit=20");
} catch (e: any) {
bundle.errors.push(`background_jobs: ${e.message}`);
}
// Lead counts per campaign
for (const c of (bundDeploy Instantly.
Instantly Deploy Integration
Overview
Deploy Instantly API v2 integrations — primarily webhook receivers and automation services — to cloud platforms. Instantly webhooks require a public HTTPS endpoint that responds within 30 seconds (3 retries on failure). This skill covers Vercel serverless functions, Google Cloud Run containers, and Fly.io deployments.
Prerequisites
- Completed
instantly-install-authsetup - Working Instantly integration tested locally (see
instantly-local-dev-loop) - Cloud platform account (Vercel, GCP, or Fly.io)
- Domain or HTTPS URL for webhook endpoint
Instructions
Option A: Vercel Serverless Functions
// api/webhooks/instantly.ts — Vercel serverless function
import type { VercelRequest, VercelResponse } from "@vercel/node";
export default async function handler(req: VercelRequest, res: VercelResponse) {
if (req.method !== "POST") {
return res.status(405).json({ error: "Method not allowed" });
}
// Validate webhook secret
const secret = req.headers["x-webhook-secret"];
if (secret !== process.env.INSTANTLY_WEBHOOK_SECRET) {
return res.status(401).json({ error: "Unauthorized" });
}
const { event_type, data } = req.body;
// Respond immediately — Instantly expects 2xx within 30s
res.status(200).json({ received: true });
// Process event asynchronously
try {
switch (event_type) {
case "reply_received":
await syncReplyToCRM(data);
break;
case "email_bounced":
await handleBounce(data);
break;
case "lead_interested":
await notifySalesTeam(data);
break;
case "lead_unsubscribed":
await addToBlockList(data);
break;
}
} catch (err) {
console.error(`Webhook processing error: ${event_type}`, err);
}
}
async function addToBlockList(data: { lead_email: string }) {
await fetch("https://api.instantly.ai/api/v2/block-lists-entries", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.INSTANTLY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ bl_value: data.lead_email }),
});
}
# Deploy to Vercel
vercel env add INSTANTLY_API_KEY
vercel env add INSTANTLY_WEBHOOK_SECRET
vercel deploy --prod
Option B: Google Cloud Run
# Dockerfile
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --production=false
COPY . .
RUN npm run build
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY package*.json ./
EXPOSE 8080
ENV PORT=8080
CMD ["node", "dist/server.jsConfigure Instantly.
Instantly Enterprise RBAC
Overview
Manage workspace access control in Instantly API v2. Covers workspace member management, API key governance with scoped permissions, workspace group management (for agencies), custom tag-based resource isolation, and audit logging. Instantly uses workspace-level isolation — each workspace is a separate tenant with its own data and API keys.
Prerequisites
- Instantly Hypergrowth plan or higher
- Workspace admin access
- API key with
all:allscope (for admin operations)
Instructions
Step 1: Workspace Member Management
import { InstantlyClient } from "./src/instantly/client";
const client = new InstantlyClient();
// List workspace members
async function listMembers() {
const members = await client.request<Array<{
id: string;
email: string;
role: string;
timestamp_created: string;
}>>("/workspace-members");
console.log("Workspace Members:");
for (const m of members) {
console.log(` ${m.email} — role: ${m.role} (joined: ${m.timestamp_created})`);
}
return members;
}
// Invite new member
async function inviteMember(email: string) {
const member = await client.request<{ id: string; email: string }>("/workspace-members", {
method: "POST",
body: JSON.stringify({ email }),
});
console.log(`Invited: ${member.email} (${member.id})`);
return member;
}
// Update member role
async function updateMemberRole(memberId: string, role: string) {
await client.request(`/workspace-members/${memberId}`, {
method: "PATCH",
body: JSON.stringify({ role }),
});
}
// Remove member
async function removeMember(memberId: string) {
await client.request(`/workspace-members/${memberId}`, { method: "DELETE" });
console.log(`Removed member: ${memberId}`);
}
Step 2: API Key Governance
// Create scoped API keys for different team roles
async function createScopedKeys() {
// Analytics-only key for the marketing team
const analyticsKey = await client.request<{ id: string; key: string; name: string }>(
"/api-keys",
{
method: "POST",
body: JSON.stringify({
name: "Marketing — Analytics Read Only",
scopes: ["campaigns:read", "accounts:read"],
}),
}
);
console.log(`Analytics key: ${analyticsKey.name} (${analyticsKey.id})`);
// Campaign management key for SDR team
const sdrKey = await client.request<{ id: string; key: string; name: string }>(
"/api-keys",
{
method: "POST",
body: JSON.stringify({
name: "SDR — Campaign Management",
scopes: ["campaigns:all", "leads:all"],
}),
}
);
console.log(`SDR key: $Create a minimal working Instantly.
Instantly Hello World
Overview
Minimal working example that lists your campaigns, checks email account health, and pulls campaign analytics — all using real Instantly API v2 endpoints.
Prerequisites
- Completed
instantly-install-authsetup - At least one email account connected in Instantly
INSTANTLYAPIKEYenvironment variable set
Instructions
Step 1: List Your Campaigns
import { instantly } from "./src/instantly";
interface Campaign {
id: string;
name: string;
status: number; // 0=Draft, 1=Active, 2=Paused, 3=Completed
}
const STATUS_LABELS: Record<number, string> = {
0: "Draft", 1: "Active", 2: "Paused", 3: "Completed",
4: "Running Subsequences", [-99]: "Suspended",
[-1]: "Accounts Unhealthy", [-2]: "Bounce Protect",
};
async function listCampaigns() {
const campaigns = await instantly<Campaign[]>("/campaigns?limit=10");
console.log(`Found ${campaigns.length} campaigns:\n`);
for (const c of campaigns) {
console.log(` ${c.name} [${STATUS_LABELS[c.status] ?? c.status}] — ${c.id}`);
}
return campaigns;
}
Step 2: Check Email Account Health
interface Account {
email: string;
status: number;
warmup_status: string;
daily_limit: number | null;
}
async function checkAccounts() {
const accounts = await instantly<Account[]>("/accounts?limit=5");
console.log(`\nEmail Accounts (${accounts.length}):`);
for (const a of accounts) {
console.log(` ${a.email} — status: ${a.status}, warmup: ${a.warmup_status}, daily_limit: ${a.daily_limit}`);
}
// Test vitals for the first account
if (accounts.length > 0) {
const vitals = await instantly("/accounts/test/vitals", {
method: "POST",
body: JSON.stringify({ accounts: [accounts[0].email] }),
});
console.log(`\nVitals for ${accounts[0].email}:`, JSON.stringify(vitals, null, 2));
}
}
Step 3: Pull Campaign Analytics
async function getAnalytics(campaignId: string) {
const stats = await instantly<{
campaign_id: string;
total_leads: number;
leads_contacted: number;
emails_sent: number;
emails_opened: number;
emails_replied: number;
emails_bounced: number;
}>(`/campaigns/analytics?id=${campaignId}`);
console.log(`\nCampaign Analytics:`);
console.log(` Leads: ${stats.total_leads} total, ${stats.leads_contacted} contacted`);
console.log(` Sent: ${stats.emails_sent}`);
console.log(` Opened: ${stats.emails_opened} (${((stats.emails_opened / stats.emails_sent) * 100).toFixed(1)}%)`);
console.log(` Replied: ${stats.emails_replied} (${((stats.emails_replied / stats.emails_sent) * 100Execute Instantly.
Instantly Incident Runbook
Overview
Structured incident response procedures for Instantly.ai integration failures. Covers campaign pause cascades, account health crises, bounce protect triggers, webhook delivery failures, and API outages.
Severity Levels
| Severity | Criteria | Response Time | Examples |
|---|---|---|---|
| P1 Critical | All campaigns stopped, sending halted | 15 min | All accounts unhealthy, API 5xx |
| P2 High | Multiple campaigns affected | 1 hour | Bounce protect on key campaign, warmup degraded |
| P3 Medium | Single campaign/account issue | 4 hours | One account SMTP failure, webhook delivery issue |
| P4 Low | Non-blocking issue | Next business day | Analytics gap, cosmetic dashboard issue |
Incident: All Campaigns in Accounts Unhealthy (-1)
Triage
import { InstantlyClient } from "./src/instantly/client";
const client = new InstantlyClient();
async function triageCampaignHealth() {
console.log("=== P1 TRIAGE: Campaign Health ===\n");
// 1. Get all campaigns and their statuses
const campaigns = await client.campaigns.list(100);
const statusCounts: Record<number, number> = {};
for (const c of campaigns) {
statusCounts[c.status] = (statusCounts[c.status] || 0) + 1;
}
console.log("Campaign status distribution:", statusCounts);
const unhealthy = campaigns.filter((c) => c.status === -1);
console.log(`Unhealthy campaigns: ${unhealthy.length}`);
// 2. Test ALL account vitals
const accounts = await client.accounts.list(200);
const vitals = await client.accounts.testVitals(accounts.map((a) => a.email));
const broken = (vitals as any[]).filter((v) => v.smtp_status !== "ok" || v.imap_status !== "ok");
const healthy = (vitals as any[]).filter((v) => v.smtp_status === "ok" && v.imap_status === "ok");
console.log(`\nAccounts: ${accounts.length} total, ${healthy.length} healthy, ${broken.length} broken`);
if (broken.length > 0) {
console.log("\nBroken accounts:");
for (const v of broken) {
console.log(` ${v.email}: SMTP=${v.smtp_status} IMAP=${v.imap_status} DNS=${v.dns_status}`);
}
}
return { unhealthy, broken, healthy };
}
Mitigation
async function mitigateBrokenAccounts() {
const { broken, healthy } = await triageCampaignHealth();
// Step 1: Pause broken accounts
for (const v of broken) {
try {
await client.accounts.pause(v.email);
console.log(`Paused broken account: ${v.email}`);
} catch (e: any) {
console.log(`Failed to pause ${v.email}: ${e.message}`);
}
}
// Step 2: Set up Instantly.
Instantly Install & Auth
Overview
Configure Instantly.ai API v2 authentication. Instantly uses Bearer token auth with scoped API keys. There is no official SDK — all integrations use direct REST calls to https://api.instantly.ai/api/v2/.
Prerequisites
- Instantly.ai account on Hypergrowth plan ($97/mo) or higher (required for API v2 access)
- Node.js 18+ or Python 3.10+
- Access to Instantly dashboard at
https://app.instantly.ai
Instructions
Step 1: Generate API Key
- Log into
https://app.instantly.ai - Navigate to Settings > Integrations > API
- Click Create New API Key
- Select scopes (e.g.,
campaigns:read,leads:all,accounts:read) - Copy the key — it is shown only once
set -euo pipefail
# Create .env file with your API key
cat > .env << 'ENVEOF'
INSTANTLY_API_KEY=your-api-key-here
INSTANTLY_BASE_URL=https://api.instantly.ai/api/v2
ENVEOF
echo "Created .env with Instantly config"
Available API scopes (resource:action format):
| Scope | Access |
|---|---|
campaigns:read |
List/get campaigns and analytics |
campaigns:update |
Create, patch, activate, pause campaigns |
campaigns:all |
Full campaign CRUD + analytics |
accounts:read |
List/get email accounts |
accounts:update |
Create, warmup, pause accounts |
leads:read |
List/get leads and lead lists |
leads:update |
Create, move, delete leads |
leads:all |
Full lead CRUD |
all:all |
Unrestricted access (dev only) |
Step 2: Create API Client Wrapper (TypeScript)
// src/instantly.ts
import "dotenv/config";
const BASE = process.env.INSTANTLY_BASE_URL || "https://api.instantly.ai/api/v2";
const API_KEY = process.env.INSTANTLY_API_KEY;
if (!API_KEY) throw new Error("INSTANTLY_API_KEY is required");
export async function instantly<T = unknown>(
path: string,
options: RequestInit = {}
): Promise<T> {
const url = `${BASE}${path}`;
const res = await fetch(url, {
...options,
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${API_KEY}`,
...options.headers,
},
});
if (!res.ok) {
const body = await res.text();
throw new Error(`Instantly API ${res.status}: ${body}`);
}
return res.json() as Promise<T>;
}
Configure Instantly.
Instantly Local Dev Loop
Overview
Set up a local development workflow for Instantly integrations. Instantly provides a mock server at https://developer.instantly.ai/_mock/api/v2/ for testing without sending real emails or consuming API limits. This skill covers mock server usage, integration testing, and local webhook development.
Prerequisites
- Completed
instantly-install-authsetup - Node.js 18+ with TypeScript
- A separate Instantly API key for dev/test (recommended)
Instructions
Step 1: Configure Dev Environment
// src/config.ts
import "dotenv/config";
interface Config {
baseUrl: string;
apiKey: string;
useMock: boolean;
}
export function getConfig(): Config {
const useMock = process.env.INSTANTLY_USE_MOCK === "true";
return {
baseUrl: useMock
? "https://developer.instantly.ai/_mock/api/v2"
: process.env.INSTANTLY_BASE_URL || "https://api.instantly.ai/api/v2",
apiKey: process.env.INSTANTLY_API_KEY || "",
useMock,
};
}
# .env.development
INSTANTLY_API_KEY=your-dev-api-key
INSTANTLY_BASE_URL=https://api.instantly.ai/api/v2
INSTANTLY_USE_MOCK=true
# .env.production
INSTANTLY_API_KEY=your-prod-api-key
INSTANTLY_BASE_URL=https://api.instantly.ai/api/v2
INSTANTLY_USE_MOCK=false
Step 2: Build a Testable API Client
// src/instantly.ts
import { getConfig } from "./config";
const config = getConfig();
export async function instantly<T = unknown>(
path: string,
options: RequestInit = {}
): Promise<T> {
const url = `${config.baseUrl}${path}`;
const res = await fetch(url, {
...options,
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${config.apiKey}`,
...options.headers,
},
});
if (res.status === 429) {
const retryAfter = parseInt(res.headers.get("retry-after") || "2", 10);
console.warn(`Rate limited. Retrying in ${retryAfter}s...`);
await new Promise((r) => setTimeout(r, retryAfter * 1000));
return instantly<T>(path, options);
}
if (!res.ok) {
const body = await res.text();
throw new InstantlyError(res.status, path, body);
}
return res.json() as Promise<T>;
}
class InstantlyError extends Error {
constructor(
public status: number,
public path: string,
public body: string
) {
super(`Instantly API ${status} on ${path}: ${body}`);
this.name = "InstantlyError";
}
}
Step 3: Write Integration Tests
// tests/instantly.test.ts
import { describe, it, expect, beforeAll } from "vitest";
import { instantly } from "../src/instantly";
describe("Execute complex Instantly.
Instantly Migration Deep Dive
Overview
Strategies for migrating to/from Instantly or consolidating multiple outreach tools into Instantly. Covers data migration (leads, campaigns, templates), account migration (email infrastructure), analytics preservation, and parallel-run strategies with zero-downtime cutover.
Migration Scenarios
| Scenario | Complexity | Duration |
|---|---|---|
| Lemlist/Woodpecker/Mailshake to Instantly | Medium | 1-2 weeks |
| Salesloft/Outreach to Instantly | High | 2-4 weeks |
| Multiple Instantly workspaces to one | Low | 1 week |
| Manual outreach to Instantly automation | Low | 3-5 days |
Instructions
Step 1: Pre-Migration Audit
import { InstantlyClient } from "./src/instantly/client";
const client = new InstantlyClient();
interface MigrationPlan {
sourceLeadCount: number;
sourceCampaignCount: number;
sourceTemplateCount: number;
emailAccountsToMigrate: string[];
estimatedDuration: string;
risks: string[];
}
async function preMigrationAudit(): Promise<MigrationPlan> {
// Check current Instantly workspace state
const existingCampaigns = await client.campaigns.list(100);
const existingAccounts = await client.accounts.list(100);
console.log("=== Current Instantly Workspace ===");
console.log(`Campaigns: ${existingCampaigns.length}`);
console.log(`Accounts: ${existingAccounts.length}`);
// Check warmup status
if (existingAccounts.length > 0) {
const warmup = await client.accounts.warmupAnalytics(
existingAccounts.map((a) => a.email)
);
console.log(`Accounts with warmup: ${(warmup as any[]).length}`);
}
console.log("\n=== Migration Checklist ===");
console.log("[ ] Export leads from source platform (CSV)");
console.log("[ ] Export campaign templates and sequences");
console.log("[ ] Document sending schedules and daily limits");
console.log("[ ] Export analytics/historical data for reference");
console.log("[ ] Identify email accounts to migrate (IMAP/SMTP creds)");
console.log("[ ] Map custom fields to Instantly custom_variables");
console.log("[ ] Create block list from source platform unsubscribes");
console.log("[ ] Plan warmup period (14+ days for new accounts)");
return {
sourceLeadCount: 0, // fill from source audit
sourceCampaignCount: 0,
sourceTemplateCount: 0,
emailAccountsToMigrate: [],
estimatedDuration: "2 weeks",
risks: [
"Warmup period delays campaign launch by 14+ days",
"Custom field mapping may lose data if not 1:1",
"Sending reputation doesn't transfer between platformsConfigure Instantly.
Instantly Multi-Environment Setup
Overview
Configure Instantly API v2 integrations across development, staging, and production environments. Instantly uses workspace-level isolation — each workspace has its own accounts, campaigns, leads, and API keys. This skill covers workspace separation, environment-specific configuration, mock server for dev, and safe promotion workflows.
Environment Strategy
| Environment | Instantly Backend | API Keys | Webhooks | Purpose |
|---|---|---|---|---|
| Development | Mock server | mock-key |
localhost:3000 | Code iteration |
| Staging | Separate workspace | Staging key | staging.yourapp.com | Integration testing |
| Production | Production workspace | Prod key | prod.yourapp.com | Live outreach |
Instructions
Step 1: Environment Configuration
// src/config.ts
import "dotenv/config";
type Env = "development" | "staging" | "production";
interface InstantlyConfig {
env: Env;
apiKey: string;
baseUrl: string;
webhookSecret: string;
useMock: boolean;
dailyLimitCap: number;
enableRealSending: boolean;
}
export function getConfig(): InstantlyConfig {
const env = (process.env.NODE_ENV || "development") as Env;
const configs: Record<Env, InstantlyConfig> = {
development: {
env: "development",
apiKey: process.env.INSTANTLY_API_KEY_DEV || "mock-key",
baseUrl: "https://developer.instantly.ai/_mock/api/v2",
webhookSecret: "dev-secret",
useMock: true,
dailyLimitCap: 5,
enableRealSending: false,
},
staging: {
env: "staging",
apiKey: process.env.INSTANTLY_API_KEY_STAGING || "",
baseUrl: "https://api.instantly.ai/api/v2",
webhookSecret: process.env.INSTANTLY_WEBHOOK_SECRET_STAGING || "",
useMock: false,
dailyLimitCap: 10,
enableRealSending: true,
},
production: {
env: "production",
apiKey: process.env.INSTANTLY_API_KEY_PROD || "",
baseUrl: "https://api.instantly.ai/api/v2",
webhookSecret: process.env.INSTANTLY_WEBHOOK_SECRET_PROD || "",
useMock: false,
dailyLimitCap: 100,
enableRealSending: true,
},
};
const config = configs[env];
if (!config.useMock && !config.apiKey) {
throw new Error(`INSTANTLY_API_KEY_${env.toUpperCase()} is required for ${env}`);
}
return config;
}
Step 2: Environment-Specific .env Files
# .env.development
NODE_ENV=development
INSTANTLY_API_KEY_DEV=mock-key
INSTANTLY_BASE_URL=https://developer.instSet up monitoring, alerting, and dashboards for Instantly.
Instantly Observability
Overview
Build monitoring and alerting for Instantly integrations. Covers campaign health checks, account warmup monitoring, webhook delivery tracking, deliverability alerts, and performance dashboards. Uses Instantly API v2 analytics endpoints combined with webhook events for real-time awareness.
Prerequisites
- Completed
instantly-install-authsetup - API key with
campaigns:read,accounts:read, andall:readscopes - Notification channel (Slack, email, PagerDuty, etc.)
Instructions
Step 1: Campaign Health Monitor
import { InstantlyClient } from "./src/instantly/client";
const client = new InstantlyClient();
interface HealthCheck {
check: string;
status: "ok" | "warning" | "critical";
message: string;
}
async function campaignHealthCheck(): Promise<HealthCheck[]> {
const checks: HealthCheck[] = [];
const campaigns = await client.campaigns.list(100);
for (const campaign of campaigns.filter((c) => c.status === 1)) { // Active only
const analytics = await client.campaigns.analytics(campaign.id);
const sent = analytics.emails_sent || 1;
// Bounce rate check (critical if > 5%)
const bounceRate = (analytics.emails_bounced / sent) * 100;
if (bounceRate > 5) {
checks.push({
check: `bounce_rate:${campaign.name}`,
status: "critical",
message: `Bounce rate ${bounceRate.toFixed(1)}% exceeds 5% threshold. Campaign may be auto-paused.`,
});
} else if (bounceRate > 3) {
checks.push({
check: `bounce_rate:${campaign.name}`,
status: "warning",
message: `Bounce rate ${bounceRate.toFixed(1)}% approaching 5% threshold.`,
});
}
// Reply rate check (warning if < 1%)
const replyRate = (analytics.emails_replied / sent) * 100;
if (replyRate < 1 && sent > 100) {
checks.push({
check: `reply_rate:${campaign.name}`,
status: "warning",
message: `Reply rate ${replyRate.toFixed(1)}% is below 1% after ${sent} sends. Review email copy.`,
});
}
// Open rate check (warning if < 20%)
const openRate = (analytics.emails_opened / sent) * 100;
if (openRate < 20 && sent > 100) {
checks.push({
check: `open_rate:${campaign.name}`,
status: "warning",
message: `Open rate ${openRate.toFixed(1)}% below 20%. Check subject lines and deliverability.`,
});
}
}
// Campaign status checks
const unhealthy = campaigns.filter((c) => c.status === -1);
const bounceProtected = campaigns.filter((c) => c.status === -2);
if (unhealthy.length > 0) {
checks.push({
check: "unhealthy_campaigns",
status: "critical",
Optimize Instantly.
Instantly Performance Tuning
Overview
Optimize Instantly API v2 integrations for speed and throughput. Key areas: caching analytics data, batching lead operations, concurrent request management, efficient pagination, and connection reuse. The email listing endpoint has a strict 20 req/min limit that requires special handling.
Prerequisites
- Completed
instantly-install-authsetup - Working Instantly integration
- Understanding of async patterns and caching strategies
Instructions
Step 1: Cache Analytics Data
Campaign analytics don't change every second — cache them for 5-15 minutes to avoid redundant API calls.
class InstantlyCache {
private cache = new Map<string, { data: unknown; expiry: number }>();
get<T>(key: string): T | null {
const entry = this.cache.get(key);
if (!entry || Date.now() > entry.expiry) {
this.cache.delete(key);
return null;
}
return entry.data as T;
}
set(key: string, data: unknown, ttlMs: number) {
this.cache.set(key, { data, expiry: Date.now() + ttlMs });
}
}
const cache = new InstantlyCache();
async function getCachedAnalytics(campaignId: string) {
const cacheKey = `analytics:${campaignId}`;
const cached = cache.get<CampaignAnalytics>(cacheKey);
if (cached) return cached;
const data = await instantly<CampaignAnalytics>(
`/campaigns/analytics?id=${campaignId}`
);
cache.set(cacheKey, data, 5 * 60 * 1000); // 5 min TTL
return data;
}
// Cache campaign list (changes infrequently)
async function getCachedCampaigns() {
const cacheKey = "campaigns:all";
const cached = cache.get<Campaign[]>(cacheKey);
if (cached) return cached;
const campaigns = await instantly<Campaign[]>("/campaigns?limit=100");
cache.set(cacheKey, campaigns, 15 * 60 * 1000); // 15 min TTL
return campaigns;
}
Step 2: Batch Lead Operations with Controlled Concurrency
interface BatchResult<T> {
succeeded: T[];
failed: Array<{ input: unknown; error: string }>;
duration: number;
}
async function batchAddLeads(
campaignId: string,
leads: Array<{ email: string; first_name?: string; company_name?: string }>,
options = { concurrency: 5, delayMs: 200, retries: 3 }
): Promise<BatchResult<Lead>> {
const start = Date.now();
const succeeded: Lead[] = [];
const failed: Array<{ input: unknown; error: string }> = [];
let active = 0;
const addWithRetry = async (lead: typeof leads[0]) => {
for (let attempt = 0; attempt <= options.retries; attempt++) {
try {
const result = await instantly<Lead>("/leads", {
method: "POST",
body: JSON.stringify({
campaign: campaignId,
email: lead.emaiExecute Instantly.
Instantly Production Checklist
Overview
Pre-flight checklist for launching Instantly cold email campaigns in production. Covers account warmup verification, deliverability testing, lead list hygiene, campaign configuration, webhook setup, and monitoring. Skip any step that doesn't apply to your use case.
Prerequisites
- Completed
instantly-install-authsetup - Email accounts connected and warmed up (minimum 14 days recommended)
- Lead list prepared with verified emails
Production Launch Checklist
Phase 1: Account Health (2-4 weeks before launch)
import { instantly } from "./src/instantly";
async function phase1AccountHealth() {
console.log("=== Phase 1: Account Health ===\n");
// 1. Verify all accounts have healthy SMTP/IMAP
const accounts = await instantly<Array<{ email: string }>>(
"/accounts?limit=100"
);
const vitals = await instantly("/accounts/test/vitals", {
method: "POST",
body: JSON.stringify({ accounts: accounts.map((a) => a.email) }),
}) as Array<{ email: string; smtp_status: string; imap_status: string }>;
const broken = vitals.filter((v) => v.smtp_status !== "ok" || v.imap_status !== "ok");
console.log(`Accounts: ${accounts.length} total, ${broken.length} broken`);
if (broken.length > 0) {
console.log("FIX THESE FIRST:");
broken.forEach((v) => console.log(` ${v.email}: SMTP=${v.smtp_status} IMAP=${v.imap_status}`));
return false;
}
// 2. Verify warmup is active and healthy
const warmup = await instantly("/accounts/warmup-analytics", {
method: "POST",
body: JSON.stringify({ emails: accounts.map((a) => a.email) }),
}) as Array<{ email: string; warmup_emails_landed_inbox: number; warmup_emails_sent: number }>;
for (const w of warmup) {
const inboxRate = (w.warmup_emails_landed_inbox / (w.warmup_emails_sent || 1)) * 100;
const healthy = inboxRate >= 80;
console.log(` ${w.email}: inbox rate ${inboxRate.toFixed(1)}% ${healthy ? "OK" : "LOW — extend warmup"}`);
}
// 3. Check daily limits are set
const acctDetails = await instantly<Array<{ email: string; daily_limit: number | null }>>(
"/accounts?limit=100"
);
const noLimit = acctDetails.filter((a) => !a.daily_limit);
if (noLimit.length > 0) {
console.log(`\nWARNING: ${noLimit.length} accounts have no daily limit set`);
}
return broken.length === 0;
}
Phase 2: Campaign Configuration (1 week before)
async function phase2CampaignConfig(campaignId: string) {
console.log("\n=== Phase 2: Campaign Configuration ===\n");
const campaign = await instantly<{
name: string;
sequences: Array<{ steps: Implement Instantly.
Instantly Rate Limits
Overview
Handle Instantly API v2 rate limits. The API returns 429 Too Many Requests when limits are exceeded. Most endpoints follow standard limits. The email listing endpoint has a stricter constraint of 20 requests per minute. Failed webhook deliveries are retried up to 3 times within 30 seconds.
Prerequisites
- Completed
instantly-install-authsetup - Understanding of exponential backoff patterns
Known Rate Limits
| Endpoint | Limit | Notes |
|---|---|---|
| Most API endpoints | Standard REST limits | Varies by plan |
GET /emails |
20 req/min | Stricter — email listing |
| Webhook deliveries | 3 retries in 30s | Instantly retries to your endpoint |
| Background jobs | N/A | Async — poll via GET /background-jobs/{id} |
Instructions
Step 1: Exponential Backoff with Jitter
import { InstantlyApiError } from "./src/instantly/client";
interface RetryOptions {
maxRetries: number;
baseDelayMs: number;
maxDelayMs: number;
}
const DEFAULT_RETRY: RetryOptions = {
maxRetries: 5,
baseDelayMs: 1000,
maxDelayMs: 30000,
};
async function withBackoff<T>(
operation: () => Promise<T>,
opts: Partial<RetryOptions> = {}
): Promise<T> {
const { maxRetries, baseDelayMs, maxDelayMs } = { ...DEFAULT_RETRY, ...opts };
for (let attempt = 0; attempt <= maxRetries; attempt++) {
try {
return await operation();
} catch (err) {
const isRetryable =
err instanceof InstantlyApiError &&
(err.status === 429 || err.status >= 500);
if (!isRetryable || attempt === maxRetries) throw err;
// Parse Retry-After header if available
let delay = baseDelayMs * Math.pow(2, attempt);
delay = Math.min(delay, maxDelayMs);
// Add jitter (10-30% of delay)
const jitter = delay * (0.1 + Math.random() * 0.2);
const totalDelay = delay + jitter;
console.warn(
`Rate limited (attempt ${attempt + 1}/${maxRetries}). Waiting ${Math.round(totalDelay)}ms...`
);
await new Promise((r) => setTimeout(r, totalDelay));
}
}
throw new Error("Unreachable");
}
Step 2: Request Queue with Concurrency Control
class RequestQueue {
private queue: Array<() => Promise<void>> = [];
private running = 0;
private readonly maxConcurrent: number;
private readonly delayBetweenMs: number;
constructor(maxConcurrent = 5, delayBetweenMs = 200) {
this.maxConcurrent = maxConcurrent;
this.delayBetweenMs = delayBetweenMs;
}
async add<T&gImplement Instantly.
Instantly Reference Architecture
Overview
Reference architecture for production Instantly.ai integrations. Covers project layout, API client design, event-driven webhook processing, campaign management, lead pipeline, and analytics dashboard. Designed for teams building outreach automation on top of Instantly API v2.
Architecture Diagram
Instantly API v2
(api.instantly.ai)
|
┌─────────────────────┼─────────────────────┐
| | |
Campaign Mgmt Lead Pipeline Account Mgmt
(create/launch/ (import/move/ (warmup/
pause/analytics) enrich/block) vitals/pause)
| | |
└─────────┬───────────┘ |
| |
┌─────────┴─────────┐ |
| Your Backend |◄────────────────────┘
| (Node/Python) |
└────────┬──────────┘
|
┌────────┴──────────┐
| Webhook Receiver |◄──── Instantly Webhooks
| (Cloud Run / | (reply_received,
| Vercel / Fly) | email_bounced, etc.)
└────────┬──────────┘
|
┌─────────────┼─────────────┐
| | |
CRM Sync Slack Alerts Analytics DB
Project Layout
instantly-integration/
├── src/
│ ├── instantly/
│ │ ├── client.ts # API client wrapper with retry + auth
│ │ ├── types.ts # TypeScript interfaces for API schemas
│ │ ├── pagination.ts # Cursor-based pagination helpers
│ │ └── cache.ts # Analytics caching layer
│ ├── campaigns/
│ │ ├── create.ts # Campaign creation with sequences
│ │ ├── launch.ts # Campaign activation workflow
│ │ ├── analytics.ts # Campaign performance tracking
│ │ └── templates.ts # Email sequence templates
│ ├── leads/
│ │ ├── import.ts # Lead import from CSV/CRM
│ │ ├── lists.ts # Lead list management
│ │ ├── enrich.ts # Lead enrichment pipeline
│ │ └── blocklist.ts # Block list management
│ ├── accounts/
│ │ ├── warmup.ts # Warmup enable/disable/monitor
│ │ ├── health.ts # Account vitals testing
│ │ └── rotation.ts # Account assignment to campaigns
│ ├── webhooks/
│ │ ├── server.ts # Express webhook receiver
│ │ ├── handlers.ts # Event type handlers
│ │ └── validatiApply production-ready Instantly.
Instantly SDK Patterns
Overview
Production-ready patterns for Instantly API v2 integrations. Instantly has no official SDK — all integrations use direct REST calls to https://api.instantly.ai/api/v2/. These patterns provide type safety, retry logic, pagination, and multi-tenant support.
Prerequisites
- Completed
instantly-install-authsetup - Familiarity with async/await and TypeScript generics
- Understanding of REST API pagination patterns
Instructions
Step 1: Type-Safe Client with Error Classification
// src/instantly/client.ts
import "dotenv/config";
export class InstantlyClient {
private baseUrl: string;
private apiKey: string;
constructor(options?: { apiKey?: string; baseUrl?: string }) {
this.apiKey = options?.apiKey || process.env.INSTANTLY_API_KEY || "";
this.baseUrl = options?.baseUrl || "https://api.instantly.ai/api/v2";
if (!this.apiKey) throw new Error("INSTANTLY_API_KEY is required");
}
async request<T>(path: string, options: RequestInit = {}): Promise<T> {
const url = `${this.baseUrl}${path}`;
const res = await fetch(url, {
...options,
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${this.apiKey}`,
...options.headers,
},
});
if (!res.ok) {
const body = await res.text();
throw new InstantlyApiError(res.status, path, body);
}
return res.json() as Promise<T>;
}
// Typed convenience methods
async getCampaigns(params?: { limit?: number; status?: number; search?: string }) {
const qs = new URLSearchParams();
if (params?.limit) qs.set("limit", String(params.limit));
if (params?.status !== undefined) qs.set("status", String(params.status));
if (params?.search) qs.set("search", params.search);
return this.request<Campaign[]>(`/campaigns?${qs}`);
}
async getCampaign(id: string) {
return this.request<Campaign>(`/campaigns/${id}`);
}
async createCampaign(data: CreateCampaignInput) {
return this.request<Campaign>("/campaigns", {
method: "POST",
body: JSON.stringify(data),
});
}
async activateCampaign(id: string) {
return this.request<void>(`/campaigns/${id}/activate`, { method: "POST" });
}
async pauseCampaign(id: string) {
return this.request<void>(`/campaigns/${id}/pause`, { method: "POST" });
}
async getAccounts(params?: { limit?: number; status?: number }) {
const qs = new URLSearchParams();
if (params?.limit) qs.set("limit", String(params.limit));
if (params?.status !== undefined) qs.set("status", String(params.status));
return this.request<Account[]>(`/accounts?${qs}`);
Apply Instantly.
Instantly Security Basics
Overview
Secure your Instantly.ai integration with scoped API keys, least-privilege access, secret management, webhook validation, and audit logging. Instantly API v2 uses Bearer token auth with granular scope-based permissions.
Prerequisites
- Instantly account with API access
- Understanding of environment variable management
- Access to Instantly dashboard Settings > Integrations
Instructions
Step 1: Least-Privilege API Key Scopes
Create separate API keys for different use cases with minimal required scopes.
// Key scopes follow the pattern: resource:action
// resource = campaigns, accounts, leads, etc.
// action = read, update, all
// Read-only analytics dashboard
// Scopes needed: campaigns:read, accounts:read
const ANALYTICS_KEY_SCOPES = ["campaigns:read", "accounts:read"];
// Campaign automation bot
// Scopes needed: campaigns:all, leads:all
const AUTOMATION_KEY_SCOPES = ["campaigns:all", "leads:all"];
// Webhook-only integration
// Scopes needed: leads:read (to look up lead data on events)
const WEBHOOK_KEY_SCOPES = ["leads:read"];
// AVOID: all:all gives unrestricted access — dev/test only
| Use Case | Recommended Scopes | Risk Level |
|---|---|---|
| Analytics dashboard | campaigns:read, accounts:read |
Low |
| Lead import tool | leads:update |
Medium |
| Campaign launcher | campaigns:all, leads:all, accounts:read |
High |
| Full automation | all:all |
Critical — dev only |
| Webhook handler | leads:read |
Low |
Step 2: Secret Management
// NEVER hardcode API keys
// BAD:
const client = new InstantlyClient({ apiKey: "sk_live_abc123" });
// GOOD: environment variables
const client = new InstantlyClient({
apiKey: process.env.INSTANTLY_API_KEY!,
});
// BETTER: secret manager integration
import { SecretManagerServiceClient } from "@google-cloud/secret-manager";
async function getApiKey(): Promise<string> {
const client = new SecretManagerServiceClient();
const [version] = await client.accessSecretVersion({
name: "projects/my-project/secrets/instantly-api-key/versions/latest",
});
return version.payload?.data?.toString() || "";
}
# .gitignore — always exclude secrets
.env
.env.*
*.key
Step 3: API Key Rotation
// Instantly supports multiple API keys — rotate without downtime
async function rotateApiKey() {
conMigrate Instantly.
Instantly Upgrade Migration: API v1 to v2
Overview
Migrate from Instantly API v1 (deprecated January 2026) to API v2. Key changes: Bearer token auth replaces query-string API keys, REST-standard endpoints replace legacy paths, scoped API keys replace single global key, and cursor-based pagination replaces offset pagination. Existing v1 integrations via Zapier/Make continue working, but new integrations must use v2.
Prerequisites
- Existing Instantly API v1 integration
- Access to Instantly dashboard to generate v2 API keys
- Understanding of Bearer token authentication
Migration Map
Authentication Change
// v1: API key as query parameter
// DEPRECATED — do not use
const v1Url = `https://api.instantly.ai/api/v1/campaign/list?api_key=${API_KEY}`;
// v2: Bearer token in Authorization header
const v2Response = await fetch("https://api.instantly.ai/api/v2/campaigns", {
headers: { Authorization: `Bearer ${API_KEY}` },
});
Endpoint Migration Table
| Operation | v1 Endpoint | v2 Endpoint | Method Change |
|---|---|---|---|
| List campaigns | GET /api/v1/campaign/list |
GET /api/v2/campaigns |
Same |
| Get campaign | GET /api/v1/campaign/get |
GET /api/v2/campaigns/{id} |
Query -> Path param |
| Create campaign | POST /api/v1/campaign/create |
POST /api/v2/campaigns |
REST standard |
| Launch campaign | POST /api/v1/campaign/launch |
POST /api/v2/campaigns/{id}/activate |
New path |
| Pause campaign | POST /api/v1/campaign/pause |
POST /api/v2/campaigns/{id}/pause |
New path |
| Add leads | POST /api/v1/lead/add |
POST /api/v2/leads |
Simplified |
| List leads | GET /api/v1/lead/list |
POST /api/v2/leads/list |
GET -> POST |
| Delete leads | POST /api/v1/lead/delete |
DELETE /api/v2/leads/{id} |
REST standard |
| Get analytics | GET /api/v1/analytics/campaign |
GET /api/v2/campaigns/analytics |
New path |
| List accounts | GET /api/v1/account/list |
GET /api/v2/accounts |
Simplified |
Request Body Changes
// v1: Campaign creation
const v1Body = {
api_key: "your-key",
name: "Campaign Name",
// Flat structure
};
// v2: Campaign creation — structured scheImplement Instantly.
Instantly Webhooks & Events
Overview
Handle Instantly API v2 webhooks for real-time email outreach event notifications. Instantly fires events when emails are sent, opened, clicked, replied to, or bounced, and when leads change interest status. Webhooks require Hypergrowth plan ($97/mo) or higher. Delivery retries: 3 times within 30 seconds on failure.
Prerequisites
- Instantly Hypergrowth plan or higher (required for webhooks)
- API key with
all:allor appropriate webhook scopes - Public HTTPS endpoint for receiving webhook payloads
INSTANTLYAPIKEYenvironment variable set