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

@uninspired/plunk-client

v0.0.6

Published

JS client for the Plunk HTTP API

Downloads

36

Readme

@uninspired/plunk-client

A TypeScript client for the Plunk HTTP API.

Automatically handles the conversion of response data to the correct format.

Requirements

  • A runtime that supports fetch, Buffer and async/await (Node.js >= 18, bun or deno, optionally the browser with a buffer polyfill)

Installation

npm install @uninspired/plunk-client

Usage

Initializing the client

import { PlunkApiClient } from "@uninspired/plunk-client";

const PLUNK_BASE_URL = "https://api.useplunk.com"; // Can be changed for self-hosted Plunk
const PLUNK_API_KEY = "your-api-key"; // Use your API secret key here

const plunkApiClient = new PlunkApiClient(PLUNK_BASE_URL, PLUNK_API_KEY);

Automations

Track an event

const res = await plunkApiClient.trackEvent({
  event: "[EVENT_ID]",
  email: "[email protected]",
  subscribed: true,
  data: {
    foo: "bar",
  },
});

Transactional

Send an email

You can provide attachments to the email by providing an array of JavaScript File objects. They will automatically be converted to base64 with the necessary metadata.

const attachment = new File([], "test.txt");

const res = await plunkApiClient.sendEmail({
  to: "[email protected]",
  subject: "Hello",
  body: "Hello, this is a test email.",
  subscribed: true,
  name: "John Doe",
  from: "[email protected]",
  reply: "[email protected]",
  headers: {
    "X-Custom-Header": "Test",
  },
  attachments: [attachment],
});

Campaigns

Create a campaign

const res = await plunkApiClient.createCampaign({
  subject: "Hello",
  body: "Hello, this is a test email.",
  recipients: ["[email protected]"],
  style: "PLUNK",
});

Send a campaign

const res = await plunkApiClient.sendCampaign("[CAMPAIGN_ID]", {
  live: true, // Should the campaign be sent to the recipients
  delay: 5, // in minutes
});

Update a campaign

const res = await plunkApiClient.updateCampaign("[CAMPAIGN_ID]", {
  subject: "Hello",
  body: "Hello, this is a test email.",
  recipients: ["[email protected]"],
  style: "PLUNK",
});

Delete a campaign

const res = await plunkApiClient.deleteCampaign("[CAMPAIGN_ID]");

Contacts

Get a contact by ID

interface ContactData {
  foo: string;
}

const res = await plunkApiClient.getContactById<ContactData>("[CONTACT_ID]");

Get all contacts

interface ContactData {
  foo: string;
}

const res = await plunkApiClient.getAllContacts<ContactData>();

Get number of contacts

const res = await plunkApiClient.getNumberOfContacts();

Create a contact

interface ContactData {
  foo: string;
}

const res = await plunkApiClient.createContact<ContactData>({
  email: "[email protected]",
  subscribed: true,
  data: {
    foo: "bar",
  },
});

Subscribe a contact

// Subscribe contact by ID
const res = await plunkApiClient.subscribeContact({ id: "[CONTACT_ID]" });

// Subscribe contact by email
const res = await plunkApiClient.subscribeContact({
  email: "[email protected]",
});

Unsubscribe a contact

// Unsubscribe contact by ID
const res = await plunkApiClient.unsubscribeContact({ id: "[CONTACT_ID]" });

// Unsubscribe contact by email
const res = await plunkApiClient.unsubscribeContact({
  email: "[email protected]",
});

Update a contact

interface ContactData {
  foo: string;
}

const res = await plunkApiClient.updateContact<ContactData>({
  id: "[CONTACT_ID]",
  data: { foo: "bar" },
});

Delete a contact

const res = await plunkApiClient.deleteContact("[CONTACT_ID]");

Features

Providing types for the arbitrary "data" field

Any request or response that contains a "data" field can have its type enforced by providing a type argument to the respective method.

Note: The data is not validated, it is simply typed.

interface ContactData {
  foo: string;
  bar?: string;
}

const res = await plunkApiClient.getContactById<ContactData>("[CONTACT_ID]");

// res.data will be of type ContactData

This will throw a TypeScript error:

interface ContactData {
  foo: string;
}

const res = await plunkApiClient.trackEvent<ContactData>({
  event: "[EVENT_ID]",
  email: "[email protected]",
  data: {
    bar: "bar",
  },
});