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
๐งช 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>'
});
๐ฌ 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]
});
Send with Template
await metigan.sendEmailWithTemplate({
from: 'you@example.com',
recipients: ['user@example.com'],
subject: 'Welcome!',
templateId: 'welcome-template-id'
});
๐ฅ Manage Contacts
Create Contacts
await metigan.createContacts(['user@example.com'], {
createContact: true,
audienceId: 'audience-id'
});
Get Contact Details
const contact = await metigan.getContact('user@example.com', 'audience-id');
๐ฏ Manage Audiences
Create Audience
const audience = await metigan.createAudience({
name: 'Newsletter',
description: 'Monthly updates'
});
Update Audience
await metigan.updateAudience('audience-id', {
name: 'Premium Newsletter'
});
๐ก Error Handling
import { ValidationError } from 'metigan';
try {
await metigan.sendEmail({ ... });
} catch (error) {
if (error instanceof ValidationError) {
console.error('Validation failed:', error.message);
}
}
๐ 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)