Simple email automation for Node.js made easy.
- Zero config management: Use simple, chainable code to create email sequences.
- Email platform agnostic: Only SMTP credentials required.
- Compliance Features (Unsubscribing)
- Custom conditionals support
- Tracking Opens
- Self-hostable web interface
import { Sequence, Scheduler } from "dakiya";
import { z } from "zod";
const welcomeVariablesSchema = z.object({
name: z.string(),
verificationUrl: z.string(),
});
enum EmailSequence {
Onboarding = "onboarding",
}
export const onboarding = new Sequence(
EmailSequence.Onboarding,
welcomeVariablesSchema
)
.waitFor("5m")
.sendMail({
subject: "Welcome to {Product Name}!",
html({ name }) {
return `Hi ${name}, Welcome to {Product Name}`; // Email HTML
},
})
.sendMail({
subject: "Verify Your Email",
html({ verificationUrl }) {
return "";
},
})
.waitFor("1d")
.sendMail({
subject: "Access {Product Name} On The Go!",
html({ name }) {
const downloadUrl = "";
return `Hi ${name}, Access {Product Name} on the go using our mobile app. Download for iOS: ${downloadUrl}`
}
});
export const scheduler = new Scheduler([onboarding], {
mongoUri: "", // mongodb connections string
transportOpts: {}, // nodemailer transport options
waitMode: "stack"
});
await scheduler.initialize();
await scheduler.schedule(
EmailSequence.Onboarding,
{ name: "", verificationUrl: "" },
// Nodemailer SendMailOptions
{
to: "",
from: "",
}
);