Skip to main content ホーム クリエイター jeremylongshore tons-of-skills-marketplace apollo-sdk-patterns
apollo-sdk-patterns Apply production-ready Apollo.io SDK patterns.
Use when implementing Apollo integrations, refactoring API usage,
or establishing team coding standards.
Trigger with phrases like "apollo sdk patterns", "apollo best practices",
"apollo code patterns", "idiomatic apollo", "apollo client wrapper".
インストールへ移動 Skills Marketplace コミュニティが作成したAIスキルを発見・探索
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
直接コマンドでは確認用 Prompt が省略されます。実行前にソースを確認してください。
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace --skill apollo-sdk-patternsコマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
Zipをダウンロード ダウンロード中... このリポジトリの他の Skills langchain-deploy-integration Deploy a LangChain 1.0 / LangGraph 1.0 app to Cloud Run, Vercel, or LangServe correctly — with timeouts sized for chain length, cold-start mitigation, SSE anti-buffering headers, and Secret Manager over .env. Use when prepping a first production deploy, debugging a stream that hangs behind a proxy, or diagnosing p99 latency spikes. Trigger with "langchain deploy", "langchain cloud run", "langchain vercel python", "langchain langserve", or "langchain docker".
langchain-langgraph-agents Build a correct LangGraph 1.0 ReAct agent with create_react_agent — typed tools, error propagation, recursion caps, and stop conditions that actually stop. Use when writing a first tool-calling agent, migrating from AgentExecutor or initialize_agent, or diagnosing an agent that loops on vague prompts. Trigger with "langgraph agent", "create_react_agent", "langgraph tool calling", "AgentExecutor migration", or "agent loop cost".
langchain-langgraph-human-in-loop Build LangGraph 1.0 human-in-the-loop approval flows with interrupt_before /
interrupt_after and Command(resume=...) — JSON-serializable state, clean
resume semantics, and UI wiring for approval decisions. Use when adding an
approval gate before an expensive tool call, wiring a Slack/web UI for agent
approvals, or debugging a graph that crashes on interrupt.
Trigger with "langgraph human in loop", "langgraph interrupt_before",
"langgraph approval flow", "Command resume", "langgraph HITL".
name apollo-sdk-patterns description Apply production-ready Apollo.io SDK patterns.
Use when implementing Apollo integrations, refactoring API usage,
or establishing team coding standards.
Trigger with phrases like "apollo sdk patterns", "apollo best practices",
"apollo code patterns", "idiomatic apollo", "apollo client wrapper".
allowed-tools Read, Write, Edit version 1.13.0 license MIT author Jeremy Longshore <jeremy@intentsolutions.io> tags ["saas","apollo","api"] compatibility Designed for Claude Code
Apollo SDK Patterns
Overview
Production-ready patterns for Apollo.io API integration. Apollo has no official SDK — these patterns wrap the REST API (https://api.apollo.io/api/v1/) with type safety, retry logic, pagination, and bulk operations. All requests use the x-api-key header.
Prerequisites
Completed apollo-install-auth setup
TypeScript 5+ with strict mode
Instructions
Step 1: Type-Safe Client with Zod Validation
import axios, { AxiosInstance } from 'axios' ;
import { z } from 'zod' ;
const ConfigSchema = z.object ({
apiKey : z.string ().min (10 , 'API key too short' ),
baseURL : z.string ().url ().default ('https://api.apollo.io/api/v1' ),
timeout : z.number ().default (30_000 ),
});
let instance : AxiosInstance | null = null ;
export function getApolloClient (config ?: Partial <z.input<typeof ConfigSchema >> ): AxiosInstance {
if (instance) instance;
parsed = . ({
: config?. ?? process. . ,
...config,
});
instance = axios. ({
: parsed. ,
: parsed. ,
: {
: ,
: parsed. ,
},
});
instance;
}
( ) { instance = ; }
return
const
ConfigSchema
parse
apiKey
apiKey
env
APOLLO_API_KEY
create
baseURL
baseURL
timeout
timeout
headers
'Content-Type'
'application/json'
'x-api-key'
apiKey
return
export
function
resetClient
null
Step 2: Custom Error Classes
import { AxiosError } from 'axios' ;
export class ApolloApiError extends Error {
constructor (
message : string ,
public statusCode : number ,
public endpoint : string ,
public retryable : boolean ,
public requestId ?: string ,
) {
super (message);
this .name = 'ApolloApiError' ;
}
static fromAxios (err : AxiosError ): ApolloApiError {
const status = err.response ?.status ?? 0 ;
const body = err.response ?.data as any ;
return new ApolloApiError (
body?.message ?? err.message ,
status,
err.config ?.url ?? 'unknown' ,
[429 , 500 , 502 , 503 , 504 ].includes (status),
err.response ?.headers ?.['x-request-id' ],
);
}
}
export class ApolloRateLimitError extends ApolloApiError {
constructor (
public retryAfterMs : number ,
endpoint : string ,
) {
super (`Rate limited on ${endpoint} ` , 429 , endpoint, true );
this .name = 'ApolloRateLimitError' ;
}
}
Step 3: Retry with Exponential Backoff
import { ApolloApiError } from './errors' ;
export async function withRetry<T>(
fn : () => Promise <T>,
opts : { maxRetries ?: number ; baseMs ?: number ; maxMs ?: number } = {},
): Promise <T> {
const { maxRetries = 3 , baseMs = 1000 , maxMs = 30_000 } = opts;
for (let attempt = 0 ; attempt <= maxRetries; attempt++) {
try {
return await fn ();
} catch (err) {
const isRetryable = err instanceof ApolloApiError && err.retryable ;
if (!isRetryable || attempt === maxRetries) throw err;
const jitter = Math .random () * 500 ;
const delay = Math .min (baseMs * 2 ** attempt + jitter, maxMs);
await new Promise ((r ) => setTimeout (r, delay));
}
}
throw new Error ('Unreachable' );
}
Step 4: Async Pagination Iterator Apollo endpoints return pagination.total_entries and accept page/per_page. The People Search API limits to 500 pages (50,000 records).
import { getApolloClient } from './client' ;
import { withRetry } from './retry' ;
export async function * paginate<T>(
endpoint : string ,
body : Record <string , unknown >,
itemKey : string = 'people' ,
perPage : number = 100 ,
maxPages : number = 500 ,
): AsyncGenerator <T[], void , undefined > {
const client = getApolloClient ();
let page = 1 ;
let totalPages = Infinity ;
while (page <= Math .min (totalPages, maxPages)) {
const { data } = await withRetry (() =>
client.post (endpoint, { ...body, page, per_page : perPage }),
);
const items : T[] = data[itemKey] ?? [];
totalPages = data.pagination ?.total_pages ?? 1 ;
if (items.length === 0 ) break ;
yield items;
page++;
}
}
Step 5: Bulk Enrichment with Rate Awareness Apollo's Bulk People Enrichment endpoint handles up to 10 records per call.
import { getApolloClient } from './client' ;
import { withRetry } from './retry' ;
interface EnrichmentDetail {
email ?: string ;
linkedin_url ?: string ;
first_name ?: string ;
last_name ?: string ;
organization_domain ?: string ;
}
export async function bulkEnrichPeople (
details : EnrichmentDetail [],
opts : { revealPersonalEmails?: boolean ; revealPhoneNumber?: boolean } = {},
): Promise <any []> {
const client = getApolloClient ();
const results : any [] = [];
for (let i = 0 ; i < details.length ; i += 10 ) {
const batch = details.slice (i, i + 10 );
const { data } = await withRetry (() =>
client.post ('/people/bulk_match' , {
details : batch,
reveal_personal_emails : opts.revealPersonalEmails ?? false ,
reveal_phone_number : opts.revealPhoneNumber ?? false ,
}),
);
results.push (...(data.matches ?? []));
if (i + 10 < details.length ) {
await new Promise ((r ) => setTimeout (r, 500 ));
}
}
return results;
}
Output
src/apollo/client.ts — Zod-validated singleton with x-api-key header
src/apollo/errors.ts — ApolloApiError + ApolloRateLimitError with retryable flag
src/apollo/retry.ts — Exponential backoff with jitter
src/apollo/paginator.ts — Async generator for paginated endpoints (500-page limit)
src/apollo/bulk-enrich.ts — Batch enrichment via /people/bulk_match (10 per call)
Error Handling Pattern When to Use Singleton client Always — one client instance per process Retry 429 rate limits, 5xx server errors Pagination Search results > 100 records Bulk enrichment Multiple contacts need email/phone data Custom errors Typed catch blocks distinguishing auth vs rate limit vs server
Examples
Full Pipeline: Search, Paginate, Enrich import { paginate } from './apollo/paginator' ;
import { bulkEnrichPeople } from './apollo/bulk-enrich' ;
async function enrichLeadsAtCompany (domain : string ) {
const allPeople : any [] = [];
for await (const batch of paginate ('/mixed_people/api_search' , {
q_organization_domains_list : [domain],
person_seniorities : ['vp' , 'director' , 'c_suite' ],
})) {
allPeople.push (...batch);
}
console .log (`Found ${allPeople.length} decision-makers at ${domain} ` );
const toEnrich = allPeople
.filter ((p ) => !p.email && p.linkedin_url )
.map ((p ) => ({ linkedin_url : p.linkedin_url }));
const enriched = await bulkEnrichPeople (toEnrich);
console .log (`Enriched ${enriched.length} contacts` );
}
Resources
Next Steps Proceed to apollo-core-workflow-a for lead search implementation.