Example: Lead enrichment + personalized outreach
Operations
Pull a list of leads from a CRM, enrich each with public data, and send a personalized opener that references something specific about their company.
async function enrichAndOutreach(inboxId: string, leads: Lead[]) {
for (const lead of leads) {
// 1. Pre-flight verify the email
const verification = await mam("POST", "/verify-email", { email: lead.email });
if (!verification.valid) {
console.log(`skipping ${lead.email} — invalid`);
continue;
}
// 2. Enrich (your own enrichment provider)
const enriched = await enrichLead(lead.email);
// 3. Compose with the LLM
const subject = await llm.compose({
task: "subject_line",
lead: enriched,
max_chars: 60,
});
const body = await llm.compose({
task: "cold_opener",
lead: enriched,
tone: "professional, concise, references the specific thing",
});
// 4. Send
const sent = await mam("POST", `/inboxes/${inboxId}/send`, {
to: lead.email,
subject,
plainBody: body,
verified: true,
});
// 5. Track the outbound thread for reply matching
await db.createOutreach({
leadId: lead.id,
inboxId,
threadId: sent.threadId,
messageId: sent.id,
sentAt: Date.now(),
});
// Friendly rate-limit for warming domains
await sleep(2000);
}
}
For domain warming, keep this tight (10-20 sends/day) for the first week before ramping. See Domain warming.