1.0.1 • Published 4 months ago
notifier-ez v1.0.1
Notifier EZ
A unified notification service that supports multiple platforms including Discord, Telegram, Slack, Gotify, Bark, and SMTP email.
Usage
import { createNotifier } from "notifier-ez";
// Create a Discord notifier instance
let notifier = createNotifier(
"discord://CustomUsername:YOUR-WEBHOOK-TOKEN@CHANNEL-ID"
);
// Send notifications
notifier.send({
title: "CPU Usage Alert",
message: "CPU usage exceeded 90%",
priority: "high",
});
// create a smtp notification
notifier = createNotifier(
"smtp://username:password@host:port?from=fromAddress&to=toAddress,toAddress"
);
notifier.send({
title: "System Update",
message: "Deployment completed successfully",
priority: "normal",
});
notifier.send({
title: "Daily Report",
message: "All systems operational",
priority: "low",
});
Configuration
Pass any of these url formats into the notifier, and the notifier will automatically detect the service type.
Discord
discord://username:webhook-token@channel-id
username
: Your custom username for the webhookwebhook-token
: The token part from your Discord webhook URLchannel-id
: Your Discord channel ID
Telegram
telegram://:bot-token@chat-id
bot-token
: Your Telegram bot token URL encodedchat-id
: Your chat ID (can be group or individual)
Slack
slack://token@webhook-id
- Format:
T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Gotify
gotify://hostname:port/token
hostname
: Your Gotify server hostnameport
: Server port (optional)token
: Your Gotify application token
Bark
bark://device-key@server
device-key
: Your Bark device keyserver
: Bark server (default: api.day.app)
SMTP (Email)
smtp://username:password@host:port?from=fromAddress&to=toAddress1,toAddress2
username
: SMTP usernamepassword
: SMTP passwordhost
: SMTP server hostnameport
: SMTP port (usually 465 for SSL)from
: Sender email addressto
: Recipient email address(es), comma-separated