MiN8T
Home
Getting Started with the MiN8T Plugin SDK

Getting Started with the MiN8T Plugin SDK

MiN8T Team
MiN8T Editorial
Developer Relations & Integration

Your users need to build emails. Maybe you run a marketing automation platform, a CRM with campaign features, or a CMS that sends transactional messages. You could spend months building a custom email editor from scratch -- wrestling with table-based layouts, Outlook quirks, and cross-client rendering bugs. Or you could embed a production-grade drag-and-drop editor into your product in under five minutes.

That is what the MiN8T Plugin SDK does. It gives you a fully embeddable email editor widget -- the same one powering MiN8T's own platform -- that you can drop into any web application. Your users get a world-class editing experience. You get to ship your product faster and focus on what makes your platform unique.

i

What you will learn: How the Plugin SDK works under the hood, how to embed it in a React app in under five minutes, how to configure themes and locales, how to handle save and export events, how to use Sandbox mode for demos, and how to pick the right pricing tier for your needs.


1 What is the Plugin SDK?

The MiN8T Plugin SDK is a JavaScript library that lets you embed MiN8T's drag-and-drop email editor directly into your own web application. Think of it as an email editor microservice with a visual frontend -- you initialize it with a single function call, and your users get a complete design experience with block palettes, responsive previews, image uploads, and HTML export.

Who is it for?

What you get out of the box

Key takeaway: The Plugin SDK is not a stripped-down "lite" editor. It is the full MiN8T editor, delivered as an embeddable widget. Your users get the same experience as MiN8T's own customers.


2 Architecture Overview

Plugin SDK architecture diagram

Understanding how the SDK works under the hood will help you make better integration decisions. The architecture follows a secure, isolated pattern that keeps your application and the editor cleanly separated.

The iframe + PostMessage Bridge

When you initialize the SDK, it creates a sandboxed <iframe> inside a container element you specify. The editor runs entirely within that iframe -- separate origin, separate DOM, separate styles. This means the editor's CSS can never leak into your app, and your app's JavaScript can never accidentally modify the editor's state.

Communication between your application and the editor happens through the browser's window.postMessage API. The SDK wraps this in a clean, promise-based interface so you never have to deal with raw message events yourself.

Diagram
┌──────────────────────────────────────────────┐
│  YOUR APPLICATION                            │
│                                              │
│  ┌────────────────────────────────────────┐  │
│  │  MiN8T SDK (thin JS layer)            │  │
│  │  - initEditor()                       │  │
│  │  - compileEmail()                     │  │
│  │  - getTemplate()                      │  │
│  └──────────┬─────────────────────────────┘  │
│             │ postMessage                     │
│  ┌──────────▼─────────────────────────────┐  │
│  │  <iframe> (sandboxed)                 │  │
│  │  ┌──────────────────────────────────┐  │  │
│  │  │  MiN8T Editor UI                 │  │  │
│  │  │  - Block palette                 │  │  │
│  │  │  - Canvas                        │  │  │
│  │  │  - Property panels               │  │  │
│  │  └──────────────────────────────────┘  │  │
│  └────────────────────────────────────────┘  │
└──────────────────────────────────────────────┘
         │                        ▲
         ▼                        │
┌──────────────────────────────────────────────┐
│  MiN8T API                                   │
│  - Authentication (OAuth / API key)          │
│  - Asset uploads & CDN                      │
│  - Template storage                          │
│  - HTML compilation                          │
└──────────────────────────────────────────────┘

CDN-Delivered Bundle

The SDK bundle is served from MiN8T's global CDN. You include a single <script> tag (or install the npm package) and the library loads asynchronously. The bundle is versioned, so you can pin to a specific release or track the latest stable channel. Average load time is under 200ms on a broadband connection.

Authentication Flow

The SDK supports two authentication methods. For server-to-server integrations, you generate an API key in your MiN8T dashboard and pass it during initialization via the MiN8T-Api-Auth header. For user-facing applications where you need per-user sessions, use the OAuth flow: your backend exchanges credentials for a short-lived token, and you pass that token to initEditor(). The editor handles token refresh automatically.

!

Security note: Never expose your API key in client-side code. Use your backend to create a session token, then pass only the session token to the frontend SDK. The Sandbox mode (covered in Section 6) is the exception -- it requires no authentication at all.


3 Quick Start: Embed the Editor in 5 Minutes

