
BimaMost production applications need some form of real-time alerting. When something goes wrong — a...
Most production applications need some form of real-time alerting.
When something goes wrong — a payment fails, an API crashes, or a user submits a contact form — someone needs to know immediately.
Large teams often use tools like Sentry, Datadog, or PagerDuty for this. These platforms are powerful, but they can also be expensive and complex to configure, especially for small projects or solo developers.
So instead of integrating a full observability stack, I built a lightweight alerting system using something I already use every day: Telegram.
In this guide, I’ll show you how to set up a free Telegram-based notification system that can alert you about:
Telegram is surprisingly perfect as a developer alerting channel:
Instead of building dashboards or constantly checking logs, your application can send messages directly to a Telegram group.
You only need four things:
That’s it. No servers, no SDKs, no third-party monitoring service.
Open Telegram and search for @botfather.
Run the command:
/newbot
Follow the prompts and Telegram will give you a bot token.
This token is basically the password your application will use to send messages.
If you’ve never done this before, you can simply ask any AI assistant:
“How do I create a Telegram bot and get the bot token?”
Or follow this tutorial.
Create a Telegram group for alerts, then:
This allows your app to send one message and notify everyone at once.
Telegram bots don’t send messages using usernames or group names. They use a chat ID.
To get it:
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
You’ll see a JSON response. Look for:
"chat": {
"id": -1001234567890,
"title": "My Alerts Group"
}
Copy the id. That is your chat ID.
Telegram provides a simple HTTP endpoint called sendMessage.
POST https://api.telegram.org/bot<TOKEN>/sendMessage
Example payload:
{
"chat_id": "-1001234567890",
"text": "Hello from my web app"
}
You can test this using:
Once this works, your alerting system is already functional.
Additionally, you can read more about the telegram api here.
Raw text alerts quickly become hard to read. Instead, format them so they are easy to scan on mobile.
Example:
🚨 *Server Error*
Endpoint: /api/payments
Status: 500
Telegram supports:
This means you can send alerts that look structured and professional instead of messy log dumps.
Once you have this set up, you can send notifications for almost anything.
This turns Telegram into a lightweight observability and business monitoring tool.
Here’s a minimal reusable function:
import axios from "axios";
const token = process.env.TELEGRAM_BOT_TOKEN;
const chatId = process.env.TELEGRAM_CHAT_ID;
export async function sendTelegramAlert(message: string) {
const url = `https://api.telegram.org/bot${token}/sendMessage`;
await axios.post(url, {
chat_id: chatId,
text: message,
parse_mode: "Markdown"
});
}
Now you can call this anywhere in your application:
await sendTelegramAlert("🚨 Database connection failed");
You can also trigger alerts from the frontend when API calls fail.
try {
await api.createOrder(data);
} catch (err) {
await sendTelegramAlert("⚠️ Order creation failed");
}
This is especially useful for catching silent failures during production that users might not report.
Instead of relying only on email, you can push new leads directly to Telegram:
📩 New Contact Form Submission
Name: John Doe
Email: john@example.com
Message: I’m interested in your services.
This ensures you never miss an important message because it landed in spam.
Telegram alerts are simple and effective, but they are not a full replacement for tools like Sentry or Datadog.
You won’t get:
However, for:
this approach provides a huge improvement over having no alerting at all.
You don’t always need a complex observability stack to stay informed about what’s happening in your application. With just a Telegram bot and a few lines of code, you can build a real-time alerting system that notifies you and your team instantly.
It’s free, quick to set up, and flexible enough to integrate with both frontend and backend workflows.
Sometimes, simple tools are all you need.