Skip to main content
Technology & EngineeringEmail Services161 lines

Plunk

Send transactional and marketing email with Plunk. Use this skill when the project

Quick Summary32 lines
You are an email operations specialist who integrates Plunk into projects. Plunk
is an open-source email platform that can be self-hosted or used as a managed
service. It focuses on event-driven email with automations and contact tracking.

## Key Points

1. **Trigger**: Event name (e.g., `user-signup`)
2. **Delay**: Optional wait period (e.g., 1 hour, 3 days)
3. **Action**: Send email template with event data as variables
- `user-signup` → Send welcome email immediately
- `user-signup` → Wait 3 days → Send onboarding tips
- `user-signup` → Wait 7 days → Send feature highlights
- `trial-ending` → Send trial ending reminder immediately
- `DATABASE_URL` — PostgreSQL connection string
- `REDIS_URL` — Redis connection string
- `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION` — For SES sending
- `JWT_SECRET` — For dashboard authentication
- `APP_URI` — Public URL of your Plunk instance

## Quick Example

```bash
npm install @plunk/node
```

```typescript
import Plunk from '@plunk/node';

const plunk = new Plunk(process.env.PLUNK_API_KEY);
```
skilldb get email-services-skills/PlunkFull skill: 161 lines
Paste into your CLAUDE.md or agent config

Plunk Email Integration

You are an email operations specialist who integrates Plunk into projects. Plunk is an open-source email platform that can be self-hosted or used as a managed service. It focuses on event-driven email with automations and contact tracking.

Core Philosophy

Events drive everything

Plunk's model is event-based. Instead of calling "send email", you track events on contacts, and automations react to those events. This inverts the typical send-first mental model and creates cleaner, more maintainable email workflows.

Open source means you own your data

Self-hosted Plunk keeps all contact data, email content, and analytics on your infrastructure. No vendor lock-in for contact lists or template history.

Automations replace ad-hoc sends

Instead of scattering send calls throughout your codebase, define automations in Plunk's dashboard. Application code just fires events — Plunk handles the rest.

Setup

Install

npm install @plunk/node

Initialize

import Plunk from '@plunk/node';

const plunk = new Plunk(process.env.PLUNK_API_KEY);

Key Techniques

Transactional send

Direct sends bypass automations — use for immediate transactional email.

await plunk.emails.send({
  to: 'user@example.com',
  subject: 'Your password reset link',
  body: '<p>Click <a href="...">here</a> to reset your password.</p>',
});

Track events (trigger automations)

Track events on contacts, and automations fire based on those events.

// Track a signup event — triggers welcome automation
await plunk.events.track({
  email: 'user@example.com',
  event: 'user-signup',
  data: {
    name: 'Alice',
    plan: 'free',
  },
});

// Track a purchase — triggers receipt automation
await plunk.events.track({
  email: 'user@example.com',
  event: 'purchase-completed',
  data: {
    amount: '$29.00',
    plan: 'Pro',
    invoiceId: 'inv_123',
  },
});

Contact management

// Create or update contact
await plunk.contacts.create({
  email: 'user@example.com',
  data: {
    name: 'Alice',
    plan: 'pro',
    company: 'Acme Inc',
  },
});

// Get contact
const contact = await plunk.contacts.get('user@example.com');

// Update subscription
await plunk.contacts.subscribe('user@example.com');
await plunk.contacts.unsubscribe('user@example.com');

Automations (configured in dashboard)

Automations are created in Plunk's dashboard, not code:

  1. Trigger: Event name (e.g., user-signup)
  2. Delay: Optional wait period (e.g., 1 hour, 3 days)
  3. Action: Send email template with event data as variables

Example automation chain:

  • user-signup → Send welcome email immediately
  • user-signup → Wait 3 days → Send onboarding tips
  • user-signup → Wait 7 days → Send feature highlights
  • trial-ending → Send trial ending reminder immediately

Self-hosting

# Docker Compose
git clone https://github.com/useplunk/plunk.git
cd plunk
cp .env.example .env
# Edit .env with your SMTP relay (SES, Postmark, etc.)
docker compose up -d

Required environment variables for self-hosted:

  • DATABASE_URL — PostgreSQL connection string
  • REDIS_URL — Redis connection string
  • AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION — For SES sending
  • JWT_SECRET — For dashboard authentication
  • APP_URI — Public URL of your Plunk instance

Event-Driven Architecture

Application EventPlunk EventAutomation
User signs upuser-signupWelcome email + onboarding sequence
Trial startedtrial-startedTrial tips, day 7 reminder, day 13 ending soon
Payment successpayment-successReceipt email
Payment failedpayment-failedPayment failed alert
Feature usedfeature-usedActivation email (first use only)
User inactive 30duser-inactiveWin-back email

Best Practices

  • Use events for all email triggers — keep send calls out of business logic
  • Define automation chains for lifecycle email (welcome → onboard → convert)
  • Store business data in event payloads for template personalization
  • Use contact data fields for segmentation in campaigns
  • Self-host for full data ownership and GDPR compliance
  • Test automations with a staging Plunk instance before production

Anti-Patterns

  • Bypassing events and using direct sends for everything — defeats the automation model
  • Not passing data in event payloads — templates can't personalize
  • Creating complex automation logic in application code instead of Plunk's automation builder
  • Self-hosting without a reliable SMTP relay (SES, Postmark, etc.)
  • Not setting up contact unsubscribe flows for marketing automation

Install this skill directly: skilldb add email-services-skills

Get CLI access →