Email Pipeline

Email automation with workflow rules and AI-powered replies.

Interactive Demo

Manage email automation workflows

Code Example

email-demo.ts
import { EmailPipeline, Brain, MemoryStore } from "@shivamsharma11/agent-sdk";

const pipeline = new EmailPipeline({
  storage: new MemoryStore(),
  brain: new Brain({ providers: [...] }),
});

// Ensure user config
await pipeline.run({ operation: "ensure", userId: "user-1" });

// Add a workflow rule
await pipeline.run({
  operation: "addWorkflowRule",
  userId: "user-1",
  rule: {
    match: { field: "subject", op: "contains", value: "support" },
    action: { kind: "reply", text: "Thank you for contacting support!" },
  },
});

// Process incoming email
const result = await pipeline.run({
  operation: "processIncomingEmail",
  token: "webhook-token",
  email: {
    threadId: "thread-1",
    from: "user@example.com",
    subject: "support request",
    body: "I need help with my account.",
  },
});