Code editor showing SDK integration

Let us get the editor running inside a React application. This example assumes you have a React project set up with Create React App, Vite, or Next.js. The same principles apply to Angular and Vue -- only the component lifecycle hooks differ.

Step 1: Install the SDK

You can install via npm or load from the CDN. We recommend npm for production apps because it gives you TypeScript definitions and tree-shaking.

Bash
npm install @min8t.com/plugin-sdk

Alternatively, add the CDN script to your index.html:

HTML
<script src="https://cdn.min8t.com/sdk/v1/min8t-plugin.js" async></script>

Step 2: Create the Editor Component

React / TypeScript
import { useEffect, useRef } from 'react';
import { Min8tEditor } from '@min8t.com/plugin-sdk';

interface EmailEditorProps {
  sessionToken: string;
  templateId?: string;
  onSave?: (html: string, design: object) => void;
}

export function EmailEditor({ sessionToken, templateId, onSave }: EmailEditorProps) {
  const containerRef = useRef<HTMLDivElement>(null);
  const editorRef = useRef<Min8tEditor | null>(null);

  useEffect(() => {
    if (!containerRef.current) return;

    const editor = new Min8tEditor({
      container: containerRef.current,
      token: sessionToken,
      templateId: templateId ?? 'blank',
      locale: 'en',
      theme: 'light',
      onReady: () => {
        console.log('Editor loaded and ready');
      },
      onSave: (data) => {
        onSave?.(data.html, data.design);
      },
    });

    editor.init();
    editorRef.current = editor;

    return () => {
      min8t.destroy();
    };
  }, [sessionToken, templateId]);

  return (
    <div
      ref={containerRef}
      style={{ width: '100%', height: '100vh' }}
    />
  );
}

Step 3: Use It in Your App

React / TypeScript
import { EmailEditor } from './components/EmailEditor';

function CampaignPage() {
  const handleSave = async (html: string, design: object) => {
    // Send to your backend
    await fetch('/api/campaigns/draft', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ html, design }),
    });
  };

  return (
    <div>
      <h1>Design Your Campaign</h1>
      <EmailEditor
        sessionToken={user.min8tToken}
        onSave={handleSave}
      />
    </div>
  );
}

That is it. Three files, under fifty lines of integration code, and your users have a full drag-and-drop email editor inside your application.

Pro tip: The templateId parameter accepts either a saved template ID from MiN8T or the string 'blank' for an empty canvas. You can also pass raw HTML/JSON via loadDesign() after initialization to hydrate the editor with your own stored templates.


4 Configuration Options

The SDK constructor accepts a configuration object with dozens of options. Here are the ones you will use most frequently, grouped by category.

Locale

The editor UI supports 15+ languages out of the box. Pass an ISO 639-1 code at initialization.

JavaScript
new Min8tEditor({
  locale: 'fr',       // French UI
  // Also supports: en, de, es, pt, it, nl, ja, ko, zh, ru, pl, tr, ar, he
});

Theme

Match the editor to your application's look and feel. The SDK ships with 'light' and 'dark' presets. For deeper customization, pass a theme object that overrides specific CSS variables.

JavaScript
new Min8tEditor({
  theme: {
    base: 'dark',
    overrides: {
      '--editor-accent': '#00B2FE',
      '--editor-sidebar-bg': '#1a1a2e',
      '--editor-font-family': '"Inter", sans-serif',
    },
  },
});

Restrictions

Control what your users can and cannot do. This is critical for agencies and white-label providers who need to enforce brand guidelines.

JavaScript
new Min8tEditor({
  restrictions: {
    canEditHtml: false,         // Hide the HTML code view
    canUploadImages: true,      // Allow image uploads
    canChangeStructure: false,  // Lock the layout structure
    lockedBlocks: ['header', 'footer'],  // Prevent editing specific blocks
    allowedBlockTypes: [        // Only show these in the palette
      'text', 'image', 'button', 'divider', 'social'
    ],
  },
});

Callbacks

The SDK communicates state changes through callbacks you register at init time. These fire when the user performs actions inside the editor.

JavaScript
new Min8tEditor({
  onReady: ()          => { /* editor loaded */ },
  onSave:  (data)      => { /* user clicked save */ },
  onChange: (data)      => { /* any content change (debounced 300ms) */ },
  onError: (err)       => { /* something went wrong */ },
  onImageUpload: (file) => {
    // Optional: intercept uploads and use your own storage
    return myS3Upload(file).then(url => ({ url }));
  },
});
i

