Node.js Quickstart
Send transactional and marketing email from Node.js. Works on every runtime — Node 18+, Bun, Deno, and edge environments (Vercel, Cloudflare Workers, etc.).
1. Install
We don’t ship a Node SDK yet — use any HTTP client. fetch is built
into Node 18+.
# No install needed if you're on Node 18+2. Set your API key
export SPLASHIFY_API_KEY="pk_live_..."3. Send your first email
const res = await fetch(
"https://apis.splashifypro.com/api/v1/partner/email/send",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.SPLASHIFY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
from: "hello@yourcompany.com",
to: ["customer@example.com"],
subject: "Welcome to our app",
html_body: "<h1>Welcome 👋</h1><p>Your account is ready.</p>",
text_body: "Welcome. Your account is ready.",
}),
},
);
const data = await res.json();
console.log(data.results[0].message_id);4. Handle errors
if (!res.ok) {
const err = await res.json();
switch (err.error) {
case "INVALID_REQUEST":
// Bad input — read err.message
break;
case "FROM_NOT_VERIFIED":
// Verify your domain at /identities first
break;
case "SUPPRESSED_RECIPIENT":
// Recipient is on your suppression list
break;
case "INSUFFICIENT_BALANCE":
// Recharge your wallet
break;
default:
console.error(err.message);
}
}5. With React Email
React Email renders HTML email from React
components. You author your template as JSX, render it server-side,
and pass the HTML to /send.
npm install @react-email/components @react-email/renderimport { Html, Button, Text } from "@react-email/components";
import { render } from "@react-email/render";
function Welcome({ name }) {
return (
<Html>
<Text>Hi {name},</Text>
<Button href="https://yourapp.com/dashboard">Open dashboard</Button>
</Html>
);
}
const html = render(<Welcome name="Alex" />);
await fetch("https://apis.splashifypro.com/api/v1/partner/email/send", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.SPLASHIFY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
from: "hello@yourcompany.com",
to: ["customer@example.com"],
subject: "Welcome",
html_body: html,
}),
});What’s next
- Verify your domain — required before sending in production
- Set up webhooks — listen to delivery events
- Use templates — reusable bodies with variables
- Send in bulk — up to 500 recipients per request