| name | instantly-performance-tuning |
| description | Optimize Instantly.ai API performance with caching, batching, and connection pooling.
Use when experiencing slow API responses, implementing caching strategies,
or optimizing high-volume lead operations.
Trigger with phrases like "instantly performance", "instantly slow",
"instantly caching", "instantly batch", "optimize instantly api".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Grep |
| version | 1.12.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","instantly","performance","caching","optimization"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
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-auth setup
- 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..(key, { data, : .() + ttlMs });
}
}
cache = ();
() {
cacheKey = ;
cached = cache.<>(cacheKey);
(cached) cached;
data = instantly<>(
);
cache.(cacheKey, data, * * );
data;
}
() {
cacheKey = ;
cached = cache.<[]>(cacheKey);
(cached) cached;
campaigns = instantly<[]>();
cache.(cacheKey, campaigns, * * );
campaigns;
}