open-index/open-npm huggingface dataset:
npm package: @outreachagent/sdk-ts
Description: TypeScript SDK for the OutreachAgent API — email infrastructure for AI agents
Latest version: 0.1.0

# @outreachagent/sdk-ts

TypeScript SDK for the [OutreachAgent](https://outreachagent.dev) API — production-grade email infrastructure for AI agents.

## Install

```bash
npm install @outreachagent/sdk-ts
```

## Quick start

```typescript
import { OutreachAgentClient } from "@outreachagent/sdk-ts";

const client = new OutreachAgentClient(
  "https://api.outreachagent.dev",
  "rm_live_..."
);

// Send an email
const message = await client.sendMessage({
  inboxId: "inb_abc123",
  subject: "Hello from my agent",
  body: "Hi there,\n\nJust wanted to reach out and introduce myself. Let me know if you have any questions about our platform.\n\nBest,\nAgent",
  from: "agent@yourdomain.com",
  to: ["recipient@example.com"],
});

// Create a contact with attributes
const contact = await client.createContact({
  email: "jane@company.com",
  fullName: "Jane Doe",
  attributes: { company: "Acme Corp", role: "CTO" },
});

// Create a template (use `body` or `text` for plaintext content)
const template = await client.createTemplate({
  name: "Intro Email",
  subject: "Hi {{ contact.attributes.firstName }}",
  body: "Hey {{ contact.attributes.firstName }}, I noticed {{ vars.hook }}.",
});

// Create a workflow
const workflow = await client.createWorkflow({
  name: "Onboarding Drip",
  trigger: "api",
  nodes: [
    { id: "n1", type: "send_email", label: "Welcome", templateId: template.id, inboxId: "inb_abc123", nextNodeId: "n2" },
    { id: "n2", type: "delay", label: "Wait 2 days", delayAmount: 2, delayUnit: "days", nextNodeId: "n3" },
    { id: "n3", type: "exit", label: "Done", nextNodeId: null },
  ],
});
await client.publishWorkflow(workflow.id);

// Enroll with per-enrollment variables
const enrollment = await client.createEnrollment({
  workflowId: workflow.id,
  contactId: contact.id,
  variables: { hook: "you just raised a Series A" },
});

// Test-send a workflow email to yourself before enrolling real contacts
await client.testSendWorkflow(workflow.id, {
  nodeId: "n1",
  to: "you@yourteam.com",
  variables: { hook: "your recent product launch" },
});
```

## Error handling

```typescript
import { OutreachAgentError } from "@outreachagent/sdk-ts";

try {
  await client.sendMessage({ ... });
} catch (err) {
  if (err instanceof OutreachAgentError) {
    console.log(err.status);  // HTTP status (e.g. 400)
    console.log(err.code);    // "validation_error"
    console.log(err.message); // Human-readable description
  }
}
```

The SDK automatically retries on transient errors (408, 429, 500, 502, 503, 504) with exponential backoff.

## API base URL

| Environment | URL |
|---|---|
| Production | `https://api.outreachagent.dev` |
| Local dev | `http://localhost:4000` |

## Resources

- [Documentation](https://outreachagent.dev/docs)
- [LLM Context](https://outreachagent.dev/llms-full.txt) — full API reference optimized for LLM context windows
- [OpenAPI Spec](https://api.outreachagent.dev/v1/openapi.json)