{"_id":"maileroo-sdk","name":"maileroo-sdk","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.1":{"name":"maileroo-sdk","version":"1.0.1","description":"Official Node.js SDK for Maileroo v2 API. Send transactional/marketing emails via Maileroo with a simple and intuitive API.","keywords":["maileroo","email","smtp","transactional","marketing","sdk","api"],"license":"MIT","author":{"name":"Areeb Majeed"},"repository":{"type":"git","url":"git+https://github.com/maileroo/maileroo-node-sdk.git"},"bugs":{"url":"https://github.com/maileroo/maileroo-node-sdk/issues"},"homepage":"https://github.com/maileroo/maileroo-node-sdk#readme","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"engines":{"node":">=18.0.0"},"scripts":{"clean":"rimraf dist","build":"tsc -p tsconfig.json","prepublishOnly":"npm run clean && npm run build"},"devDependencies":{"@types/node":"^20.0.0","typescript":"^5.5.0","rimraf":"^3.0.2"},"publishConfig":{"access":"public"},"_id":"maileroo-sdk@1.0.1","gitHead":"33e7dab4e93423f02d7607ae599a4fba10a6b0a2","_nodeVersion":"20.12.0","_npmVersion":"10.5.0","dist":{"integrity":"sha512-8Ij/neVnbIq6Fwb4mIHBPg/Ui+S//lF/noxEOUyuM7CO4us66a8O4T0BqaVlNydLdsl6J4dQdUOz+Re6KFM9pQ==","shasum":"09085348c86ee3eb52a1183bc8217f5f46a3fb90","tarball":"https://registry.npmjs.org/maileroo-sdk/-/maileroo-sdk-1.0.1.tgz","fileCount":11,"unpackedSize":32938,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDDC1UMqJ62Z5spLu2qZOjndKspNXJrRzg0/0K4ct8gvAiEA5Saktde/Tn+ABNiXXE5p/8McifuYC5lO/Abk0a0J4VM="}]},"_npmUser":{"name":"maileroo","email":"areeb@maileroo.com"},"directories":{},"maintainers":[{"name":"maileroo","email":"areeb@maileroo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/maileroo-sdk_1.0.1_1755398753385_0.46641937321709803"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-17T02:45:53.181Z","1.0.1":"2025-08-17T02:45:53.571Z","modified":"2025-08-17T02:45:53.964Z"},"maintainers":[{"name":"maileroo","email":"areeb@maileroo.com"}],"description":"Official Node.js SDK for Maileroo v2 API. Send transactional/marketing emails via Maileroo with a simple and intuitive API.","homepage":"https://github.com/maileroo/maileroo-node-sdk#readme","keywords":["maileroo","email","smtp","transactional","marketing","sdk","api"],"repository":{"type":"git","url":"git+https://github.com/maileroo/maileroo-node-sdk.git"},"author":{"name":"Areeb Majeed"},"bugs":{"url":"https://github.com/maileroo/maileroo-node-sdk/issues"},"license":"MIT","readme":"# Maileroo Node.js SDK\n\nMaileroo is a robust email delivery platform designed for effortless sending of transactional and marketing emails. This Node.js SDK offers a straightforward interface for working with the Maileroo API, supporting basic email formats,\ntemplates, bulk sending, and scheduling capabilities.\n\n# Features\n\n- Send basic HTML or plain text emails with ease\n- Use pre-defined templates with dynamic data\n- Send up to 500 personalized emails in bulk\n- Schedule emails for future delivery\n- Manage scheduled emails (list & delete)\n- Add tags, custom headers, and reference IDs\n- Attach files to your emails\n- Support for multiple recipients, CC, BCC, and Reply-To\n- Enable or disable open and click tracking\n- Built-in input validation and error handling\n\n## Install\n\n```bash\nnpm i maileroo-sdk\n# or\nyarn add maileroo-sdk\n```\n\n## Quick Start\n\n```javascript\nimport {MailerooClient, EmailAddress, Attachment} from \"maileroo-sdk\";\n\nconst client = new MailerooClient(\"your-api-key\");\n\nconst referenceId = await client.sendBasicEmail({\n    from: new EmailAddress(\"sender@example.com\", \"Sender Name\"),\n    to: [new EmailAddress(\"recipient@example.com\", \"Recipient Name\")],\n    subject: \"Hello from Maileroo!\",\n    html: \"<h1>Hello World!</h1><p>This is a test email.</p>\",\n    plain: \"Hello World! This is a test email.\"\n});\n\nconsole.log(\"Email sent with reference ID:\", referenceId);\n```\n\n## Usage Examples\n\n### 1. Basic Email with Attachments\n\n```javascript\nimport {MailerooClient, EmailAddress, Attachment} from \"maileroo-sdk\";\n\nconst client = new MailerooClient(\"your-api-key\");\n\nconst referenceId = await client.sendBasicEmail({\n    from: new EmailAddress(\"sender@example.com\", \"Your Company\"),\n    to: [\n        new EmailAddress(\"john@example.com\", \"John Doe\"),\n        new EmailAddress(\"jane@example.com\")\n    ],\n    cc: [new EmailAddress(\"manager@example.com\", \"Manager\")],\n    bcc: [new EmailAddress(\"archive@example.com\")],\n    reply_to: new EmailAddress(\"support@example.com\", \"Support Team\"),\n    subject: \"Monthly Report\",\n    html: \"<h1>Monthly Report</h1><p>Please find the report attached.</p>\",\n    plain: \"Monthly Report - Please find the report attached.\",\n    attachments: [\n        await Attachment.fromFile(\"/path/to/report.pdf\", \"application/pdf\", false),\n        Attachment.fromContent(\"data.csv\", \"id,name\\n1,John\", \"text/csv\", false, false),\n        await Attachment.fromStream(\"stream.txt\", Readable.from([\"Hello world from a stream!\"]), \"text/plain\", false),\n    ],\n    tracking: true,\n    tags: {campaign: \"monthly-report\", type: \"business\"},\n    headers: {\n        \"X-Custom-Header\": \"Custom Value\",\n        \"X-Another-Header\": \"Another Value\"\n    },\n    reference_id: client.getReferenceId()\n});\n```\n\n### 2. Sending Emails with Templates\n\n```javascript\nconst referenceId = await client.sendTemplatedEmail({\n    from: new EmailAddress(\"noreply@example.com\", \"Your App\"),\n    to: new EmailAddress(\"user@example.com\", \"John Doe\"),\n    subject: \"Welcome to Our Service!\",\n    template_id: 123,\n    template_data: {\n        user_name: \"John Doe\",\n        activation_link: \"https://example.com/activate/abc123\",\n        company_name: \"Your Company\"\n    }\n});\n```\n\n### 3. Bulk Email Sending\n\n```javascript\nconst result = await client.sendBulkEmails({\n    subject: \"Newsletter - March 2024\",\n    html: \"<h1>Hello {{name}}!</h1><p>Here’s your newsletter.</p>\",\n    plain: \"Hello {{name}}! Here’s your newsletter.\",\n    tracking: false,\n    tags: {campaign: \"newsletter\", month: \"march\"},\n    messages: [\n        {\n            from: new EmailAddress(\"newsletter@example.com\", \"Newsletter Team\"),\n            to: new EmailAddress(\"john@example.com\", \"John Doe\"),\n            template_data: {name: \"John\"}\n        },\n        {\n            from: new EmailAddress(\"newsletter@example.com\", \"Newsletter Team\"),\n            to: new EmailAddress(\"jane@example.com\", \"Jane Smith\"),\n            template_data: {name: \"Jane\"}\n        }\n    ]\n});\n\nconsole.log(\"Bulk email reference IDs:\", result);\n```\n\n### 4. Scheduling Emails\n\n```javascript\nconst scheduledAt = new Date(Date.now() + 24 * 3600 * 1000);\n\nconst referenceId = await client.sendBasicEmail({\n    from: new EmailAddress(\"scheduler@example.com\", \"Scheduler\"),\n    to: new EmailAddress(\"recipient@example.com\", \"Recipient\"),\n    subject: \"Scheduled Email - Daily Report\",\n    html: \"<h1>Daily Report</h1><p>This was scheduled.</p>\",\n    plain: \"Daily Report - Scheduled\",\n    scheduled_at: scheduledAt\n});\n\nconsole.log(\"Scheduled with reference ID:\", referenceId);\n```\n\n### 5. Managing Scheduled Emails\n\n```javascript\nconst scheduled = await client.getScheduledEmails(1, 20);\n\nfor (const email of scheduled.results) {\n    console.log(\"Email:\", email.reference_id, email.subject);\n    if (email.reference_id === \"cancel-me\") {\n        await client.deleteScheduledEmail(email.reference_id);\n        console.log(\"Cancelled email:\", email.reference_id);\n    }\n}\n```\n\n### 6. Deleting Scheduled Emails\n\n```javascript\nconst referenceId = \"your-scheduled-email-reference-id\";\nawait client.deleteScheduledEmail(referenceId);\nconsole.log(\"Deleted scheduled email with reference ID:\", referenceId);\n```\n\n## API Reference\n\n### MailerooClient\n\n```\nnew MailerooClient(apiKey: string, timeoutSec?: number)\n```\n\n#### Methods\n\n- `sendBasicEmail(data): Promise<string>`\n- `sendTemplatedEmail(data): Promise<string>`\n- `sendBulkEmails(data): Promise<string[]>`\n- `getScheduledEmails(page?: number, per_page?: number): Promise<object>`\n- `deleteScheduledEmail(referenceId: string): Promise<boolean>`\n- `getReferenceId(): string`\n\n### EmailAddress\n\n```\nnew EmailAddress(address: string, displayName?: string)\n```\n\n- `.getAddress()`\n- `.getDisplayName()`\n- `.toJSON()`\n\n### Attachment\n\nFactory Methods:\n\n- `Attachment.fromFile(path: string, contentType?: string, inline?: boolean): Promise<Attachment>`\n- `Attachment.fromContent(fileName: string, content: string|Buffer, contentType?: string, inline?: boolean, isBase64?: boolean): Attachment`\n- `Attachment.fromStream(fileName: string, stream: AsyncIterable<Buffer>, contentType?: string, inline?: boolean): Promise<Attachment>`\n\n## Documentation\n\nFor detailed API documentation, including all available endpoints, parameters, and response formats, please refer to the [Maileroo API Documentation](https://maileroo.com/docs).\n\n## License\n\nThis SDK is released under the MIT License.\n\n## Support\n\nPlease visit our [support page](https://maileroo.com/contact-form) for any issues or questions regarding Maileroo. If you find any bugs or have feature requests, feel free to open an issue on our GitHub repository.","readmeFilename":"README.md","_rev":"1-d6bb8e705f1a71085b748c61d020497e"}