npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@appitude/sendivent

v0.4.0

Published

Official TypeScript/JavaScript SDK for Sendivent - Multi-channel notification platform

Readme

Sendivent Node.js/TypeScript SDK

npm version License

Official TypeScript/JavaScript SDK for Sendivent - Multi-channel notification platform supporting Email, SMS, Slack, and Push notifications.

Installation

npm install @sendivent/sdk

Requires Node.js 18+ (for native fetch support)

Quick Start

import { Sendivent } from '@sendivent/sdk';

const sendivent = new Sendivent('test_your_api_key_here', 'welcome');

await sendivent
  .to('[email protected]')
  .payload({ name: 'John Doe' })
  .send();

The SDK automatically routes to sandbox (test_*) or production (live_*) based on your API key prefix.

Response Object

The send() method returns a SendResponse object with helper methods:

const response = await sendivent
  .to('[email protected]')
  .payload({ name: 'John' })
  .send();

if (response.isSuccess()) {
  console.log('Sent! Queue IDs:', response.data);
} else {
  console.error('Error:', response.error);
}

// Available properties: success, data, error, message
// Available methods: isSuccess(), hasError(), toObject(), toJson()

Fire-and-Forget

For background sending without waiting for the response:

// Fire and forget - returns immediately without waiting
sendivent
  .to('[email protected]')
  .payload({ name: 'John' })
  .send()
  .catch(err => console.error('Background send failed:', err));

// Continue with other work...

Contact Objects & Smart Detection

The to() method accepts strings, Contact objects, or arrays of either. Sendivent automatically detects what type of identifier you're sending:

import type { Contact } from '@sendivent/sdk';

// String inputs - automatically detected by pattern matching
await sendivent.event('welcome').to('[email protected]').send();  // Detected as email
await sendivent.event('sms-code').to('+1234567890').send();      // Detected as phone
await sendivent.event('alert').to('U12345').send();              // Detected as Slack user ID

// Contact objects - your user's ID maps to external_id in Sendivent
await sendivent
  .event('welcome')
  .to({
    id: 'user-12345',              // Your user's ID
    email: '[email protected]',
    phone: '+1234567890',
    name: 'John Doe',
    avatar: 'https://example.com/avatar.jpg',
    meta: { tier: 'premium' }
  } as Contact)
  .payload({ welcome_message: 'Hello!' })
  .send();

// Multiple recipients
await sendivent
  .event('newsletter')
  .to([
    '[email protected]',
    { id: 'user-456', email: '[email protected]', name: 'Jane' }
  ])
  .payload({ subject: 'Newsletter' })
  .send();

// Broadcast to Slack channel (no contact created)
await sendivent
  .event('system-alert')
  .channel('slack')
  .to('#general')  // Broadcasts to channel, doesn't create contact
  .payload({ message: 'System update' })
  .send();

Key Features

  • Multi-channel - Email, SMS, Slack, and Push in one API
  • Fluent API - Clean, chainable method calls
  • Type-safe - Full TypeScript support with type definitions
  • Fire-and-forget - Non-blocking sends with promise-based API
  • Idempotency - Prevent duplicate sends with idempotencyKey()
  • Template overrides - Customize subject, sender, etc. per request
  • Language support - Send in different languages with language()
  • Channel control - Force specific channels with channel()
  • Broadcast mode - Send to event listeners without specifying recipients

Additional Examples

Channel-Specific Sending

await sendivent
  .channel('sms')
  .to('+1234567890')
  .payload({ code: '123456' })
  .send();

Template Overrides

await sendivent
  .to('[email protected]')
  .payload({ amount: 100 })
  .overrides({
    email: {
      subject: 'Custom Subject',
      reply_to: '[email protected]'
    }
  })
  .send();

Brand Overrides

await sendivent
  .to('[email protected]')
  .overrides({
    brand: { logotype: 'https://example.fi/logo.png' }
  })
  .send();

Idempotency

await sendivent
  .to('[email protected]')
  .payload({ order_id: '12345' })
  .idempotencyKey('order-12345-confirmation')
  .send();

Language Selection

await sendivent
  .to('[email protected]')
  .payload({ name: 'Anders' })
  .language('sv')  // Swedish
  .send();

Broadcast Events

Send to configured event listeners without specifying recipients:

await sendivent
  .payload({ severity: 'high', message: 'System alert' })
  .send();

Full Example

See example.ts for a comprehensive demonstration of all SDK features.

TypeScript Support

The SDK is written in TypeScript and includes full type definitions:

import { Sendivent, Contact, SendResponse } from '@sendivent/sdk';

const contact: Contact = {
  id: 'user-123',
  email: '[email protected]',
  name: 'John Doe'
};

const response: SendResponse = await sendivent
  .to(contact)
  .payload({ message: 'Hello' })
  .send();

Support

License

MIT License - see LICENSE file for details.