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

@tvashtr/notifications

v1.0.1

Published

> Dynamic multi-channel notification service (Brevo, Telegram) and responsive email template builders.

Readme

@tvashtr/notifications

Dynamic multi-channel notification service (Brevo, Telegram) and responsive email template builders.

@tvashtr/notifications provides decoupled messaging engines for sending real-time store alerts to both merchants (via Telegram) and customers (via Brevo email) upon successful checkout or contact enquiry submissions.


📦 Installation

This package is designed to be used internally within the Tvashtr Suite monorepo npm workspace:

{
  "dependencies": {
    "@tvashtr/notifications": "*"
  }
}

🚀 Key Drivers

This package contains low-level wrappers around third-party notification APIs, exposing standard, typed functions:

✉️ Brevo (Email Driver)

A lightweight client that communicates with the Brevo SMTP API using native fetch.

import { sendBrevoEmail } from '@tvashtr/notifications'

await sendBrevoEmail({
  apiKey: 'YOUR_BREVO_API_KEY',
  sender: { name: 'Store Admin', email: '[email protected]' },
  to: [{ email: '[email protected]' }],
  subject: 'Your Order Confirmation',
  htmlContent: '<p>Thank you for your order!</p>'
})

🤖 Telegram (Chat Driver)

Allows instant, zero-cost merchant notification pushes directly to your phone using Telegram Bots.

import { sendTelegramMessage } from '@tvashtr/notifications'

await sendTelegramMessage({
  botToken: 'TELEGRAM_BOT_TOKEN',
  chatId: 'TELEGRAM_CHAT_ID',
  text: '🔔 New Order Received!'
})

🎨 HTML Email Template Builder

The package features a dedicated engine to construct beautiful, responsive HTML emails. It utilizes emailTemplates.ts to build:

  • Order Confirmations: Displays ordered products in a structured table, handles delivery/payment details, and includes customizable branding elements.
  • Enquiry Notifications: Constructs messages sent from store contact/enquiry forms.

Brand Customization Schema

You can completely white-label the email design via a BrandConfig payload:

export interface BrandConfig {
  siteName: string
  siteUrl: string
  logoUrl?: string
  primaryColor?: string   // Hex color code (e.g. #D97706)
  supportEmail?: string
  supportPhone?: string
}

🔔 Integrated Service Endpoints

For standard flows, high-level automation wrappers compile content and invoke drivers automatically:

🛍️ Order Confirmation Flow

Sends a detailed Markdown alert to the store owner's Telegram channel, and a responsive HTML confirmation to the customer's email.

import { notifyOwnerViaTelegram, notifyCustomerViaEmail } from '@tvashtr/notifications'

// Notify owner via Telegram
await notifyOwnerViaTelegram({
  order: orderPayload,
  config: { botToken, chatId }
})

// Email confirmation to customer
await notifyCustomerViaEmail({
  order: orderPayload,
  brand: brandConfig,
  config: { apiKey, sender }
})

💬 Contact Enquiry Flow

Formats a user contact enquiry and pushes it to both the merchant's Telegram and custom email boxes.

import { notifyEnquiry } from '@tvashtr/notifications'

await notifyEnquiry({
  enquiry: { name, email, phone, message },
  brand: brandConfig,
  emailConfig: { apiKey, sender, recipientEmail },
  telegramConfig: { botToken, chatId }
})

🏗️ Design Philosophy

  1. Lightweight & Edge-Ready: All network calls utilize native fetch (with no thick dependencies like Axios or Nodemailer), making this library perfectly optimized for serverless runtimes like Cloudflare Workers.
  2. Robust Formatting: Handles Markdown and HTML generation safely, formatting currencies, dates, and order tables in a clean, professional aesthetic.
  3. Decoupled from Frameworks: The notification logic is entirely vanilla TypeScript, allowing it to be called from a backend API, a Nuxt server route, or standalone cron scripts.