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

@alateamtech/notifuse-client

v1.0.1

Published

Cliente TypeScript para la API de Notifuse (correos transaccionales, contactos, templates, webhooks)

Readme

@alateamtech/notifuse-client

Cliente TypeScript tipado para la API de Notifuse (cloud o self-hosted). Pensado para enviar correos transaccionales desde cualquier aplicación de AlaTeamTech y cubrir APIs satélite (contactos, listas, templates, webhooks, custom events).

Características

  • Envío transaccional con externalId (idempotencia), metadata y adjuntos (base64)
  • Contactos: list / get / upsert / batch import / delete / count
  • Listas: subscribe autenticado y update de status
  • Templates: list / get / compile
  • Webhooks: CRUD, toggle, regenerate secret, delivery history, event types
  • Custom events: import en batch (máx. 50)
  • Validación con Zod, errores tipados, retry con backoff exponencial
  • Dual package ESM + CJS

Instalación

npm install @alateamtech/notifuse-client

Configuración

NOTIFUSE_URL=https://mail.tu-dominio.com
NOTIFUSE_API_KEY=...
NOTIFUSE_WORKSPACE_ID=ws_...
import { createNotifuseClient } from '@alateamtech/notifuse-client';

const client = createNotifuseClient({
  baseUrl: process.env.NOTIFUSE_URL!,
  apiKey: process.env.NOTIFUSE_API_KEY!,
  workspaceId: process.env.NOTIFUSE_WORKSPACE_ID!,
  timeout: 30_000,
  retries: 3,
});

Uso rápido

Enviar correo transaccional

await client.transactional.send({
  notificationId: 'password_reset',
  contact: { email: '[email protected]', firstName: 'Ana' },
  data: { reset_token: 'abc123' },
  externalId: 'pwd-reset-user123',
  emailOptions: {
    replyTo: '[email protected]',
    attachments: [
      {
        filename: 'guide.pdf',
        content: base64Pdf,
        contentType: 'application/pdf',
      },
    ],
  },
});

Límites de adjuntos (validados en el cliente): máx. 20 archivos, 3MB por archivo, 10MB total. Soporta disposition: 'inline' + contentId para imágenes embebidas.

Contactos

await client.contacts.upsert({
  email: '[email protected]',
  firstName: 'Carlos',
  externalId: 'user_123',
});

const { contacts, nextCursor } = await client.contacts.list({ limit: 20 });
const { totalContacts } = await client.contacts.count();

Listas

await client.lists.subscribe({
  contact: { email: '[email protected]' },
  listIds: ['newsletter'],
});

await client.lists.updateSubscription({
  email: '[email protected]',
  listId: 'newsletter',
  status: 'unsubscribed',
});

Templates

const { templates } = await client.templates.list({
  category: 'transactional',
  channel: 'email',
});

const compiled = await client.templates.compile({
  messageId: 'preview_1',
  visualEditorTree: { type: 'mjml', children: [] },
  testData: { user_name: 'Ana' },
  subject: 'Hola {{ user_name }}',
});

Webhooks

const { subscription } = await client.webhooks.create({
  name: 'Production',
  url: 'https://api.example.com/webhooks/notifuse',
  eventTypes: ['email.sent', 'email.delivered'],
});

Custom events

await client.customEvents.import({
  events: [
    {
      eventName: 'orders/fulfilled',
      externalId: 'order_123',
      email: '[email protected]',
      properties: { total: 99.99 },
      goalType: 'purchase',
      goalValue: 99.99,
    },
  ],
});

Errores

import {
  ValidationError,
  AuthenticationError,
  PermissionError,
  NotFoundError,
  isRetryableError,
} from '@alateamtech/notifuse-client';

try {
  await client.transactional.send({ ... });
} catch (error) {
  if (error instanceof AuthenticationError) {
    // API key inválida
  } else if (error instanceof PermissionError) {
    // Falta transactional:write / contacts:read, etc.
  } else if (isRetryableError(error)) {
    // network / timeout / 5xx
  }
}

Migración desde @alateamtech/email-template-client

Ambos packages coexisten. Mapeo orientativo:

| Antes (email-template-client) | Después (notifuse-client) | | ----------------------------------------- | -------------------------------------------------------------------------------------- | | sendEmail('verification', { to, data }) | transactional.send({ notificationId: 'verification', contact: { email: to }, data }) | | sendEmailWithAttachments(...) | emailOptions.attachments (base64) | | renderTemplate(...) | templates.compile(...) | | Templates hardcodeados en el cliente | IDs de notification definidos en Notifuse |

Desarrollo

npm install
npm run test --workspace=@alateamtech/notifuse-client
npm run build --workspace=@alateamtech/notifuse-client

License

MIT