Deploy: 2026-05-21 18:24:56

This commit is contained in:
Hamza-Ayed
2026-05-21 18:24:56 +03:00
parent 0e0a3f77c0
commit 2047fcd312
3 changed files with 6 additions and 5 deletions

View File

@@ -12,17 +12,17 @@ if (!fs.existsSync(SESSIONS_DIR)) {
fs.mkdirSync(SESSIONS_DIR, { recursive: true });
}
const WEBHOOK_SECRET = process.env.WEBHOOK_SECRET;
async function sendWebhook(webhook_url, payload) {
try {
console.log(`Sending webhook to ${webhook_url} with state ${payload.state}`);
await axios.post(webhook_url, payload, {
headers: {
'Content-Type': 'application/json',
'X-Webhook-Secret': WEBHOOK_SECRET
'X-Webhook-Secret': process.env.WEBHOOK_SECRET || 'fallback'
},
timeout: 5000
});
console.log(`Webhook sent successfully to ${webhook_url}`);
} catch (err) {
console.error(`Failed to send webhook to ${webhook_url}:`, err.message);
}