Skip to main content

SDKs

Official SDKs

Mailtactic provides first-party SDKs for the most popular server-side languages. All SDKs are generated from the same OpenAPI spec — they’re always in sync with the API.

Node.js / TypeScript

Installation

npm install @mailtactic/node
# or
pnpm add @mailtactic/node

Usage

import { Mailtactic } from '@mailtactic/node';

const client = new Mailtactic({
  apiKey: process.env.MAILTACTIC_API_KEY,
});

// Send a message
const result = await client.messages.send({
  to: 'user@example.com',
  from: 'noreply@yourdomain.com',
  subject: 'Welcome to our app',
  html: '<h1>Welcome!</h1>',
  text: 'Welcome!',
});

console.log(result.id); // message event ID

// Send with a template
await client.messages.send({
  to: 'user@example.com',
  from: 'noreply@yourdomain.com',
  templateId: 'welcome-email',
  variables: { firstName: 'Alice' },
});

Python

Installation

pip install mailtactic

Usage

from mailtactic import Mailtactic

client = Mailtactic(api_key=os.environ["MAILTACTIC_API_KEY"])

result = client.messages.send(
    to="user@example.com",
    from_address="noreply@yourdomain.com",
    subject="Welcome!",
    html="<h1>Welcome!</h1>",
)

print(result.id)

Other languages

Don’t see your language? The REST API works from any HTTP client. All request and response schemas are published in our OpenAPI spec.

Community SDKs:

  • Rubygem install mailtactic
  • PHPcomposer require mailtactic/mailtactic-php
  • Gogo get github.com/mailtactic/mailtactic-go

SDK versioning

SDKs follow semantic versioning. Breaking changes are never introduced in minor or patch releases. Subscribe to our changelog to be notified of new releases.

What’s next