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

@astro-minimax/notify

v0.9.3

Published

Multi-channel notification package for astro-minimax blogs — supports Telegram, Email (Resend), and more.

Readme

@astro-minimax/notify

多渠道通知包,为 astro-minimax 博客系统提供灵活的通知功能。

特性

  • 多渠道支持:Telegram、Email (Resend)、Webhook
  • 多事件类型:评论通知、AI 对话监控
  • 丰富信息展示:Token 用量、阶段耗时、引用文章等
  • 隐私保护:Session ID 自动匿名化
  • 代理支持:支持 HTTP/HTTPS 代理
  • 容错设计:失败不影响主业务流程

安装

pnpm add @astro-minimax/notify

环境变量配置

Telegram Provider

NOTIFY_TELEGRAM_BOT_TOKEN=your-bot-token
NOTIFY_TELEGRAM_CHAT_ID=your-chat-id

获取方式:

  1. 在 Telegram 搜索 @BotFather,发送 /newbot 创建 Bot,获取 Token
  2. 在 Telegram 搜索 @userinfobot,发送 /start 获取你的 Chat ID

Email Provider (Resend)

NOTIFY_RESEND_API_KEY=re_xxx
[email protected]
[email protected]

获取方式:

  1. 注册 Resend 账号
  2. 在 Dashboard 创建 API Key
  3. 验证发件域名

Webhook Provider

NOTIFY_WEBHOOK_URL=https://your-webhook.com/notify

使用方式

基础用法

import { createNotifier } from '@astro-minimax/notify';

const notifier = createNotifier({
  telegram: {
    botToken: process.env.NOTIFY_TELEGRAM_BOT_TOKEN,
    chatId: process.env.NOTIFY_TELEGRAM_CHAT_ID,
  },
  email: {
    provider: 'resend',
    apiKey: process.env.NOTIFY_RESEND_API_KEY,
    from: process.env.NOTIFY_RESEND_FROM,
    to: process.env.NOTIFY_RESEND_TO,
  },
  webhook: {
    url: process.env.NOTIFY_WEBHOOK_URL,
  },
});

// 发送评论通知
await notifier.comment({
  author: '张三',
  content: '文章写得真好!',
  postTitle: '如何使用 Astro',
  postUrl: 'https://example.com/posts/how-to-use-astro',
});

// 发送 AI 对话通知
await notifier.aiChat({
  sessionId: 'abc123',
  roundNumber: 1,
  userMessage: '你好',
  aiResponse: '你好!有什么可以帮助你的?',
  model: {
    name: 'gpt-4',
    provider: 'openai',
  },
  usage: {
    total: 100,
    input: 50,
    output: 50,
  },
  timing: {
    total: 1500,
    generation: 1400,
  },
});

自定义模板

const notifier = createNotifier({
  telegram: { botToken, chatId },
  templates: {
    comment: {
      telegram: (event) => ({
        text: `📬 新评论\n\n${event.author}: ${event.content}`,
        parse_mode: 'HTML',
      }),
    },
  },
});

API

createNotifier(config: NotifyConfig): Notifier

创建通知器实例。

NotifyConfig

interface NotifyConfig {
  telegram?: {
    botToken: string;
    chatId: string;
  };
  webhook?: {
    url: string;
    method?: 'POST';
    headers?: Record<string, string>;
  };
  email?: {
    provider: 'resend';
    apiKey: string;
    from: string;
    to: string;
  };
  templates?: Partial<EventTemplates>;
  logger?: Logger;
}

Notifier

interface Notifier {
  comment(event: Omit<CommentEvent, 'type'>): Promise<NotifyResult>;
  aiChat(event: Omit<AiChatEvent, 'type'>): Promise<NotifyResult>;
  send(event: NotifyEvent): Promise<NotifyResult>;
}

事件类型

CommentEvent

interface CommentEvent {
  type: 'comment';
  author: string;
  content: string;
  postTitle: string;
  postUrl: string;
}

AiChatEvent

interface AiChatEvent {
  type: 'ai-chat';
  sessionId: string;
  roundNumber: number;
  userMessage: string;
  aiResponse?: string;
  referencedArticles?: Array<{ title: string; url?: string }>;
  model?: {
    name: string;
    provider?: string;
    apiHost?: string;
  };
  usage?: {
    total: number;
    input: number;
    output: number;
  };
  timing?: {
    total: number;
    keywordExtraction?: number;
    search?: number;
    generation?: number;
  };
}

通知效果

评论通知

💬 新评论

📖 文章:如何使用 Astro
👤 评论者:张三

「文章写得真好!」

🔗 查看评论

AI 对话通知

🗣 博客 AI 对话

👤 a1b2***f6 · 🕐 03-17 12:30 · 第 3 轮

❓ 读者:
「你好,测试 AI 对话通知功能」

💬 AI:
你好!AI 对话通知功能测试成功...

📎 引用文章:
  · 2026 年个人技术博客生态全览:从零构建你的博客系统
  · 为什么选择 astro-minimax:设计决策与技术思考

⚙️ 模型配置:
  · API Host: api.openai.com
  · 主对话模型: gpt-4

🧮 Token 用量:
  · 本次请求合计: 总 1,089 / 入 500 / 出 589

⏱️ 阶段耗时:
  · 总耗时: 15.50s
  · 文本生成: 15.49s

License

MIT