Custom image uploads: By default, images are uploaded to MiN8T's CDN. If you need to host assets on your own infrastructure, implement the onImageUpload callback. Return a promise that resolves with { url: string } and the editor will use your URL instead.


5 Handling Save and Export Events

The editor produces two things: a design JSON (the editable state) and compiled HTML (the final, production-ready email). Understanding how and when to request each is key to a solid integration.

Getting the Design JSON

Call getTemplate() to get the current editor state as a JSON object. This is what you store in your database so users can resume editing later.

JavaScript
// Save the editable design
const design = await editor.getTemplate();
await fetch('/api/templates', {
  method: 'PUT',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ id: templateId, design }),
});

Compiling to HTML

When the user is ready to send, call compileEmail(). The SDK sends the design to MiN8T's compilation service, which produces inlined, minified, cross-client-tested HTML.

JavaScript
// Compile for sending
const { html } = await editor.compileEmail();

// The HTML is production-ready:
// - CSS inlined for email client compatibility
// - Outlook conditional comments included
// - Images referenced by absolute CDN URLs
// - Responsive media queries in <style> block

await sendCampaign({ to: audienceList, html });

Preview

Generate a preview URL that opens the compiled email in a new tab or in-app iframe. Useful for approval workflows.

JavaScript
const { previewUrl } = await editor.generatePreview();
window.open(previewUrl, '_blank');

Webhook Integration

For server-side workflows (like auto-saving or triggering approval pipelines), configure a webhook URL in your MiN8T dashboard. The SDK will POST events to your endpoint in real-time.

JSON
// Webhook payload example
{
  "event": "template.saved",
  "timestamp": "2026-04-02T14:30:00Z",
  "data": {
    "templateId": "tpl_a1b2c3",
    "projectId": "proj_x9y8z7",
    "version": 12,
    "compiledHtml": "...",
    "designJson": { ... }
  },
  "signature": "sha256=..."
}

Best practice: Always store the design JSON, not just the compiled HTML. The design JSON lets users re-open and edit their work. If you only store HTML, the template becomes read-only. Think of the design JSON as the "source file" and the HTML as the "build artifact."


6 Sandbox Mode for Demos and Trials

Sandbox demo mode for testing

Not ready to commit to a full integration? Sandbox mode lets you try the editor with zero setup -- no API keys, no backend, no authentication. It is designed for three scenarios:

Initializing in Sandbox Mode

JavaScript
const editor = new Min8tEditor({
  container: document.getElementById('editor-root'),
  mode: 'sandbox',   // No token required
  locale: 'en',
  theme: 'light',
  onReady: () => {
    console.log('Sandbox editor ready -- 15 min session');
  },
});

editor.init();

Sandbox Limitations

!

Do not ship Sandbox to production. It is rate-limited, has no SLA, and the 15-minute session cap will frustrate real users. Use it for evaluation, demos, and prototyping only. When you are ready to go live, switch to an authenticated session with a real API key.

Interactive Playground

If you want to test SDK features without writing any code at all, visit the MiN8T Plugin Playground. It is a browser-based environment where you can toggle configuration options, experiment with restrictions, and see the results in real-time. The playground generates a copyable configuration object you can paste directly into your codebase.


7 SDK Pricing and When to Upgrade

SDK pricing tiers

The Plugin SDK uses a tiered pricing model based on monthly active editor sessions (a session starts when initEditor() is called and ends when the user closes the editor or the tab). Here is the breakdown:

Tier Sessions / Month Price Includes
Free 100 $0 Full editor, Sandbox mode, community support
Startup 5,000 $49/mo Remove watermark, image CDN, email support
Business 50,000 $299/mo Custom theme, webhooks, priority support, SLA
Enterprise Unlimited Custom Dedicated infrastructure, SSO, custom blocks, onboarding

When to Upgrade

Cost optimization: Sessions are counted when initEditor() fires, not per page view. If a user opens the editor, closes the tab, and comes back, that counts as two sessions. To reduce session count, persist the editor instance as long as possible (do not unmount it on route changes if the user is likely to return).

Getting Started Today

Here is the fastest path from reading this article to a working integration:

Ready to Embed the Editor?

Start with 100 free sessions per month. No credit card required. Full editor functionality from day one.

Get Your API Key