🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

sendlix

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sendlix

Send emails using Sendlix API

1.0.3
latest
Source
npm
Version published
Weekly downloads
22
100%
Maintainers
1
Weekly downloads
 
Created
Source

NodeJS SDK for Sendlix

This SDK enables the integration of the Sendlix API into NodeJS applications. It provides clients for email sending, group management, and other functionalities.

Contents

  • Installation
  • Getting Started
  • Authentication
  • Available Clients
  • Examples
  • Contributing and Support

Installation

Install the SDK via npm:

npm install sendlix

Getting Started

Import the SDK into your project:

import { EmailClient, GroupClient, IAuth } from "sendlix";

Authentication

The SDK uses an API key for authentication. The API key must be in the format secret.keyId (When you copy it from the dashboard, it's already in the correct format). There are two options:

  • Passing an API key string:

    const emailClient = new EmailClient("sk_xxxxxxxxx.xxx");
    
  • Using an IAuth instance:

    import { Auth } from "sendlix-nodejs-sdk";
    const auth: IAuth = new Auth("sk_xxxxxxxxx.xxx");
    const emailClient = new EmailClient(auth);
    const groupClient = new GroupClient(auth);
    

We recommend using the second option when you want to use both clients. This way, the auth token is only requested once and passed to both clients.

Available Clients

EmailClient

The EmailClient allows you to send emails, both standardized emails and pre-formatted EML messages.

Methods

  • sendEmail(sendMail, additionalOptions?)
    Sends a configured email.

  • sendRawEmail(eml, additionalOptions?)
    Sends an EML file or EML string.

  • sendGroupEmail(content, from, groupId, subject)
    Sends an email to a defined group.

  • sendEmailWithTracking(sendMail, additionalOptions?)
    Sends an email with tracking for clicks and opens.

GroupClient

The GroupClient allows you to add email addresses to groups or remove them from groups.

Methods

  • insertEmailIntoGroup(groupId, email, substitutions?)
    Adds one or more email addresses to a group.

  • deleteEmailFromGroup(groupId, email)
    Removes an email address from a group. Note: The email must be in the group for at least 30 minutes.

  • containsEmailInGroup(groupId, email)
    Checks if an email address is in a group.

Examples

Sending an Email

import { EmailClient } from "sendlix-nodejs-sdk";

// Initialize client
const client = new EmailClient("sk_xxxxxxxxx.xxx");

// Email configuration
const sendMail = {
  from: { email: "sender@example.com", name: "Sender Name" },
  to: [{ email: "recipient@example.com", name: "Recipient Name" }],
  subject: "Hello World!",
  html: "<h1>Welcome!</h1><p>This is a test email.</p>",
};

// Send email
client
  .sendEmail(sendMail)
  .then((response) => {
    console.log("Email sent:", response);
  })
  .catch((error) => {
    console.error("Error sending email:", error);
  });

Adding an Email to a Group

import { GroupClient } from "sendlix-nodejs-sdk";

// Initialize client
const groupClient = new GroupClient("sk_xxxxxxxxx.xxx");

groupClient
  .insertEmailIntoGroup("groupId123", "recipient@example.com")
  .then((success) => {
    console.log("Email added to group:", success);
  })
  .catch((error) => {
    console.error("Error adding email to group:", error);
  });

Contributing and Support

Contributions to the SDK are welcome. Please use Issues and Pull Requests to report bugs or suggest new features.

For questions or problems, please contact Sendlix support or refer to the appropriate community forums.

This SDK was developed to facilitate the use of the Sendlix API in NodeJS applications. Follow the Sendlix Documentation for more details about the API endpoints and advanced configuration options.

Keywords

sendlix

FAQs

Package last updated on 05 May 2025

Did you know?

Socket

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.

Install

Related posts