Create and launch an Instantly.ai cold email campaign with D0/D3/D8 sequences and bulk-import leads via API, no dashboard needed.
Programmatically create an Instantly.ai cold email campaign with D0/D3/D8 sequences and bulk-import leads — all via Instantly API v2. One script, zero dashboard clicking.
INSTANTLY_KEY — Instantly API v2 Bearer token (set as env var)scripts/campaign.config.js — campaign name, schedule, D0/D3/D8 email bodiesleads.json — array of lead objects: {email, firstName, lastName, companyName, website}scripts/campaign-launcher.js — main entry pointscripts/campaign.config.js — config template (edit before running)# 1. Get your Instantly API v2 token from app.instantly.ai → Settings → API Keys
export INSTANTLY_KEY=your_token_here
# 2. Edit scripts/campaign.config.js — set campaign name, schedule, email copy
# 3. Create leads.json (array of lead objects)
# 4. Run:
node scripts/campaign-launcher.js --config scripts/campaign.config.js --leads leads.json
[
{ "email": "john@example.com", "firstName": "John", "lastName": "Smith", "companyName": "Acme Inc", "website": "acme.com" },
{ "email": "jane@corp.io", "firstName": "Jane", "companyName": "Corp IO" }
]
module.exports = {
campaignName: 'My Outreach Campaign',
schedule: {
name: 'Business Hours',
timing: { from: '09:00', to: '17:00' },
days: { monday: true, tuesday: true, wednesday: true, thursday: true, friday: true, saturday: false, sunday: false },
timezone: 'America/New_York', // or Asia/Dubai, Europe/London, etc.
},
sequences: [
{ step: 1, delay: 0, subject: 'Your subject', body: 'Hi {{firstName}}, ...' },
{ step: 2, delay: 3, subject: 'Re: Your subject', body: 'Follow-up body...' },
{ step: 3, delay: 8, subject: 'Last note, {{firstName}}', body: 'Closing body...' },
],
};
POST /campaigns/:id/sequences/sequences endpoint occasionally returns 404 → add sequences manually in dashboard if this occursZIP package — ready to use