TypeScript SDK
A typed client for the SendCrew API, generated from the same tool registry as the MCP server.
npm install @sendcrew/sdkimport { SendCrew, SendCrewError } from "@sendcrew/sdk";
const sendcrew = new SendCrew({ apiKey: process.env.SENDCREW_API_KEY });
const senders = await sendcrew.listSenders();
const queued = await sendcrew.sendConnection({
url: "https://www.linkedin.com/in/someone/",
note: "Loved your post on pricing",
campaign: "q1-founders",
idempotency_key: "q1-founders:someone",
});
console.log(queued.action_id, queued.run_after);
const status = await sendcrew.getActionStatus({ action_id: queued.action_id! });Every tool is a method with the tool's name in camelCase (send_connection → sendConnection, check_inbox → checkInbox), and takes the same input as the MCP tool. You can also call a tool by name: sendcrew.call("get_stats", { range: "30d" }).
The input types, the REST routes and the method list are generated from SendCrew's tool registry, so the SDK always matches the API version it was released with. Writes return a QueuedAction (action_id, status, run_after, deferred_reason); the common reads (listSenders, checkInbox, getActionStatus, listActions) are typed too, and the rest return JSON.
Options
| Option | Default |
|---|---|
apiKey | SENDCREW_API_KEY |
baseUrl | SENDCREW_BASE_URL, then https://sendcrew.io |
fetch | the global fetch (Node.js 18+, Bun, Deno, edge runtimes) |
Keep the key on the server. It acts for the whole workspace.
Errors
Non-2xx responses throw SendCrewError with the HTTP status, the stable code and details:
try {
await sendcrew.sendMessage({ url_or_thread: url, text, dry_run: true });
} catch (err) {
if (err instanceof SendCrewError && err.code === "SAFETY_BLOCKED") {
console.log("Skipped:", err.details); // e.g. { reason: "already_invited" }
} else throw err;
}The codes are listed in errors. A safety refusal is a normal outcome, not a bug: skip that lead and move on.