Transactional

TypeScript Integration

Integrate Transactional with TypeScript. Official SDK with full type safety and modern async/await support.

Getting Started with TypeScript

Transactional's TypeScript SDK provides a fully-typed interface for all API operations. Built with modern TypeScript practices, it offers excellent IDE support and compile-time type checking.

Installation

npm install @transactional/sdk

Basic Usage

import { Transactional } from '@transactional/sdk';
 
const client = new Transactional({
  apiKey: process.env.TRANSACTIONAL_API_KEY,
});
 
// Send an email
const { data, error } = await client.emails.send({
  from: 'hello@yourdomain.com',
  to: 'user@example.com',
  subject: 'Welcome!',
  html: '<h1>Hello, World!</h1>',
});
 
if (error) {
  console.error('Failed to send:', error.message);
} else {
  console.log('Email sent:', data.id);
}

Type Safety

All responses are fully typed:

import type { Email, SendEmailRequest } from '@transactional/sdk';
 
const request: SendEmailRequest = {
  from: 'hello@yourdomain.com',
  to: 'user@example.com',
  subject: 'Hello',
  html: '<p>Hi!</p>',
};
 
const { data } = await client.emails.send(request);
// data is typed as Email | undefined

Next Steps