Files
LogMaster/test-monitor-telegram.js
Kevin 44cd9ab001
Some checks failed
LogMaster CI/CD / build-and-test (push) Has been cancelled
LogMaster CI/CD / docker (push) Has been cancelled
Initial commit: LogMaster with Viewer Collector Monitor modes
2026-05-04 13:50:15 +02:00

28 lines
787 B
JavaScript

const http = require('http');
// Test the notification endpoint on the monitor
const payload = JSON.stringify({
type: 'telegram',
botToken: '8116790669:AAE_llOFDFSwDhPx40vZMBa6dGv3Xxa9ZiQ',
chatId: '8599028500',
});
console.log('Testing Telegram notification via Monitor API...');
const req = http.request({
hostname: 'localhost', port: 8082,
path: '/api/monitor/test-notification',
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) },
}, (res) => {
let body = '';
res.on('data', c => body += c);
res.on('end', () => {
console.log(' Status:', res.statusCode);
console.log(' Response:', body);
});
});
req.on('error', (e) => console.error(' Error:', e.message));
req.write(payload);
req.end();