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

mailglyph

v1.2.0

Published

Official MailGlyph Node.js / TypeScript SDK

Readme

MailGlyph Node.js SDK

CI Release Please

Official Node.js / TypeScript SDK for the MailGlyph API.

Install

npm install mailglyph
yarn add mailglyph

Initialize

import MailGlyph from 'mailglyph';

// Secret key client (all endpoints except /v1/track)
const client = new MailGlyph('sk_your_api_key');

// Public key client (/v1/track only)
const tracker = new MailGlyph('pk_your_public_key');

Emails

// HTML + explicit text
const result = await client.emails.send({
  to: '[email protected]',
  from: { name: 'My App', email: '[email protected]' },
  subject: 'Welcome!',
  body: '<h1>Hello {{name}}</h1>',
  text: 'Hello {{name}}',
  data: { name: 'John' }
});

// HTML only (backend auto-generates text from body)
await client.emails.send({
  to: '[email protected]',
  from: '[email protected]',
  subject: 'HTML only',
  body: '<h1>Hello</h1><p>This is HTML-only content.</p>'
});

// HTML + text="" (opt out of text/plain part)
await client.emails.send({
  to: '[email protected]',
  from: '[email protected]',
  subject: 'No text/plain part',
  body: '<h1>Hello</h1>',
  text: ''
});

const verification = await client.emails.verify('[email protected]');
console.log(verification.data.valid, verification.data.isRandomInput);

Events

await tracker.events.track({
  email: '[email protected]',
  event: 'purchase',
  data: { product: 'Premium', amount: 99 }
});

const { eventNames } = await client.events.listNames();

Contacts

const { data, cursor, hasMore } = await client.contacts.list({ limit: 50 });
console.log(data.length, cursor, hasMore);

const contact = await client.contacts.create({
  email: '[email protected]',
  data: { firstName: 'John', plan: 'premium' }
});

await client.contacts.update(contact.id, { subscribed: false });
await client.contacts.delete(contact.id);

Templates

const templates = await client.templates.list({ type: 'TRANSACTIONAL', search: 'welcome' });
console.log(templates.data.length, templates.totalPages);

const template = await client.templates.create({
  name: 'Welcome',
  subject: 'Welcome!',
  body: '<h1>Welcome</h1>',
  type: 'TRANSACTIONAL'
});

await client.templates.update(template.id, { subject: 'Welcome to MailGlyph' });
await client.templates.delete(template.id);

Segments

const segment = await client.segments.create({
  name: 'Premium Users',
  condition: {
    logic: 'AND',
    groups: [{ filters: [{ field: 'data.plan', operator: 'equals', value: 'premium' }] }]
  },
  trackMembership: true
});

const members = await client.segments.listContacts(segment.id, { page: 1 });

const addMembersResult = await client.segments.addStaticMembers(segment.id, {
  emails: ['[email protected]', '[email protected]']
});
console.log(addMembersResult.added, addMembersResult.notFound);

const removeMembersResult = await client.segments.removeStaticMembers(segment.id, {
  emails: ['[email protected]']
});
console.log(removeMembersResult.removed);

Campaigns

const campaign = await client.campaigns.create({
  name: 'Product Launch',
  subject: 'Introducing our new feature!',
  body: '<h1>Big news!</h1><p>Check out our latest feature.</p>',
  from: '[email protected]',
  audienceType: 'FILTERED',
  audienceCondition: {
    logic: 'AND',
    groups: [{ filters: [{ field: 'subscribed', operator: 'equals', value: true }] }]
  }
});

const campaignPage = await client.campaigns.list({ page: 1, pageSize: 20, status: 'DRAFT' });
console.log(campaignPage.data.length, campaignPage.total);

await client.campaigns.send(campaign.id, {
  scheduledFor: '2026-03-01T10:00:00Z'
});

await client.campaigns.test(campaign.id, '[email protected]');

const stats = await client.campaigns.stats(campaign.id);
await client.campaigns.cancel(campaign.id);

Configuration

const customClient = new MailGlyph('sk_your_api_key', {
  baseUrl: 'https://api.mailglyph.com',
  timeout: 30000
});

Development

npm run lint
npm run typecheck
npm test
npm run build