Requires Node.js 14+
Installation
Install the@sendsculpt/client npm package:
npm install @sendsculpt/client
Quick Start
Initialize the client with your API Key.const { SendSculptClient } = require("@sendsculpt/client");
const client = new SendSculptClient("your_secret_api_key_here");
async function triggerEmail() {
try {
const response = await client.sendEmail({
to: ["recipient@example.com"],
subject: "Welcome to SendSculpt!",
fromEmail: "noreply@yourdomain.com",
bodyHtml: "<p>Hello! This is a test email from the SendSculpt Node.js SDK.</p>"
});
console.log("Success:", response);
} catch (error) {
console.error("Failed to send:", error.message);
}
}
triggerEmail();
Advanced Usage
Send emails utilizing SendSculpt Templates and auto-encoded Attachments.const { SendSculptClient } = require("@sendsculpt/client");
const client = new SendSculptClient("your-api-key");
async function sendMonthlyInvoice() {
try {
const response = await client.sendEmail({
to: ["john@doe.com"],
subject: "Your Monthly Invoice",
fromEmail: "billing@yourdomain.com",
templateId: "your-template-uuid",
templateData: {
first_name: "John",
invoice_amount: "49.99"
},
cc: ["finance@yourdomain.com"],
attachments: [
{
filename: "invoice.pdf",
filePath: "/path/to/invoice.pdf", // Automatically converted to base64
mime_type: "application/pdf"
}
]
});
console.log("Email queued successfully. Message ID:", response.message_id);
} catch (error) {
console.error(error.message);
}
}
sendMonthlyInvoice();
The SendSculpt API automatically handles environments based on your API key. Use a Sandbox key for testing and a Live key for
production.