![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
The Sidemail Node.js library provides convenient access to the Sidemail API from applications written in server-side JavaScript.
Install this package with:
npm install sidemail --save
# or
yarn add sidemail
First, the package needs to be configured with your project's API key, which you can find in the Sidemail Dashboard.
Here's how:
// Create Sidemail instance and set your API key.
const configureSidemail = require("sidemail");
const sidemail = configureSidemail({ apiKey: "xxxxx" });
Then, you can call sidemail.sendEmail
to send emails like so:
try {
const response = await sidemail.sendEmail({
toAddress: "user@email.com",
fromAddress: "you@example.com",
fromName: "Your app",
templateName: "Welcome",
});
// Response contains email ID
console.log(
`An email with ID '${response.id}' was successfully queued for sending. :)`
);
} catch (err) {
// Uh-oh, we have an error! You error handling logic...
console.error(err);
}
The response will look like this:
{
"id": "5e858953daf20f3aac50a3da",
"status": "queued"
}
Learn more about Sidemail API:
await sidemail.sendEmail({
toAddress: "user@email.com",
fromAddress: "you@example.com",
fromName: "Your app",
templateName: "Password reset",
templateProps: { resetUrl: "https://your.app/reset?token=123" },
});
await sidemail.sendEmail({
toAddress: "user@email.com",
fromName: "Startup name",
fromAddress: "your@startup.com",
templateName: "Welcome",
templateProps: { firstName: "Patrik" },
// Deliver email in 60 minutes from now
scheduledAt: "2020-04-04T12:58:50.964Z",
});
Useful for dynamic data where you have n
items that you want to render in email. For example, items in a receipt, weekly statistic per project, new comments, etc.
await sidemail.sendEmail({
toAddress: "user@email.com",
fromName: "Startup name",
fromAddress: "your@startup.com",
templateName: "Template with dynamic list",
templateProps: {
list: [
{ text: "Dynamic list" },
{ text: "allows you to generate email template content" },
{ text: "based on template props." },
],
}
}
});
await sidemail.sendEmail({
toAddress: "user@email.com",
fromName: "Startup name",
fromAddress: "your@startup.com",
subject: "Testing html only custom emails :)",
html: "<html><body><h1>Hello world! 👋</h1><body></html>",
});
await sidemail.sendEmail({
toAddress: "user@email.com",
fromName: "Startup name",
fromAddress: "your@startup.com",
subject: "Testing plain-text only custom emails :)",
text: "Hello world! 👋",
});
try {
const response = await sidemail.contacts.createOrUpate({
emailAddress: "marry@lightning.com",
identifier: "123",
customProps: {
name: "Marry Lightning",
// ... more of your contact props ...
},
});
console.log(`Contact was '${response.status}'.`);
} catch (err) {
// Uh-oh, we have an error! You error handling logic...
console.error(err);
}
const response = await sidemail.contacts.find({
emailAddress: "marry@lightning.com",
});
const response = await sidemail.contacts.list();
and to paginate
const response = await sidemail.contacts.list({ paginationCursorNext: "123" });
const response = await sidemail.contacts.delete({
emailAddress: "marry@lightning.com",
});
Visit Sidemail docs for more information.
FAQs
Node.js library for the Sidemail API.
The npm package sidemail receives a total of 134 weekly downloads. As such, sidemail popularity was classified as not popular.
We found that sidemail demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.