Skip to main content
Developer tools

Use the SDK, CLI, OpenClaw, Skills, or MCP to integrate Migma into your workflow

Installation

Requirements: Node.js 18 or later.

Quick Start

Prefer async? Use migma.emails.generate() to kick off generation without waiting, then set up a webhook to receive an email.generation.completed event when the design is ready — no polling needed.

OpenClaw

Use Migma from WhatsApp, Telegram, and Discord with OpenClaw.

Configuration

Error Handling

Every method returns { data, error } — it never throws:
Error codes: validation_error, not_found, unauthorized, forbidden, rate_limit_exceeded, conflict, timeout, network_error, internal_error, unknown

Async Polling Helpers

Email generation, brand import, and preview creation are asynchronous. The SDK provides *AndWait helpers that poll automatically until the operation completes:
All three polling methods: You can cancel any polling operation with an AbortController:

Generated emails and series

Generate one email or a full series from the same API. Pass count when you want a specific number of emails; otherwise Migma infers the output from the prompt.
result.html and result.subject are always the primary email for backwards compatibility. Use result.emails[] when you need the stable emailId, per-email HTML, screenshots, or series order.

Edit generated emails

Fetch one generated email by ID, or prompt Migma to edit it:

Email performance

See how a generated email performed across every API send of it, or pull its per-recipient send log:
Numbers arrive asynchronously. Opens are directional — Apple Mail Privacy Protection and bots inflate them — so clicks and delivery are stronger signals.

Resources

The SDK exposes 15 resources that map to every API v1 endpoint:

Complete Example

Here’s a full workflow — import a brand, generate an email, export it, and send:
For single-email conversations, conversationId also works. For multi-slot emails and series, send a specific email with emailId:
By default, emails send through Migma’s built-in infrastructure. You can also send via Amazon SES, Resend, SendGrid, or Mailgun by connecting your provider and passing providerType in the send call.

Resources

npm

View on npm registry

CLI

Use Migma from the command line

API Reference

Full endpoint documentation

Discord

Get help from the community