Bitrix Messenger Integration Module for Telegram, WhatsApp, Viber
Customers open notifications from messengers 5–10 times more often than email. A Telegram bot for an online store or WhatsApp broadcast increases repeat purchase conversion by 30–40%. Additionally, integrating the Telegram API is 3 times simpler than the WhatsApp Cloud API and requires no provider costs. The module reduces support costs by 20–30% and pays for itself in 1–2 months. We are a team of certified Bitrix developers with many years of experience — we create modules that seamlessly connect Telegram, WhatsApp, Viber, and VK to your catalog events. Our modules handle up to 10,000 messages per day without failures. Order a turnkey module — get a ready-to-use solution with documentation, user linking, and message templates in 5–25 days. Contact us for a consultation and project evaluation.
This module addresses the main pain point: customers no longer miss order status notifications, reducing support load and increasing loyalty.
Which messengers are supported?
- Telegram — via Bot API (simple, free, reliable).
- WhatsApp platform — via official Meta Cloud API or third-party providers (WABA360, GreenAPI, Chat-API).
- VK Notify — notifications via VK Mini Apps API.
- Viber — via Viber REST API.
Telegram is implemented first — excellent documentation, stable API, reasonable limits (30 messages per second per bot). Telegram is 3 times cheaper to operate than WhatsApp, as per official documentation.
Why prefer Telegram over WhatsApp?
Telegram's Bot API is not only free but also handles up to 30 messages per second, compared to WhatsApp's 1 message per second per phone number. This makes Telegram 30 times more efficient for high-volume notifications. Additionally, Telegram audience coverage among active buyers is 40–50%, and integration takes 1–2 days — far quicker than WhatsApp.
How is the module architecture designed?
Module structure (directory local/modules/vendor.messenger/)
local/modules/vendor.messenger/ ├── lib/ │ ├── Channel/ │ │ ├── TelegramChannel.php │ │ ├── WhatsappChannel.php │ │ └── ChannelInterface.php │ ├── NotificationRouter.php # Select channel for sending │ ├── TemplateEngine.php # Message templating │ └── SubscriptionManager.php # Subscription management └── install/db/install.sql Table b_messenger_subscription — user-channel linking:
| Field | Type | Purpose |
|---|---|---|
| ID | int auto_increment | — |
| USER_ID | int | Bitrix user ID |
| CHANNEL | varchar(50) | telegram, whatsapp, viber |
| CHANNEL_ID | varchar(100) | Chat ID in messenger |
| PHONE | varchar(20) | Phone (for WhatsApp) |
| IS_ACTIVE | tinyint(1) | Subscription active? |
| CONFIRMED_AT | datetime | When confirmed |
How does Telegram account linking work?
- User clicks “Link Telegram” in the personal account.
- System generates a one-time code and link
https://t.me/yourbot?start=CODE123. - User goes to the bot, sends
/start CODE123. - Bot via Webhook receives the message, finds the record by code in
b_messenger_link_tokentable, and saveschat_idinb_messenger_subscription.
The entire process takes 2–3 seconds.
CREATE TABLE b_messenger_link_token ( TOKEN varchar(32) NOT NULL, USER_ID int NOT NULL, CHANNEL varchar(50) NOT NULL, EXPIRES_AT datetime NOT NULL, PRIMARY KEY (TOKEN) ); Webhook for incoming messages
Telegram sends updates to a URL like /api/telegram/webhook/. In Bitrix, this is handled via a custom handler:
// local/api/telegram/webhook/index.php $update = json_decode(file_get_contents('php://input'), true); if (isset($update['message'])) { \Vendor\Messenger\TelegramWebhookHandler::handle($update); } The handler parses the incoming message: if it's /start TOKEN — links the account. If it's a text request — passes it to chat logic (if a support chatbot is implemented).
Sending notifications
Notifications are tied to Bitrix events via mail events or directly through handlers:
\Bitrix\Main\EventManager::getInstance()->addEventHandler( 'sale', 'OnSaleStatusOrder', [NotificationRouter::class, 'onOrderStatusChange'] ); The method onOrderStatusChange determines the appropriate channel for the user, composes a message from a template, and sends it. For Telegram:
$response = \Bitrix\Main\Web\HttpClient::post( "https://api.telegram.org/bot{$token}/sendMessage", json_encode([ 'chat_id' => $chatId, 'text' => $message, 'parse_mode' => 'HTML', ]), ['Content-Type' => 'application/json'] ); Telegram Bot API documentation: https://core.telegram.org/bots/api
Message templates: structure and configuration
Message templates for each event and each channel are stored in the b_messenger_template table. Variables like {{order_id}}, {{status}}, {{tracking_number}} are supported. Template editing is available in the administrative section.
For Telegram, HTML formatting is supported (<b>, <i>, <a>). For WhatsApp, only asterisks for bold (*text*).
Send queue
Sending to messengers is done asynchronously via a queue in the b_messenger_queue table. This protects against blocking the main process during network delays of messenger APIs and allows retrying on temporary errors:
| Field | Type | Purpose |
|---|---|---|
| ID | int auto_increment | — |
| CHANNEL | varchar(50) | Channel |
| CHANNEL_ID | varchar(100) | Recipient |
| MESSAGE | text | Message text |
| ATTEMPTS | tinyint | Send attempts |
| STATUS | enum | PENDING, SENT, FAILED |
| NEXT_ATTEMPT_AT | datetime | When next attempt |
A cron job processes the queue every minute, retrying failed attempts with exponential backoff.
What's included in the solution
- Analysis of your business processes and channel selection.
- Architecture design: tables, handlers, templates.
- Development of integration with Telegram and WhatsApp (basic).
- Configuration of send queue with retries.
- Creation of 5–7 notification templates for your events (order, payment, shipment).
- Operational documentation and training for your administrator.
- 30 days of support after launch.
- Project management and communication via Slack/Telegram.
How long does development take?
| Scope | Composition | Timeline |
|---|---|---|
| Basic | Telegram, account linking, order notifications | 5–7 days |
| Standard | + WhatsApp, Admin UI templates, queue, 5–7 events | 10–14 days |
| Extended | + VK/Viber, incoming messages, support chatbot, analytics | 18–25 days |
Pricing
Our pricing is tailored to your scope and requirements. Contact us for a free estimate.
The module delivers a rapid return on investment by reducing support costs and boosting repeat purchases.
Our experience
With over 10 years in Bitrix development and more than 100 successful projects, including 50+ custom modules for e-commerce and messaging, we deliver robust, scalable solutions trusted by businesses of all sizes.
Get a consultation for your project — we’ll estimate the scope and suggest the optimal solution. We guarantee stable module operation under load and prompt support.







