DEV Community

Cover image for Introducing Metigan SDK
Francisco Inoque
Francisco Inoque

Posted on

Introducing Metigan SDK

Introducing Metigan SDK: The Simpler Way to Send Emails and Manage Contacts

Sending emails at scale and managing audiences shouldn’t be a pain. Whether you're building transactional notifications, marketing workflows, or onboarding sequences — Metigan SDK is here to make it easy, clean, and reliable.

🚀 What is Metigan SDK?

Metigan SDK is a powerful and flexible toolkit designed to integrate seamlessly with the Metigan email and audience platform. It provides developers with a simple API for:

  • Sending emails (transactional or marketing)
  • Managing contacts
  • Organizing and segmenting audiences
  • Using dynamic email templates
  • Handling file attachments
  • Ensuring reliability with retry and error handling

✨ Features at a Glance

  • 📧 Email Sending – Send personalized and automated emails easily
  • 👥 Contact Management – Create, update, and track your users
  • 🎯 Audience Management – Segment your list for targeted campaigns
  • 📝 Templates – Use dynamic variables and pre-built layouts
  • 📎 Attachments – Add files in both Node.js and browser environments
  • 🔄 Retry Mechanism – Automatic retries for better delivery
  • 🔒 Error Handling – Typed, rich error feedback

🧑‍💻 Installation

npm install metigan
# or
yarn add metigan
# or
pnpm add metigan
Enter fullscreen mode Exit fullscreen mode

🧪 Quick Start

import Metigan from 'metigan';

const metigan = new Metigan('your_api_key');

await metigan.sendEmail({
  from: 'your-company@example.com',
  recipients: ['user@example.com'],
  subject: 'Hello from Metigan',
  content: '<h1>Hi there!</h1>'
});
Enter fullscreen mode Exit fullscreen mode

📬 Email Examples

Send with Attachment

const file = new File(['Hello'], 'hello.txt', { type: 'text/plain' });

await metigan.sendEmail({
  from: 'your-company@example.com',
  recipients: ['user@example.com'],
  subject: 'Attached File',
  content: '<p>See attached</p>',
  attachments: [file]
});
Enter fullscreen mode Exit fullscreen mode

Send with Template

await metigan.sendEmailWithTemplate({
  from: 'you@example.com',
  recipients: ['user@example.com'],
  subject: 'Welcome!',
  templateId: 'welcome-template-id'
});
Enter fullscreen mode Exit fullscreen mode

👥 Manage Contacts

Create Contacts

await metigan.createContacts(['user@example.com'], {
  createContact: true,
  audienceId: 'audience-id'
});
Enter fullscreen mode Exit fullscreen mode

Get Contact Details

const contact = await metigan.getContact('user@example.com', 'audience-id');
Enter fullscreen mode Exit fullscreen mode

🎯 Manage Audiences

Create Audience

const audience = await metigan.createAudience({
  name: 'Newsletter',
  description: 'Monthly updates'
});
Enter fullscreen mode Exit fullscreen mode

Update Audience

await metigan.updateAudience('audience-id', {
  name: 'Premium Newsletter'
});
Enter fullscreen mode Exit fullscreen mode

🛡 Error Handling

import { ValidationError } from 'metigan';

try {
  await metigan.sendEmail({ ... });
} catch (error) {
  if (error instanceof ValidationError) {
    console.error('Validation failed:', error.message);
  }
}
Enter fullscreen mode Exit fullscreen mode

🌐 Works Everywhere

Node.js or browser — Metigan SDK supports both.


📘 Full Docs & Community

To learn more and view all available methods, visit [
(https://docs.metigan.com).

If you build something with Metigan, share it with us — we’d love to showcase it!


🧡 Made with love by the Metigan team


#javascript #typescript #emailmarketing #api #sdk #devtools #webdev #opensource #metigan

Top comments (0)