Telegram Notification Bot for Critical Site Events

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1 servicesAll 2065 services
Telegram Notification Bot for Critical Site Events
Simple
from 1 business day to 3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    823
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    848
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Developing a Telegram Bot for Critical Site Event Notifications

Monitoring critical events via Telegram is a quick way to get alerts about website problems on mobile phone, bypassing email and monitoring systems. Bot notifies: site went down, payment error, disk full, 500 errors appeared.

Event Types

// List of critical events with importance levels
enum AlertLevel: string {
    case CRITICAL = '🔴';  // requires immediate action
    case WARNING  = '🟡';  // requires attention
    case INFO     = '🔵';  // informational
}

class SiteEventAlerter
{
    public function alert(AlertLevel $level, string $event, array $context = []): void
    {
        $message = "{$level->value} <b>{$event}</b>\n\n";

        foreach ($context as $key => $value) {
            $message .= "<b>{$key}:</b> {$value}\n";
        }

        $message .= "\n⏰ " . now()->format('d.m.Y H:i:s');

        // Critical events — personal messages to on-call engineer
        $recipients = $level === AlertLevel::CRITICAL
            ? $this->getOnCallEngineers()
            : [$this->alertsChannelId];

        foreach ($recipients as $chatId) {
            $this->telegram->sendMessage($chatId, $message);
        }
    }
}

Integration into Code

// In exception handler (Handler.php)
public function report(Throwable $exception): void
{
    if ($exception instanceof PaymentException) {
        app(SiteEventAlerter::class)->alert(
            AlertLevel::CRITICAL,
            'Payment gateway error',
            [
                'Gateway' => $exception->getGateway(),
                'Order'   => $exception->getOrderId(),
                'Error'   => $exception->getMessage(),
            ]
        );
    }

    parent::report($exception);
}

// In scheduler (Kernel.php)
$schedule->call(function () {
    $freeSpace = disk_free_space('/') / disk_total_space('/') * 100;
    if ($freeSpace < 10) {
        app(SiteEventAlerter::class)->alert(
            AlertLevel::WARNING,
            'Low disk space',
            ['Free' => round($freeSpace, 1) . '%']
        );
    }
})->hourly();

Anti-Spam

Same error can generate hundreds of alerts per minute. Deduplication via Redis:

private function shouldSend(string $eventKey): bool
{
    $cacheKey = "alert_dedup:{$eventKey}";
    if (Cache::has($cacheKey)) return false;
    Cache::put($cacheKey, 1, now()->addMinutes(15));
    return true;
}

Timeline: 1–2 business days.