New:Socket for Asana Is Now Available.Learn more
Get Started

@nitrosend/sdk

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nitrosend/sdk

Node.js/TypeScript SDK for the Nitrosend API

npmnpm
Version
0.6.1
Version published
Weekly downloads
68
-60.92%
Maintainers
1
Weekly downloads
 
Created
Source

@nitrosend/sdk

Node.js/TypeScript SDK for the Nitrosend API — manage contacts, send campaigns, build automation flows, and track events programmatically.

Fully typed. Zero dependencies. Node.js 18+.

Installation

npm install @nitrosend/sdk

Get your API key

  • Log in at nitrosend.com
  • Go to Settings > API Keys
  • Copy your live key (starts with nskey_live_)

Quick Start

import { Nitrosend } from '@nitrosend/sdk';

const ns = new Nitrosend('nskey_live_...');

// Create a contact
const contact = await ns.contacts.create({
  email: 'alice@example.com',
  firstName: 'Alice',
});

// Fire an event (triggers any matching flows)
await ns.events.create({
  event: 'order_confirmed',
  contactEmail: 'alice@example.com',
  idempotencyKey: 'order-123',
  data: { orderId: 123, total: 49.99 },
});

// Send a campaign
const campaign = await ns.campaigns.create({ name: 'March Sale', channelType: 'email' });
await ns.campaigns.send(campaign.id);

// Send a transactional message (receipt, OTP, reset — no campaign needed)
const msg = await ns.messages.send({
  channel: 'email',
  to: 'alice@example.com',
  subject: 'Your order is confirmed',
  body: 'Thanks for your order!',
}, 'order-123-receipt'); // optional idempotency key

Resources

ResourceMethods
ns.accountget, update
ns.contactslist*, get, create, update, delete
ns.campaignslist, get, create, update, send, delete
ns.flowslist, get, create, update, delete, spec
ns.templateslist, get, update, sendTest, preview, spec
ns.eventslist*, get, create, delete
ns.domainslist*, get, create, verify, delete
ns.brandget, update, scrape
ns.segmentslist, get, create, update, delete, count
ns.listslist, get, create, update, delete
ns.keywordslist, get, create, update, delete
ns.messageslist*, get, send

* Paginated — returns { data, pagination }.

Pagination

Paginated endpoints return data and pagination metadata:

import { Nitrosend } from '@nitrosend/sdk';

const ns = new Nitrosend('nskey_live_...');
const result = await ns.contacts.list({ page: 1, limit: 25 });

console.log(result.data);       // Contact[]
console.log(result.pagination); // { page, totalPages, totalCount, nextPage, prevPage }

Error Handling

All errors are typed — use instanceof to handle specific cases:

import { Nitrosend, ValidationError, NotFoundError } from '@nitrosend/sdk';

const ns = new Nitrosend('nskey_live_...');

try {
  await ns.contacts.create({ email: 'invalid' });
} catch (err) {
  if (err instanceof ValidationError) {
    console.log(err.validationErrors); // { email: ['is invalid'] }
  } else if (err instanceof NotFoundError) {
    console.log(err.message);
  }
}

Configuration

const ns = new Nitrosend({
  apiKey: 'nskey_live_...',
  baseUrl: 'https://api.nitrosend.com', // default
  timeout: 30000,                        // ms, default
});

License

MIT

FAQs

Package last updated on 04 Mar 2026

Related posts