| name | apollo-core-workflow-b |
| description | Implement Apollo.io email sequences and outreach workflow.
Use when building automated email campaigns, creating sequences,
or managing outreach through Apollo.
Trigger with phrases like "apollo email sequence", "apollo outreach",
"apollo campaign", "apollo sequences", "apollo automated emails".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(pip:*), Grep |
| version | 1.0.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
Apollo Core Workflow B: Email Sequences & Outreach
Overview
Implement Apollo.io's email sequencing and outreach automation capabilities for B2B sales campaigns.
Prerequisites
- Completed
apollo-core-workflow-a (lead search)
- Apollo account with Sequences feature enabled
- Connected email account in Apollo
Workflow Components
1. List Existing Sequences
import { apollo } from '../../lib/apollo/client';
export async function listSequences() {
const response = await apollo.request({
method: 'GET',
url: '/emailer_campaigns',
});
return response.emailer_campaigns.map((campaign: any) => ({
id: campaign.id,
name: campaign.name,
status: campaign.active ? 'active' : 'paused',
stepsCount: campaign.num_steps,
contactsCount: campaign.contact_count,
createdAt: campaign.created_at,
stats: {
sent: campaign.emails_sent_count,
opened: campaign.emails_opened_count,
replied: campaign.emails_replied_count,
bounced: campaign.emails_bounced_count,
},
}));
}
2. Create Email Sequence
interface SequenceStep {
type: 'auto_email' | 'manual_email' | 'call' | 'task';
subject?: string;
body?: string;
waitDays: number;
}
interface CreateSequenceParams {
name: string;
steps: SequenceStep[];
sendingSchedule?: {
timezone: string;
days: string[];
startHour: number;
endHour: number;
};
}
export async function createSequence(params: CreateSequenceParams) {
const sequence = await apollo.request({
method: 'POST',
url: '/emailer_campaigns',
data: {
name: params.name,
permissions: 'team',
active: false,
emailer_schedule: params.sendingSchedule ? {
: params..,
: params..,
: params..,
: params..,
} : ,
},
});
( step params.) {
(sequence.., step);
}
sequence.;
}
() {
apollo.({
: ,
: ,
: {
: {
: step.,
: step. * * ,
: step. ? {
: step.,
: step.,
} : ,
},
},
});
}
3. Add Contacts to Sequence
interface AddToSequenceParams {
sequenceId: string;
contactIds: string[];
sendEmailFromId?: string;
}
export async function addContactsToSequence(params: AddToSequenceParams) {
const results = await Promise.allSettled(
params.contactIds.map(async (contactId) => {
return apollo.request({
method: 'POST',
url: '/emailer_campaigns/add_contact_ids',
data: {
emailer_campaign_id: params.sequenceId,
contact_ids: [contactId],
send_email_from_user_id: params.sendEmailFromId,
},
});
})
);
const succeeded = results.filter(r => r.status === 'fulfilled').length;
const failed = results.filter(r => r.status === 'rejected').length;
{
: succeeded,
failed,
: params..,
};
}
() {
apollo.({
: ,
: ,
: {
: sequenceId,
: [contactId],
},
});
}
4. Sequence Analytics
export async function getSequenceAnalytics(sequenceId: string) {
const response = await apollo.request({
method: 'GET',
url: `/emailer_campaigns/${sequenceId}`,
});
const campaign = response.emailer_campaign;
return {
id: campaign.id,
name: campaign.name,
metrics: {
totalContacts: campaign.contact_count,
activeContacts: campaign.active_contact_count,
completedContacts: campaign.finished_contact_count,
},
emailMetrics: {
sent: campaign.emails_sent_count,
delivered: campaign.emails_sent_count - campaign.emails_bounced_count,
opened: campaign.emails_opened_count,
clicked: campaign.emails_clicked_count,
replied: campaign.emails_replied_count,
bounced: campaign.emails_bounced_count,
},
rates: {
deliveryRate: calculateRate(
campaign.emails_sent_count - campaign.,
campaign.
),
: (
campaign.,
campaign.
),
: (
campaign.,
campaign.
),
: (
campaign.,
campaign.
),
},
};
}
(): {
(denominator === ) ;
.((numerator / denominator) * * ) / ;
}
5. Complete Outreach Pipeline
import { searchPeople } from './people-search';
import { createSequence } from './create-sequence';
import { addContactsToSequence } from './sequence-contacts';
interface OutreachCampaign {
name: string;
targetCriteria: {
domains: string[];
titles: string[];
};
emailSteps: Array<{
subject: string;
body: string;
waitDays: number;
}>;
}
export async function launchOutreachCampaign(campaign: OutreachCampaign) {
const leads = await searchPeople({
domains: campaign.targetCriteria.domains,
titles: campaign.targetCriteria.titles,
perPage: 100,
});
console.log(`Found ${leads.contacts.length} matching contacts`);
sequence = ({
: campaign.,
: campaign..( ({
: ,
: step.,
: step.,
: index === ? : step.,
})),
: {
: ,
: [, , , , ],
: ,
: ,
},
});
.();
contactIds = leads..( c.);
result = ({
: sequence.,
contactIds,
});
.();
{
: sequence.,
: result.,
: result.,
};
}
Usage Example
const result = await launchOutreachCampaign({
name: 'Q1 2025 Engineering Leaders Outreach',
targetCriteria: {
domains: ['stripe.com', 'plaid.com', 'square.com'],
titles: ['VP Engineering', 'Director of Engineering'],
},
emailSteps: [
{
subject: 'Quick question about {{company}}',
body: 'Hi {{first_name}}, ...',
waitDays: 0,
},
{
subject: 'Following up',
body: 'Hi {{first_name}}, wanted to follow up...',
waitDays: 3,
},
{
subject: 'Last attempt',
body: 'Hi {{first_name}}, one last note...',
waitDays: 5,
},
],
});
Output
- List of available sequences with stats
- New sequence creation with steps
- Contacts added to sequences
- Campaign analytics and metrics
Error Handling
| Error | Cause | Solution |
|---|
| Email Not Connected | No sending account | Connect email in Apollo UI |
| Contact Already in Sequence | Duplicate enrollment | Check before adding |
| Invalid Email Template | Missing variables | Validate template syntax |
| Sequence Limit Reached | Plan limits | Upgrade plan or archive sequences |
Resources
Next Steps
Proceed to apollo-common-errors for error handling patterns.