A Bitrix site administrator should receive notifications about critical events instantly: new order, payment failure, agent error, disk quota exceeded. Standard email events cover basic scenarios, but we often encounter cases where they are insufficient: delivery delays, no Telegram channel, inability to filter by priority. We develop a notification system that combines Email, Telegram, SMS, and an internal log — turnkey with priority and digest configuration. For example, when a YooKassa payment fails, the administrator should be immediately notified via Telegram to contact the customer promptly. Or when disk space is exceeded, an agent can send an SMS if the site is business-critical. Each minute of downtime costs an average of $90–130, so notification speed is critical. We implement such scenarios on PHP 8.1+ using a custom module based on infoblocks v2.0 and tagged caching.
How does the standard Bitrix notification system work?
The Bitrix core uses an email event mechanism: event code → email template → recipients. All events are registered in the b_event table, templates in b_event_message, and the history of sent emails (if logging is enabled) in b_event_log.
For e-commerce, critical events already exist: SALE_ORDER_NEW (new order), SALE_ORDER_PAID (payment received), SALE_ORDER_CANCEL (cancellation). You configure recipients in the template through the main module → "Email events".
The problem with the standard mechanism: emails are sent synchronously at the moment of the event, which adds up to 500 ms to page load time if SMTP is slow. The solution is to use a queue via the b_email_service table or an external SMTP with fast connectivity.
Why are email events alone insufficient?
Email events have three limitations:
- Only Email channel (cannot send Telegram or SMS);
- Synchronous sending (slows down the server);
- No built-in prioritization (all events are equal).
Telegram notifications work 10 times faster than Email for critical events, and SMS guarantees delivery even when the site is down. For non-standard scenarios, we hook into module events via init.php.
How to set up custom notifications via module events
New form submission — OnAfterAddResult of the form module:
AddEventHandler("form", "OnAfterAddResult", function($formId, $resultId, $arResult) { if ($formId == CALLBACK_FORM_ID) { notifyAdmin('New request #' . $resultId, formatFormData($arResult)); } }); Agent errors — agents in b_agent run without explicit logging. Wrap your agent code in try-catch and send a notification on exception:
function MyModuleAgent() { try { // agent code } catch (\Throwable $e) { notifyAdmin('Agent error', $e->getMessage() . "\n" . $e->getTraceAsString()); } return __FUNCTION__ . '();'; } Disk quota exceeded — Bitrix has an agent CIBlockAgent::CheckDiskQuota(). You can override it or supplement with your own agent that checks directory sizes and sends an alert when a threshold (e.g., 90% of quota) is exceeded.
Payment errors — the OnSalePaymentUpdate event with a check for status change to an error state:
AddEventHandler("sale", "OnSalePaymentUpdate", function($id, &$arFields) { if ($arFields['IS_RETURN'] === 'Y' || strpos($arFields['PS_STATUS_MESSAGE'], 'error') !== false) { notifyAdmin('Payment error', print_r($arFields, true)); } }); How to send a notification via Telegram?
Create a bot via BotFather, get BOT_TOKEN and CHAT_ID of the admin chat. Send via \Bitrix\Main\Web\HttpClient:
function notifyTelegram(string $message): void { $botToken = COption::GetOptionString('local', 'telegram_bot_token'); $chatId = COption::GetOptionString('local', 'telegram_admin_chat_id'); $httpClient = new \Bitrix\Main\Web\HttpClient(); $httpClient->post( "https://api.telegram.org/bot{$botToken}/sendMessage", ['chat_id' => $chatId, 'text' => $message, 'parse_mode' => 'HTML'] ); } Store tokens in b_option via COption, not in code — when rotating the token, you don't need to search through files.
Multi-channel delivery: Telegram, SMS, Push
Email is the base channel, but not always fast enough. For critical notifications, add:
Telegram bot
Delivery speed: 0.5–2 seconds. Reliability when site is down: low (requires internet). Cost: free.
SMS via API
For truly critical events (payment gateway unavailable, hacking attempts) — SMS via SMSC.ru or SMS.ru. Same HttpClient + API key. Cost per message: $1–1, justified when there is risk of losing an order.
Push notifications in browser
For notifications when the administrator is in the admin panel — via the system Bitrix Push Server (push.1c-bitrix.ru) or via Web Push API with VAPID keys.
| Channel | Delivery speed | Reliability when site down | Cost |
|---|---|---|---|
| 1 sec to 5 min | low (depends on SMTP) | free (via own server) | |
| Telegram | 0.5–2 sec | low (no internet) | free |
| SMS | 1–10 sec | high (mobile network) | $1–1 per msg |
| Push (admin panel) | instant | medium (only admin is open) | free (Bitrix Push Server) |
What is included in the development of the notification system
- Scenario analysis: we identify all critical events of your project.
- Design: channel architecture, priorities, digests.
- Implementation: custom module on infoblocks v2.0, events, agents.
- Channel configuration: Telegram bot, SMS gateway, push notifications.
- Integration with REST API for external services.
- Notification center in the admin panel with filtering and counters.
- Testing: load testing, fault tolerance.
- Documentation: description of events, channel setup.
- Support: maintenance for one month after implementation.
Estimated timelines
| Stage | Duration |
|---|---|
| Analysis and design | 1–2 days |
| Module development | 3–5 days |
| Channel configuration | 1–2 days |
| Testing and documentation | 1–2 days |
| Total | 5–10 days |
Typical errors when designing notifications
Common problems and how to avoid them
- Sending all events to all channels creates information noise. Assign priorities.
- Storing tokens in code — use
COptionor.settings.php. - Ignoring cleanup of the
b_event_logtable — after a month, the database can grow gigabytes on an active site. Set up an agent to delete records older than 30 days. - Not testing site downtime — external monitoring (UptimeRobot, Zabbix) is mandatory, because when the server goes down, internal agents won't fire.
We have been developing notification systems for more than 8 years and have implemented over 30 projects for Bitrix online stores. Order the development of a notification system, and we'll set up all channels for your project. We'll evaluate your project in 2 days — contact us.

