We are still updating this page. Some data may be missing here — we will complete it shortly.
Quick Start
Installing and setting up a Telegram bot
# Create a bot via @BotFather
# Get the token and chat_id
Usage on the server side
import { LogLevel, Logger, TelegramHandler } from '@bitrix24/b24jssdk'
// Create a logger with Telegram handler
const $logger = new Logger('my-app')
const telegramHandler = new TelegramHandler(LogLevel.ERROR, {
botToken: 'YOUR_BOT_TOKEN',
chatId: 'YOUR_CHAT_ID',
parseMode: 'HTML', // or 'MarkdownV2'
disableNotification: false, // Send notifications
disableWebPagePreview: true // Disable link previews
});
$logger.pushHandler(telegramHandler)
// Now critical errors will be sent to Telegram
$logger.error('Payment service unavailable', {
service: 'stripe',
error: 'Connection timeout',
duration: '30s'
})
Usage on the client side
On the client side, it is not supported due to security requirements.
Logger
Logger inspired by PHP Monolog, provides a structured logging system with support for channels, handlers, processors, and formatters. Implementation follows PSR-3 principles and the chain of responsibility pattern.
Limiters
The restrictions system provides a comprehensive mechanism for managing request frequency, operation execution time, and adaptive delays.