JavaScript SDK
The official Mailpulse SDK for JavaScript, TypeScript, React, and Vue applications.
Installation
npm install mailpulse
# or
pnpm add mailpulse
# or
yarn add mailpulseFeatures
- TypeScript First - Full type definitions included
- Framework Agnostic - Works with vanilla JS, React, Vue, or any framework
- Lightweight - Minimal bundle size with tree-shaking support
- Modern - ESM and CommonJS builds available
Quick Start
import { MailpulseClient } from 'mailpulse';
const client = new MailpulseClient({
apiKey: 'your-api-key',
});
// Get global stats
const stats = await client.getStats();
console.log(stats.openRate);
// Get campaigns
const { campaigns } = await client.getCampaigns();
// Get campaign stats
const campaignStats = await client.getCampaignStats('campaign-id', {
period: '30d'
});Configuration
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
apiKey | string | Yes | - | Your Mailpulse API key |
apiUrl | string | No | https://mailpulse-io.lyten.agency | API base URL |
Available Methods
| Method | Description |
|---|---|
getStats() | Get global tracking statistics |
getCampaigns() | List all campaigns |
getCampaign(id) | Get campaign details with emails |
getCampaignStats(id, options) | Get detailed campaign analytics |
registerEmail(data) | Register an email for tracking |
Framework Integrations
Choose your framework to get started:
- Vanilla JavaScript - Core client usage
- React - Provider and hooks
- Vue - Composables for Vue 3
Last updated on