foxreach
v0.1.1
Published
Official TypeScript/JavaScript SDK for the FoxReach cold email outreach API
Maintainers
Readme
FoxReach TypeScript/JavaScript SDK
Official TypeScript/JavaScript SDK for the FoxReach cold email outreach API.
Installation
npm install foxreach
# or
yarn add foxreach
# or
pnpm add foxreachQuick Start
import { FoxReach } from "foxreach";
const client = new FoxReach({ apiKey: "otr_your_api_key" });
// Create a lead
const lead = await client.leads.create({
email: "[email protected]",
firstName: "Jane",
lastName: "Smith",
company: "Acme Corp",
});
// List leads with pagination
const page = await client.leads.list({ search: "jane", pageSize: 25 });
for (const lead of page) {
console.log(lead.email);
}
// Auto-paginate through all results
for await (const lead of (await client.leads.list()).autoPagingIter()) {
console.log(lead.email);
}Resources
Leads
await client.leads.list({ page: 1, pageSize: 50, search: "...", status: "active" });
await client.leads.get("cld_...");
await client.leads.create({ email: "..." });
await client.leads.update("cld_...", { company: "New Co" });
await client.leads.delete("cld_...");Campaigns
await client.campaigns.list({ status: "active" });
await client.campaigns.get("cmp_...");
await client.campaigns.create({ name: "Q1 Outreach" });
await client.campaigns.update("cmp_...", { dailyLimit: 100 });
await client.campaigns.delete("cmp_...");
await client.campaigns.start("cmp_...");
await client.campaigns.pause("cmp_...");
await client.campaigns.addLeads("cmp_...", ["cld_1", "cld_2"]);
await client.campaigns.addAccounts("cmp_...", ["acc_1"]);Sequences
await client.campaigns.sequences.list("cmp_...");
await client.campaigns.sequences.create("cmp_...", { body: "Hi {{firstName}}" });
await client.campaigns.sequences.update("cmp_...", "seq_...", { delayDays: 3 });
await client.campaigns.sequences.delete("cmp_...", "seq_...");Templates
await client.templates.list();
await client.templates.get("tpl_...");
await client.templates.create({ name: "Follow-up", body: "Hi {{firstName}}" });
await client.templates.update("tpl_...", { name: "New name" });
await client.templates.delete("tpl_...");Email Accounts
await client.emailAccounts.list();
await client.emailAccounts.get("acc_...");
await client.emailAccounts.delete("acc_...");Inbox
await client.inbox.listThreads({ category: "interested", isRead: false });
await client.inbox.get("rpl_...");
await client.inbox.update("rpl_...", { isRead: true });Analytics
const overview = await client.analytics.overview();
console.log(`Reply rate: ${overview.replyRate}%`);
const stats = await client.analytics.campaign("cmp_...");
console.log(`Sent: ${stats.sent}, Replied: ${stats.replied}`);Error Handling
import { FoxReach, NotFoundError, RateLimitError, AuthenticationError } from "foxreach";
const client = new FoxReach({ apiKey: "otr_..." });
try {
const lead = await client.leads.get("cld_nonexistent");
} catch (err) {
if (err instanceof NotFoundError) {
console.log("Lead not found");
} else if (err instanceof RateLimitError) {
console.log(`Rate limited, retry after ${err.retryAfter}s`);
} else if (err instanceof AuthenticationError) {
console.log("Invalid API key");
}
}Configuration
const client = new FoxReach({
apiKey: "otr_...",
baseUrl: "https://api.foxreach.io/api/v1", // default
timeout: 30000, // ms, default
maxRetries: 3, // retries on 429, default
fetch: customFetch, // optional, for edge runtimes
});Requirements
- Node.js 18+ (uses native
fetch) - Zero runtime dependencies
