Skip to content
Souloss
Go back

Blog Notification System Configuration Guide

Learn how to configure the multi-channel notification system for astro-minimax blog, supporting Telegram, Email, and Webhook for real-time comment and AI chat notifications.

astro-minimax includes a built-in multi-channel notification system that automatically sends notifications to Telegram, Email, or custom Webhooks when your blog receives comments or users interact with the AI chat.

Feature Overview

The notification system supports:

FeatureDescription
Multi-channelTelegram Bot, Email (Resend), Webhook
Multi-eventNew comments, AI conversations
Rich informationToken usage, phase timing, referenced articles
Privacy protectionAutomatic Session ID anonymization

Environment Variables

The notification system is configured via environment variables, all prefixed with NOTIFY_.

Telegram Bot Configuration

# Notify - Telegram Provider
NOTIFY_TELEGRAM_BOT_TOKEN=your-bot-token
NOTIFY_TELEGRAM_CHAT_ID=your-chat-id
bash

Getting Bot Token

  1. Search for @BotFather in Telegram
  2. Send /newbot to create a new Bot
  3. Follow the prompts to set the Bot name
  4. Receive the Token (format: 123456789:ABCdefGHIjklMNOpqrsTUVwxyz)

Getting Chat ID

  1. Search for @userinfobot in Telegram
  2. Send /start
  3. Receive your Chat ID (a pure number like 123456789)

Tip

Chat ID can be a personal chat, group, or channel. When sending to a group, the Bot must be a group administrator.

Email Configuration (Resend)

# Notify - Email Provider (Resend)
NOTIFY_RESEND_API_KEY=re_xxx
NOTIFY_RESEND_FROM=noreply@yourdomain.com
NOTIFY_RESEND_TO=you@example.com
bash

Getting Resend API Key

  1. Sign up for a Resend account
  2. Click “Create API Key” in the Dashboard
  3. Copy the generated API Key (format: re_xxx)

Note

When using Resend’s test domain (onboarding@resend.dev), you can only send to the email address you used to register for Resend. For production use, you need to verify your own domain.

Webhook Configuration

# Notify - Webhook Provider
NOTIFY_WEBHOOK_URL=https://your-webhook.com/notify
bash

The webhook receives a POST request with JSON format:

{
  "event": "comment",
  "timestamp": "2026-03-17T12:00:00.000Z",
  "data": {
    "author": "John",
    "content": "Great article!",
    "postTitle": "How to Use Astro",
    "postUrl": "https://example.com/posts/how-to-use-astro"
  }
}
json

Configuration Example

Add complete configuration to your .env file:

# Notify - Telegram Provider
NOTIFY_TELEGRAM_BOT_TOKEN=123456789:ABCdefGHIjklMNOpqrsTUVwxyz
NOTIFY_TELEGRAM_CHAT_ID=123456789

# Notify - Email Provider (Resend)
NOTIFY_RESEND_API_KEY=re_xxx
NOTIFY_RESEND_FROM=noreply@yourdomain.com
NOTIFY_RESEND_TO=you@example.com

# Notify - Webhook Provider (Optional)
NOTIFY_WEBHOOK_URL=https://your-webhook.com/notify
bash

Notification Preview

Comment Notification

💬 New Comment

📖 Post: How to Use Astro
👤 Author: John

"Great article!"

🔗 View Comment
plaintext

AI Chat Notification

Waline Comment Notification Integration

If your blog uses the Waline comment system, you can configure a webhook to trigger notifications:

Configure Waline Webhook

Add to your Waline server configuration:

# Waline server environment variables
WEBHOOK=https://your-blog.pages.dev/api/notify/comment
yaml

Or in vercel.json / netlify.toml:

{
  "env": {
    "WEBHOOK": "https://your-blog.pages.dev/api/notify/comment"
  }
}
json

API Endpoints

The notification system provides the following API endpoint:

EndpointDescription
POST /api/notify/commentComment notification (Waline Webhook)

Custom Templates

To customize notification formats, create a custom notifier in your code:

Proxy Configuration

If your server requires a proxy to access external APIs:

# HTTP/HTTPS Proxy
HTTP_PROXY=http://127.0.0.1:7890
HTTPS_PROXY=http://127.0.0.1:7890
bash

The notification system will automatically detect and use the proxy.

Troubleshooting

Notification Send Failed

  1. Check environment variables: Ensure all required variables are correctly configured
  2. Check network: Ensure the server can access Telegram API (api.telegram.org) and Resend API (api.resend.com)
  3. Check logs: Notification failures are logged with error details

Telegram Notification Failed

Email Notification Failed

Architecture

The notification system is a standalone package @astro-minimax/notify:

packages/notify/
├── src/
│   ├── providers/    # Channel providers
│   │   ├── telegram.ts
│   │   ├── email.ts
│   │   └── webhook.ts
│   ├── templates/    # Notification templates
│   └── types.ts      # Type definitions
└── README.md
plaintext

Design Principles

Summary

The astro-minimax notification system provides simple yet powerful multi-channel notification capabilities. With just a few environment variables, you can receive real-time notifications for blog comments and AI conversations, helping you stay informed about your blog’s activity.



Previous Post
CLI Tools Guide
Next Post
Deployment Guide: Deploy astro-minimax to Multiple Platforms

评论区

文明评论,共建和谐社区