28 lines
787 B
JavaScript
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();
|