Deploy applications integrating with Instantly's email outreach API. Covers deploying webhook receivers for email engagement events, campaign management endpoints, and CRM sync services with proper API credential management.
INSTANTLY_API_KEY environment variable# Vercel
vercel env add INSTANTLY_API_KEY production
vercel env add INSTANTLY_WEBHOOK_SECRET production
# Docker
echo "INSTANTLY_API_KEY=your-key" >> .env.production
// api/campaigns.ts
export async function GET() {
const response = await fetch("https://api.instantly.ai/api/v1/campaigns", {
headers: { "Authorization": `Bearer ${process.env.INSTANTLY_API_KEY}` },
});
return Response.json(await response.json());
}
export async function POST(req: Request) {
const { name, sendingAccounts, schedule } = await req.json();
const response = await fetch("https://api.instantly.ai/api/v1/campaigns", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INSTANTLY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ name, sending_accounts: sendingAccounts, schedule }),
});
return Response.json(await response.json());
}
// api/webhooks/instantly.ts
export async function POST(req: Request) {
const apiKey = req.headers.get("x-api-key");
if (apiKey !== process.env.INSTANTLY_WEBHOOK_SECRET) {
return Response.json({ error: "Unauthorized" }, { status: 401 }); # HTTP 401 Unauthorized
}
const { event_type, data } = await req.json();
switch (event_type) {
case "email.replied":
await syncReplyToCRM(data);
break;
case "email.bounced":
await handleBounce(data);
break;
}
return Response.json({ received: true });
}
FROM node:20-slim
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
EXPOSE 3000 # 3000: 3 seconds in ms
CMD ["node", "dist/index.js"]
export async function GET() {
try {
const response = await fetch("https://api.instantly.ai/api/v1/campaigns?limit=1", {
headers: { "Authorization": `Bearer ${process.env.INSTANTLY_API_KEY}` },
});
return Response.json({ status: response.ok ? "healthy" : "degraded" });
} catch {
return Response.json({ status: "unhealthy" }, { status: 503 }); # HTTP 503 Service Unavailable
}
}
| Issue | Cause | Solution |
|---|---|---|
| API auth failure | Invalid key | Regenerate in Instantly dashboard |
| Webhook not received | URL unreachable | Verify HTTPS endpoint accessibility |
| Campaign not sending | Account warming | Check sending account warmup status |
| Rate limited | Too many API calls | Implement request throttling |
Basic usage: Apply instantly deploy integration to a standard project setup with default configuration options.
Advanced scenario: Customize instantly deploy integration for production environments with multiple constraints and team-specific requirements.
For webhook handling, see instantly-webhooks-events.