Implement Apollo.io webhook handling.
Use when receiving Apollo webhooks, processing event notifications,
or building event-driven integrations.
Trigger with phrases like "apollo webhooks", "apollo events",
"apollo notifications", "apollo webhook handler", "apollo triggers".
Build event-driven integrations with Apollo.io. Apollo does not have a native webhook system like Stripe — instead, you build real-time sync by polling the API for changes or using third-party webhook platforms (Zapier, Pipedream, Make) that trigger on Apollo events. This skill covers both approaches plus the Contact Stages and Tasks APIs for workflow automation.
Prerequisites
Apollo account with master API key
Node.js 18+ with Express
For polling: a scheduler (cron, Cloud Scheduler, BullMQ)
For webhook platforms: Zapier/Pipedream/Make account
Instructions
Step 1: Poll for Contact Changes
Since Apollo lacks native webhooks, poll the Contacts Search API for recently updated records.
// src/sync/contact-poller.ts
import axios from 'axios';
const client = axios.create({
baseURL: 'https://api.apollo.io/api/v1',
headers: { 'Content-Type': 'application/json', 'x-api-key': process.env.APOLLO_API_KEY! },
});
interface SyncState {
lastSyncAt: string; // ISO timestamp
}
export async function pollContactChanges(state: SyncState) {
const { data } = await client.post('/contacts/search', {
sort_by_field: 'contact_updated_at',
sort_ascending: false,
per_page: 100,
});
const lastSync = new Date(state.lastSyncAt);
const newChanges = data.contacts.filter(
(c: any) => new Date(c.updated_at) > lastSync,
);
if (newChanges.length > 0) {
console.log(`Found ${newChanges.length} contact changes since ${state.lastSyncAt}`);
for (const contact of newChanges) {
await handleContactChange(contact);
}
state.lastSyncAt = new Date().toISOString();
}
return newChanges;
}
async function handleContactChange(contact: any) {
console.log(`Contact updated: ${contact.name} (${contact.email}) — stage: ${contact.contact_stage_id}`);
// Sync to your CRM, database, or notification system
}
Step 2: Track Contact Stage Changes
Apollo has a Contact Stages system. Use the List Contact Stages endpoint to get stage IDs, then filter contacts by stage.
// src/sync/stage-tracker.ts
export async function getContactStages() {
const { data } = await client.get('/contact_stages');
return data.contact_stages.map((s: any) => ({
id: s.id,
name: s.name,
order: s.display_order,
}));
}
// Find contacts that moved to a specific stage
export async function getContactsByStage(stageId: string) {
const { data } = await client.post('/contacts/search', {
contact_stage_ids: [stageId],
sort_by_field: 'contact_updated_at',
sort_ascending: false,
per_page: 50,
});
return data.contacts;
}
// Update a contact's stage
export async function updateContactStage(contactId: string, stageId: string) {
await client.put(`/contacts/${contactId}`, {
contact_stage_id: stageId,
});
}
Step 3: Monitor Sequence Engagement
Poll sequence data for replies, bounces, and engagement events.