wasabi-alert
v1.0.2
Published
A simple Telegram bot message sender for Bun and React applications
Maintainers
Readme
Wasabi Alert
A simple and modern Telegram bot message sender for Bun and React applications.
Installation
npm install wasabi-alertUsage
Setup
First, create a Telegram bot and get your bot token and chat ID. Then create a client:
import { createWasabiAlertClient } from "wasabi-alert";
const wasabi = createWasabiAlertClient({
bot_token: process.env.TELEGRAM_BOT_TOKEN,
chat_id: process.env.TELEGRAM_CHAT_ID,
});Sending Messages
// Messages return a result object
const result = await wasabi.send("Hello, world!");
if (!result.success) {
console.log("Failed to send message:", result.error);
}
// With message type, title and source
const result = await wasabi.send("System is running low on memory", {
type: "alert",
title: "Memory Warning",
source: "backend-service",
});
// The send method never throws, it always returns a result object
type Result = {
success: boolean;
error?: string;
data?: any;
};Message Options
| Option | Type | Description |
| ------- | ------------------------------------------- | ---------------------------------------- |
| type | "info" \| "alert" \| "success" \| "error" | The type of message (defaults to "info") |
| title | string | Optional title for the message |
Message Format
Messages are formatted in MarkdownV2 and include:
- Message type emoji
- Optional title
- Message content
- Source URL
- Timestamp
Message Types
info- ℹ️ Information messagesalert- ⚠️ Warning messagessuccess- ✅ Success messageserror- ❌ Error messages
License
MIT
